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


C++ Doc::GetLeftMargin方法代码示例

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


在下文中一共展示了Doc::GetLeftMargin方法的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)
//.........这里部分代码省略.........
开发者ID:jamespark04,项目名称:verovio,代码行数:101,代码来源:object.cpp


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