本文整理汇总了C++中CSentence::GetCloseCaptionPhrase方法的典型用法代码示例。如果您正苦于以下问题:C++ CSentence::GetCloseCaptionPhrase方法的具体用法?C++ CSentence::GetCloseCaptionPhrase怎么用?C++ CSentence::GetCloseCaptionPhrase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSentence
的用法示例。
在下文中一共展示了CSentence::GetCloseCaptionPhrase方法的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 )
//.........这里部分代码省略.........