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


C++ DIMENSION::GetUnits方法代码示例

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


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

示例1: OnDimensionUnitsChange

void DIALOG_TEXT_PROPERTIES::OnDimensionUnitsChange( wxCommandEvent& event )
{
    DIMENSION* dimension = (DIMENSION*) m_item;
    EDA_UNITS_T units;
    bool useMils;

    // Get default units in case dimension text doesn't contain units.
    dimension->GetUnits( units, useMils );

    double value = ValueFromString( units, m_DimensionText->GetValue(), useMils );

    switch( event.GetSelection() )
    {
    case 0: units = INCHES;      useMils = false; break;
    case 1: units = INCHES;      useMils = true;  break;
    case 2: units = MILLIMETRES; useMils = false; break;
    default: break;
    }

    m_DimensionText->SetValue( StringFromValue( units, value, true, useMils ) );
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:21,代码来源:dialog_text_properties.cpp

示例2: TransferDataToWindow

bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
{
    if( m_SingleLineText->IsShown() )
    {
        m_SingleLineText->SetValue( m_edaText->GetText() );

        if( m_modText && m_modText->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
            SelectReferenceNumber( static_cast<wxTextEntry*>( m_SingleLineText ) );
        else
            m_SingleLineText->SetSelection( -1, -1 );
    }
    else if( m_MultiLineText->IsShown() )
    {
        m_MultiLineText->SetValue( m_edaText->GetText() );
        m_MultiLineText->SetSelection( -1, -1 );
    }
    else if (m_DimensionText->IsShown() )
    {
        m_DimensionText->SetValue( m_edaText->GetText() );
        m_DimensionText->SetSelection( -1, -1 );

        DIMENSION* dimension = (DIMENSION*) m_item;
        EDA_UNITS_T units;
        bool useMils;
        dimension->GetUnits( units, useMils );

        m_DimensionUnitsOpt->SetSelection( units == MILLIMETRES ? 2 : useMils ? 1 : 0 );
    }

    if( m_item->Type() == PCB_MODULE_TEXT_T && m_modText )
    {
        MODULE*  module = dynamic_cast<MODULE*>( m_modText->GetParent() );
        wxString msg;

        if( module )
        {
            msg.Printf( _("Footprint %s (%s), %s, rotated %.1f deg"),
                        module->GetReference(),
                        module->GetValue(),
                        module->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" ),
                        module->GetOrientation() / 10.0 );
        }

        m_statusLine->SetLabel( msg );
    }
    else
    {
        m_statusLine->Show( false );
    }

    if( m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ) < 0 )
    {
        wxMessageBox( _( "This item was on a non-existing or forbidden layer.\n"
                         "It has been moved to the first allowed layer." ) );
        m_LayerSelectionCtrl->SetSelection( 0 );
    }

    m_textWidth.SetValue( m_edaText->GetTextSize().x );
    m_textHeight.SetValue( m_edaText->GetTextSize().y );
    m_thickness.SetValue( m_edaText->GetThickness() );
    m_posX.SetValue( m_edaText->GetTextPos().x );
    m_posY.SetValue( m_edaText->GetTextPos().y );

    m_Visible->SetValue( m_edaText->IsVisible() );
    m_Italic->SetValue( m_edaText->IsItalic() );
    EDA_TEXT_HJUSTIFY_T hJustify = m_edaText->GetHorizJustify();
    m_JustifyChoice->SetSelection( (int) hJustify + 1 );
    m_OrientValue = m_edaText->GetTextAngleDegrees();
    m_Mirrored->SetValue( m_edaText->IsMirrored() );

    if( m_modText )
        m_KeepUpright->SetValue( m_modText->IsKeepUpright() );

    return DIALOG_TEXT_PROPERTIES_BASE::TransferDataToWindow();
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:75,代码来源:dialog_text_properties.cpp


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