// 中目盛り描画 void TimelineEditorView::DrawMiddleScale(const CDC& dcDC, const int& iDrawFrame, const int& iHeight, POINT& pScaleLine) { #ifdef SEEKBAR_MIDDLESCALELINE_DRAW CString strFrameNumber; double dPointX, dPointY; HFONT hfDrawFont; strFrameNumber.Format(_T("%d"), iDrawFrame); CreateDrawFont(SEEKBARTIMECODE_MIDDLE_FONTSIZE, 0, DEFAULT_FONTFACE, hfDrawFont); ChangeScreenPointToOpenGLPoint(pScaleLine.x + SEEKBARTIMECODE_MARGINX, m_pSeekBarRect->top + SEEKBARTIMECODE_MIDDLE_MARGINY, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, SEEKBARTIMECODETEXTCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); DeleteObject(hfDrawFont); #endif // 目盛り、ライン描画 DrawLine(iHeight, pScaleLine.x, m_pSeekBarRect->top + SEEKBARMIDDLESCALE_TOPMARGIN, pScaleLine.x, m_pSeekBarRect->bottom, SEEKBARMIDDLESCALE_LINEWIDTH, SEEKBARMIDDLESCALECOLOR_BRUSH_FLOAT); #ifdef SEEKBAR_MIDDLESCALELINE_DRAW DrawLine(iHeight, pScaleLine.x, m_pSeekBarRect->bottom + 1, pScaleLine.x, m_pTimelineDataRect->bottom, SEEKBARMIDDLESCALELINE_LINEWIDTH, SEEKBARMIDDLESCALELINECOLOR_BRUSH_FLOAT); #endif return; }
void CSideBar::SetTooltipFont() { TVTest::Style::Font Font; GetSystemFont(DrawUtil::FONT_STATUS,&Font); CreateDrawFont(Font,&m_TooltipFont); m_Tooltip.SetFont(m_TooltipFont.GetHandle()); }
void CInformationPanel::ApplyStyle() { if (m_hwnd!=NULL) { CreateDrawFont(m_StyleFont,&m_Font); LOGFONT lf={}; lf.lfHeight=m_Style.ButtonSize.Height; lf.lfCharSet=SYMBOL_CHARSET; ::lstrcpy(lf.lfFaceName,TEXT("Marlett")); m_IconFont.Create(&lf); CalcFontHeight(); m_ItemButtonWidth=m_FontHeight*15/10+m_Style.ItemButtonPadding.Horz(); } }
// ドラッグ&ドロップ中のイメージを描画する BOOL TimelineEditorView::DrawDragAndDropClip(const CDC& dcDC, const int& iHeight) { ClipDataRect* pClipRect = m_pTimelineDataOperator->GetDragAndDropClipDataRect(); if (m_pTimelineDataOperator->EnableDrawDragRect()) { pClipRect->DrawMovingRect(iHeight); } else if (m_pTimelineDataOperator->IsDropFileCrrect()) { pClipRect->SetOverlappingVert(static_cast<float>(pClipRect->left), static_cast<float>(iHeight - pClipRect->top), static_cast<float>(pClipRect->right), static_cast<float>(iHeight - pClipRect->bottom)); pClipRect->DrawOverlappingRect(iHeight); } #ifdef _DEBUG //TODO: デバッグ CString strText; double dPointX, dPointY; HFONT hfDrawFont; CreateDrawFont(13, 0, DEFAULT_FONTFACE, hfDrawFont); strText.Format(_T("DropClipInPoint %d"), pClipRect->GetTimelineInPoint()); ChangeScreenPointToOpenGLPoint(700, 15, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("DropClipLeftPoint %d"), pClipRect->left); ChangeScreenPointToOpenGLPoint(700, 30, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("DropClipOutPoint %d"), pClipRect->GetTimelineOutPoint()); ChangeScreenPointToOpenGLPoint(700, 45, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("DropClipRightPoint %d"), pClipRect->right); ChangeScreenPointToOpenGLPoint(700, 60, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("DropClipDuration %d"), pClipRect->GetDuration()); ChangeScreenPointToOpenGLPoint(700, 75, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); DeleteObject(hfDrawFont); #endif return TRUE; }
// トラック描画 void TimelineEditorView::DrawTrack(const CDC& dcDC, const int& iHeight) { // TODO: とりあえず今は枠と名前だけ TrackDataRectList* pTrackDataRectList = m_pTrackDataVideoManager->GetTrackDataRectList(); TrackDataRect* pTrackDataRect; double dPointX, dPointY; HFONT hfDrawFont; CreateDrawFont(13, 0, DEFAULT_FONTFACE, hfDrawFont); for (int i = 0; i < m_pTrackDataVideoManager->GetTrackCount(); ++i) { pTrackDataRect = m_pTrackDataVideoManager->GetTrackDataRect(pTrackDataRectList->at(i)); pTrackDataRect->DrawMyBottomLine(); ChangeScreenPointToOpenGLPoint(pTrackDataRect->left + TRACK_NAME_MARGINLEFT, (pTrackDataRect->top + TRACK_NAME_MARGINTOP), iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(pTrackDataRect->GetTrackName()), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); } DeleteObject(hfDrawFont); }
// 大目盛り描画 void TimelineEditorView::DrawBigScale(const CDC& dcDC, const int& iDrawFrame, const int& iHeight, POINT& pScaleLine) { // TODO: 製品はタイムコードを表示 CString strFrameNumber; double dPointX, dPointY; HFONT hfDrawFont; m_pTimecodeOperator->ChangeFrameToTimecode(iDrawFrame, strFrameNumber, DF_MODE); CreateDrawFont(SEEKBARTIMECODE_FONTSIZE, 0, DEFAULT_FONTFACE, hfDrawFont); ChangeScreenPointToOpenGLPoint(pScaleLine.x + SEEKBARTIMECODE_MARGINX, m_pSeekBarRect->top + SEEKBARTIMECODE_MARGINY, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, SEEKBARTIMECODETEXTCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); // 目盛り、ライン描画 DrawLine(iHeight, pScaleLine.x, m_pSeekBarRect->top + SEEKBARBIGSCALE_TOPMARGIN, pScaleLine.x, m_pSeekBarRect->bottom, SEEKBARBIGSCALE_LINEWIDTH, SEEKBARBIGSCALECOLOR_BRUSH_FLOAT); DrawLine(iHeight, pScaleLine.x, m_pSeekBarRect->bottom + 1, pScaleLine.x, m_pTimelineDataRect->bottom, SEEKBARBIGSCALELINE_LINEWIDTH, SEEKBARBIGSCALELINECOLOR_BRUSH_FLOAT); DeleteObject(hfDrawFont); return; }
// 操作中クリップの描画を行う BOOL TimelineEditorView::DrawOperatingClip(const CDC& dcDC, const int& iHeight) { // TODO: 元のクリップの色を変える 元々各タイミングで実施するよう変更 m_pOperatingClipData->DrawOperatingOldRect(iHeight); CRect* rcOperatingRect = m_pOperatingClipData->GetOperatingRect(); if (m_pTimelineDataOperator->IsSingleInTrim() || m_pTimelineDataOperator->IsSingleOutTrim()) { m_pOperatingClipData->DrawSingleTrimRect(iHeight, m_pTimelineDataOperator->IsSingleInTrim()); #ifdef _DEBUG //TODO: デバッグ CString strText; double dPointX, dPointY; int iPoint; int iDuration; if (m_pTimelineDataOperator->IsSingleInTrim()) { iPoint = m_pOperatingClipData->GetTimelineInPoint() + m_pTimelineDataOperator->GetOperatingClipFrameCount(); } else { iPoint = m_pOperatingClipData->GetTimelineInPoint(); } HFONT hfDrawFont; CreateDrawFont(13, 0, DEFAULT_FONTFACE, hfDrawFont); strText.Format(_T("TrimingClipInPoint %d"), iPoint); ChangeScreenPointToOpenGLPoint(700, 15, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("TrimingClipLeftPoint %d"), rcOperatingRect->left); ChangeScreenPointToOpenGLPoint(700, 30, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); if (m_pTimelineDataOperator->IsSingleInTrim()) { iPoint = m_pOperatingClipData->GetTimelineOutPoint(); iDuration = m_pOperatingClipData->GetDuration() - m_pTimelineDataOperator->GetOperatingClipFrameCount(); } else { iPoint = m_pOperatingClipData->GetTimelineOutPoint() + m_pTimelineDataOperator->GetOperatingClipFrameCount(); iDuration = m_pOperatingClipData->GetDuration() + m_pTimelineDataOperator->GetOperatingClipFrameCount(); } strText.Format(_T("TrimingClipOutPoint %d"), iPoint); ChangeScreenPointToOpenGLPoint(700, 45, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("TrimingClipRightPoint %d"), rcOperatingRect->right); ChangeScreenPointToOpenGLPoint(700, 60, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("TrimingClipDuration %d"), iDuration); ChangeScreenPointToOpenGLPoint(700, 75, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); DeleteObject(hfDrawFont); #endif } else { // ドロップ位置用 m_pOperatingClipData->DrawMovingRect(iHeight); #ifdef _DEBUG //TODO: デバッグ CString strText; double dPointX, dPointY; HFONT hfDrawFont; CreateDrawFont(13, 0, DEFAULT_FONTFACE, hfDrawFont); strText.Format(_T("MovingClipInPoint %d"), m_pOperatingClipData->GetTimelineInPoint() + m_pTimelineDataOperator->GetOperatingClipFrameCount()); ChangeScreenPointToOpenGLPoint(700, 15, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("MovingClipLeftPoint %d"), rcOperatingRect->left); ChangeScreenPointToOpenGLPoint(700, 30, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("MovingClipRightPoint %d"), rcOperatingRect->right); ChangeScreenPointToOpenGLPoint(700, 45, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); #endif // マウス位置追随用 CRect rcMousePointRect = m_pTimelineDataOperator->GetMousePointRect(); if (!(rcMousePointRect.EqualRect(rcOperatingRect))) { m_pOperatingClipData->SetOverlappingVert(static_cast<float>(rcMousePointRect.left), static_cast<float>(iHeight - rcMousePointRect.top), static_cast<float>(rcMousePointRect.right), static_cast<float>(iHeight - rcMousePointRect.bottom)); m_pOperatingClipData->DrawOverlappingRect(iHeight); #ifdef _DEBUG strText.Format(_T("MouseMoveClipLeftPoint %d"), rcMousePointRect.left); ChangeScreenPointToOpenGLPoint(700, 60, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strText.Format(_T("MouseMoveClipRightPoint %d"), rcMousePointRect.right); ChangeScreenPointToOpenGLPoint(700, 75, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strText), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); DeleteObject(hfDrawFont); #endif } } return TRUE; }
// トラック内の表示範囲内クリップをサーチして描画 int TimelineEditorView::DrawClipInTrack(const CDC& dcDC, TrackDataRect* pTrackDataRect, const int& iHeight, int iClipTotalCount) { //TODO: 毎回全サーチするのではなくてvectorとかに表示範囲のオブジェクトを設定しておいて操作のたびにvectorを更新する int iStartFrame = m_pTimelineDataOperator->GetOperatingLeftFrameNumber(); if (iStartFrame < 0) { iStartFrame = 0; } //ClipDataPositionMap mpClipDataMap; m_mpClipMap.clear(); int iClipCount = pTrackDataRect->GetTrackDataInfo()->GetClipDataInRange(iStartFrame, m_pTimelineDataOperator->GetOperatingRightFrameNumber(), m_mpClipMap); ClipDataRect* pClipData; ClipDataRect* pClipDataLeft; pClipDataLeft = nullptr; if (iClipCount > 0) { #ifdef _DEBUG CString strFrameNumber; double dPointX, dPointY; HFONT hfDrawFont; CreateDrawFont(13, 0, DEFAULT_FONTFACE, hfDrawFont); #endif ClipDataPositionMap::iterator itr = m_mpClipMap.begin(); while (itr != m_mpClipMap.end()) { pClipData = (*itr).second; m_pTimelineDataOperator->CalcClipRectDisplayPoint(static_cast<CRect&>(*pClipData), pClipData, static_cast<CRect>(pTrackDataRect)); pClipData->SetVert(iHeight); pClipData->DrawMyFillRect(); if (pClipDataLeft != nullptr) { // トランジション部分塗り替え if (pClipData->left < pClipDataLeft->right) { m_pTransitionRect->CopyRect(pClipData); m_pTransitionRect->right = pClipDataLeft->right; m_pTransitionRect->SetVert(iHeight); m_pTransitionRect->DrawMyFillRect(); m_pTransitionRect->DrawMyLeftLine(); m_pTransitionRect->DrawMyRightLine(); m_pTransitionRect->SetRectEmpty(); } else if (pClipData->left == pClipDataLeft->right) { pClipDataLeft->DrawMyRightLine(); } } pClipDataLeft = pClipData; ++itr; #ifdef _DEBUG strFrameNumber.Format(_T(" L:%d T:%d R:%d B:%d I:%d O:%d D:%d i:%d o:%d"), pClipData->left, pClipData->top, pClipData->right, pClipData->bottom, pClipData->GetTimelineInPoint(), pClipData->GetTimelineOutPoint(), pClipData->GetDuration(), pClipData->GetInPoint(), pClipData->GetOutPoint()); ChangeScreenPointToOpenGLPoint(5, 105 + (iClipTotalCount * 15), iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(pTrackDataRect->GetTrackName() + strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); #endif ++iClipTotalCount; } m_mpClipMap.clear(); #ifdef _DEBUG DeleteObject(hfDrawFont); #endif } return iClipTotalCount; }
//画面描画 void TimelineEditorView::DrawTimelineEditorView(const CDC& dcDC) { CRect rcRect; GetClientRect(&rcRect); int iHeight = rcRect.Height(); CString strPoint; // プレビューエリア枠線描画 m_pDebugInfoPanelRect->DrawMyBorderRect(3.0f); // タイムラインヘッダーコントロールパネル描画 DrawTimelineControlPanel(); // シークバーエリア描画 DrawSeekBar(dcDC, iHeight); // 静止クリップ描画 DrawClip(dcDC, iHeight); // 操作イメージ描画 if ((m_pTimelineDataOperator->IsSingleInTrim() || m_pTimelineDataOperator->IsSingleOutTrim() || m_pTimelineDataOperator->IsMove()) && (!(m_pOperatingClipData->GetOperatingRect()->IsRectEmpty()))) { DrawOperatingClip(dcDC, iHeight); } if (m_pTimelineDataOperator->IsDragAndDrop()) { DrawDragAndDropClip(dcDC, iHeight); } // トラックヘッダー描画 DrawTrackHeader(); // タイムラインデータエリア描画 DrawTimelineDataRect(); // トラック枠描画 DrawTrack(dcDC, iHeight); // タイムラインカーソル/シャトル操作補助線描画 DrawTimelineCursor(dcDC, iHeight); #ifdef _DEBUG CString strFrameNumber; double dPointX, dPointY; HFONT hfDrawFont; CreateDrawFont(13, 0, DEFAULT_FONTFACE, hfDrawFont); strFrameNumber.Format(_T("TLCursor %d"), m_pTimelineDataOperator->GetTimelineCursorFramePosition()); ChangeScreenPointToOpenGLPoint(5, 15, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strFrameNumber.Format(_T("Frame Left %d Right %d"), m_pTimelineDataOperator->GetLeftFrameNumber(), m_pTimelineDataOperator->GetRightFrameNumber()); ChangeScreenPointToOpenGLPoint(5, 30, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strFrameNumber.Format(_T("Operating TLCursor %d"), m_pTimelineDataOperator->GetOperatingTimelineCursorFramePosition()); ChangeScreenPointToOpenGLPoint(5, 45, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strFrameNumber.Format(_T("Operating Left %d Right %d"), m_pTimelineDataOperator->GetOperatingLeftFrameNumber(), m_pTimelineDataOperator->GetOperatingRightFrameNumber()); ChangeScreenPointToOpenGLPoint(5, 60, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strFrameNumber.Format(_T("CursorLine Point %d"), m_iTimelineCursorPoint); ChangeScreenPointToOpenGLPoint(5, 75, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); strFrameNumber.Format(_T("f/p %d p/f %d"), m_pTimelineDataOperator->GetFramePerPoint(), m_pTimelineDataOperator->GetPointPerFrame()); ChangeScreenPointToOpenGLPoint(5, 90, iHeight, dPointX, dPointY); DrawTextOnGL(static_cast<PCTSTR>(strFrameNumber), dcDC.GetSafeHdc(), hfDrawFont, BLACKCOLOR_BRUSH_FLOAT, static_cast<float>(dPointX), static_cast<float>(dPointY), TIMELINE_DEFAULTZ, 1.0f); DeleteObject(hfDrawFont); #endif }