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


C++ PCB_EDIT_FRAME::Refresh方法代码示例

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


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

示例1: OnOKClick

void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
{
    LAYER_ID newlayer = ToLAYER_ID( m_SelLayerBox->GetLayerSelection() );

    if( !m_Parent->GetBoard()->IsLayerEnabled( newlayer ) )
    {
        wxMessageBox( _( "The layer currently selected is not enabled for this board\n"
                         "You cannot use it" ) );
        return;
    }

#ifndef USE_WX_OVERLAY
    if( m_DC )     // Delete old text.
    {
        CurrentDimension->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR );
    }
#endif

    m_Parent->SaveCopyInUndoList(CurrentDimension, UR_CHANGED);

    if( m_Name->GetValue() != wxEmptyString )
    {
        CurrentDimension->SetText( m_Name->GetValue() );
    }

    wxString msg;

    // Get new size value:
    msg = m_TxtSizeXCtrl->GetValue();
    CurrentDimension->Text().SetWidth( ValueFromString( g_UserUnit, msg ) );
    msg = m_TxtSizeYCtrl->GetValue();
    CurrentDimension->Text().SetHeight( ValueFromString( g_UserUnit, msg ) );

    // Get new position value:
    // It will be copied later in dimension, because
    msg = m_textCtrlPosX->GetValue();
    wxPoint pos;
    pos.x = ValueFromString( g_UserUnit, msg );
    msg = m_textCtrlPosY->GetValue();
    pos.y = ValueFromString( g_UserUnit, msg );
    CurrentDimension->Text().SetTextPosition( pos );

    // Get new line thickness value:
    msg = m_TxtWidthCtrl->GetValue();
    int width = ValueFromString( g_UserUnit, msg );
    int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->Text().GetSize() );

    if( width > maxthickness )
    {
        DisplayError( NULL,
                      _( "The text thickness is too large for the text size.  "
                         "It will be clamped" ) );
        width = maxthickness;
    }

    CurrentDimension->SetWidth( width );
    CurrentDimension->Text().SetThickness( width );
    CurrentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false );
    CurrentDimension->SetLayer( newlayer );

#ifndef USE_WX_OVERLAY
    if( m_DC )     // Display new text
    {
        CurrentDimension->Draw( m_Parent->GetCanvas(), m_DC, GR_OR );
    }
#else
    m_Parent->Refresh();
#endif

    m_Parent->OnModify();
    EndModal( 1 );
}
开发者ID:OpenEE,项目名称:micad,代码行数:72,代码来源:dimension.cpp

示例2: OnOKClick

void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
{
    BOARD_COMMIT commit( m_parent );

    PCB_LAYER_ID newlayer = ToLAYER_ID( m_SelLayerBox->GetLayerSelection() );

    if( !m_parent->GetBoard()->IsLayerEnabled( newlayer ) )
    {
        wxMessageBox( _( "The layer currently selected is not enabled for this board\n"
                         "You cannot use it" ) );
        return;
    }

#ifndef USE_WX_OVERLAY
    if( m_DC )     // Delete old text.
    {
        m_currentDimension->Draw( m_parent->GetCanvas(), m_DC, GR_XOR );
    }
#endif

    commit.Modify( m_currentDimension );

    if( m_Name->GetValue() != wxEmptyString )
    {
        m_currentDimension->SetText( m_Name->GetValue() );
    }

    wxString msg;

    // Get new size value:
    msg = m_TxtSizeXCtrl->GetValue();
    m_currentDimension->Text().SetTextWidth( ValueFromString( g_UserUnit, msg ) );
    msg = m_TxtSizeYCtrl->GetValue();
    m_currentDimension->Text().SetTextHeight( ValueFromString( g_UserUnit, msg ) );

    // Get new position value:
    // It will be copied later in dimension, because
    msg = m_textCtrlPosX->GetValue();
    wxPoint pos;
    pos.x = ValueFromString( g_UserUnit, msg );
    msg = m_textCtrlPosY->GetValue();
    pos.y = ValueFromString( g_UserUnit, msg );
    m_currentDimension->Text().SetTextPos( pos );

    // Get new line thickness value:
    msg = m_TxtWidthCtrl->GetValue();
    int width = ValueFromString( g_UserUnit, msg );
    int maxthickness = Clamp_Text_PenSize( width, m_currentDimension->Text().GetTextSize() );

    if( width > maxthickness )
    {
        DisplayError( NULL,
                      _( "The text thickness is too large for the text size.  "
                         "It will be clamped" ) );
        width = maxthickness;
    }

    m_currentDimension->SetWidth( width );
    m_currentDimension->Text().SetThickness( width );
    m_currentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false );
    m_currentDimension->SetLayer( newlayer );

#ifndef USE_WX_OVERLAY
    if( m_DC )     // Display new text
    {
        m_currentDimension->Draw( m_parent->GetCanvas(), m_DC, GR_OR );
    }
#else
    m_parent->Refresh();
#endif

    commit.Push( _( "Modifed dimensions properties" ) );
    event.Skip();   // ends returning wxID_OK (default behavior)
}
开发者ID:cpavlina,项目名称:kicad,代码行数:74,代码来源:dimension.cpp


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