当前位置: 首页>>代码示例>>C++>>正文


C++ CSentence::GetCloseCaptionPhraseCount方法代码示例

本文整理汇总了C++中CSentence::GetCloseCaptionPhraseCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CSentence::GetCloseCaptionPhraseCount方法的具体用法?C++ CSentence::GetCloseCaptionPhraseCount怎么用?C++ CSentence::GetCloseCaptionPhraseCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSentence的用法示例。


在下文中一共展示了CSentence::GetCloseCaptionPhraseCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CloseCaption_Redraw

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : drawHelper - 
//			rcWorkSpace - 
//-----------------------------------------------------------------------------
void PhonemeEditor::CloseCaption_Redraw( CChoreoWidgetDrawHelper& drawHelper, RECT& rcWorkSpace, CSentence& sentence )
{
    if ( GetMode() != MODE_CLOSECAPTION )
        return;

    float starttime = m_nLeftOffset / GetPixelsPerSecond();
    float endtime = w2() / GetPixelsPerSecond() + starttime;

    RECT rcCC;
    CloseCaption_GetTrayTopBottom( rcCC );

    int ypos = rcCC.top;

    const char *fontName = "Arial Unicode MS";

    RECT rcTitle = rcCC;
    OffsetRect( &rcTitle, 0, -20 );
    rcTitle.left = 15;
    rcTitle.right = w2();

    drawHelper.DrawColoredText( "Arial", 15, FW_BOLD, PEColor( COLOR_PHONEME_CC_TEXT ), rcTitle,
        "Close caption..." );

    drawHelper.DrawColoredLine( PEColor( COLOR_PHONEME_CC_TAG_FILLER_NORMAL ), PS_SOLID, 1,
        0, rcCC.top-1, w2(), rcCC.top-1 );
    drawHelper.DrawColoredLine( PEColor( COLOR_PHONEME_CC_TAG_FILLER_NORMAL ), PS_SOLID, 1,
        0, rcCC.bottom, w2(), rcCC.bottom );
    

    bool drawselected;
    for ( int pass = 0; pass < 2 ; pass++ )
    {
        drawselected = pass == 0 ? false : true;

        int count = sentence.GetCloseCaptionPhraseCount( CC_ENGLISH );
        for (int k = 0; k < count; k++)
        {
            CCloseCaptionPhrase *phrase = sentence.GetCloseCaptionPhrase( CC_ENGLISH, k );
            if ( !phrase )
                continue;

            if ( phrase->GetSelected() != drawselected )
                continue;

            float t1 = phrase->GetStartTime();
            float t2 = phrase->GetEndTime();

            // Tag it
            float frac = ( t1 - starttime ) / ( endtime - starttime );

            int xpos = ( int )( frac * rcWorkSpace.right );

            //if ( frac <= 0.0 )
            //	xpos = 0;

            // Draw duration
            float frac2  = ( t2 - starttime ) / ( endtime - starttime );
            if ( frac2 < 0.0 )
                continue;

            int xpos2 = ( int )( frac2 * rcWorkSpace.right );

            // Draw line and vertical ticks
            RECT rcPhrase;
            CloseCaption_GetPhraseRect( phrase, rcPhrase );

            /*
            rcPhrase.left = xpos;
            rcPhrase.right = xpos2;
            rcPhrase.top = ypos;
            rcPhrase.bottom = ypos + m_nTickHeight - 1;
            */

            drawHelper.DrawFilledRect( 
                PEColor( phrase->GetSelected() ? COLOR_PHONEME_CC_TAG_SELECTED : COLOR_PHONEME_CC_TAG_FILLER_NORMAL ), 
                rcPhrase );

            COLORREF border = PEColor( phrase->GetSelected() ? COLOR_PHONEME_CC_TAG_BORDER_SELECTED : COLOR_PHONEME_CC_TAG_BORDER );

            drawHelper.DrawOutlinedRect( border, PS_SOLID, 1, rcPhrase );

            //if ( frac >= 0.0 && frac <= 1.0 )
            {
                int fontsize = 9;

                RECT rcText;
                rcText.left = xpos;
                rcText.right = xpos2;
                rcText.top = rcCC.top;
                rcText.bottom = rcCC.bottom;

                int availw = xpos2 - xpos;

                int tokenCount = phrase->CountTokens();
                if ( tokenCount >= 1 )
//.........这里部分代码省略.........
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:101,代码来源:PhonemeEditor_CloseCaption.cpp


注:本文中的CSentence::GetCloseCaptionPhraseCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。