本文整理汇总了C++中Doc::GetRightMargin方法的典型用法代码示例。如果您正苦于以下问题:C++ Doc::GetRightMargin方法的具体用法?C++ Doc::GetRightMargin怎么用?C++ Doc::GetRightMargin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doc
的用法示例。
在下文中一共展示了Doc::GetRightMargin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetBoundingBoxXShift
int Object::SetBoundingBoxXShift( ArrayPtrVoid params )
{
// param 0: the minimu position (i.e., the width of the previous element)
// param 1: the maximum width in the current measure
// param 2: the Doc
int *min_pos = static_cast<int*>(params[0]);
int *measure_width = static_cast<int*>(params[1]);
Doc *doc = static_cast<Doc*>(params[2]);
// starting a new measure
Measure *current_measure = dynamic_cast<Measure*>(this);
if ( current_measure ) {
// we reset the measure width and the minimum position
(*measure_width) = 0;
(*min_pos) = 0;
if (current_measure->GetLeftBarlineType() != BARRENDITION_NONE) {
current_measure->GetLeftBarline()->SetBoundingBoxXShift( params );
}
return FUNCTOR_CONTINUE;
}
// starting an new layer
Layer *current_layer = dynamic_cast<Layer*>(this);
if ( current_layer ) {
// reset it as the minimum position to the step (HARDCODED)
(*min_pos) = 30 * doc->m_drawingUnit[0] / 10;
// set scoreDef attr
if (current_layer->GetDrawingClef()) {
current_layer->GetDrawingClef()->SetBoundingBoxXShift( params );
}
if (current_layer->GetDrawingKeySig()) {
current_layer->GetDrawingKeySig()->SetBoundingBoxXShift( params );
}
if (current_layer->GetDrawingMensur()) {
current_layer->GetDrawingMensur()->SetBoundingBoxXShift( params );
}
if (current_layer->GetDrawingMeterSig()) {
current_layer->GetDrawingMeterSig()->SetBoundingBoxXShift( params );
}
return FUNCTOR_CONTINUE;
}
LayerElement *current = dynamic_cast<LayerElement*>(this);
if ( !current ) {
return FUNCTOR_CONTINUE;
}
// we should have processed aligned before
assert( current->GetAlignment() );
if ( !current->HasUpdatedBB() ) {
// if nothing was drawn, do not take it into account
return FUNCTOR_CONTINUE;
}
if ( current->IsBeam() ) {
return FUNCTOR_CONTINUE;
}
if ( current->IsNote() ) {
Chord* chordParent = dynamic_cast<Chord*>(current->GetFirstParent( &typeid( Chord ), MAX_CHORD_DEPTH));
if( chordParent ) {
return FUNCTOR_CONTINUE;
}
}
if ( current->IsTie() ) {
return FUNCTOR_CONTINUE;
}
if ( current->IsTuplet() ) {
return FUNCTOR_CONTINUE;
}
if ( current->IsVerse() || current->IsSyl() ) {
return FUNCTOR_CONTINUE;
}
// the negative offset it the part of the bounding box that overflows on the left
// |____x_____|
// ---- = negative offset
//int negative_offset = current->GetAlignment()->GetXRel() - current->m_contentBB_x1;
int negative_offset = - (current->m_contentBB_x1) + (doc->GetLeftMargin(&typeid(*current)) * doc->m_drawingUnit[0] / PARAM_DENOMINATOR);
// this should never happen (but can with glyphs not exactly registered at position x=0 in the SMuFL font used
if ( negative_offset < 0 ) {
//LogDebug("%s negative offset %d;", current->GetClassName().c_str(), negative_offset );
negative_offset = 0;
}
if ( current->IsMRest() ) {
// With MRest, the only thing we want to do it keep their with as possible measure with (if only MRest in all staves/layers)
int width = current->m_contentBB_x2 + doc->GetRightMargin(&typeid(*current)) * doc->m_drawingUnit[0] / PARAM_DENOMINATOR + negative_offset ;
// Keep it if more than the current measure width
(*measure_width) = std::max( (*measure_width), width );
(*min_pos) = 0;
return FUNCTOR_CONTINUE;
}
// check if the element overlaps with the preceeding one given by (*min_pos)
//.........这里部分代码省略.........