コード例 #1
0
bool DIALOG_GLOBAL_MODULES_FIELDS_EDITION::TransferDataFromWindow()
{
    m_refSelection = m_ReferenceOpt->GetValue();
    m_valueSelection = m_ValueOpt->GetValue();
    m_othersSelection = m_OtherFields->GetValue();
    m_filterString = m_ModuleFilter->GetValue();

    m_brdSettings->m_ModuleTextSize.x = ValueFromTextCtrl( *m_SizeX_Value );
    m_brdSettings->m_ModuleTextSize.y = ValueFromTextCtrl( *m_SizeY_Value );
    m_brdSettings->m_ModuleTextWidth = ValueFromTextCtrl( *m_ThicknessValue );

    // clip m_ModuleTextWidth to the 1/4 of min size, to keep it always readable
    int max_thickness = std::min( m_brdSettings->m_ModuleTextSize.x,
                            m_brdSettings->m_ModuleTextSize.y ) / 4;
    if( m_brdSettings->m_ModuleTextWidth > max_thickness )
        m_brdSettings->m_ModuleTextWidth = max_thickness;

    m_parent->ResetModuleTextSizes( m_filterString, m_refSelection,
                                    m_valueSelection, m_othersSelection );
    return true;
}
void DIALOG_GLOBAL_MODULES_FIELDS_EDITION::OnOKClick( wxCommandEvent& event )
{
    m_refSelection = m_ReferenceOpt->GetValue();
    m_valueSelection = m_ValueOpt->GetValue();
    m_othersSelection = m_OtherFields->GetValue();
    m_filterString = m_ModuleFilter->GetValue();

    m_brdSettings->m_ModuleTextSize.x = ValueFromTextCtrl( *m_SizeX_Value );
    m_brdSettings->m_ModuleTextSize.y = ValueFromTextCtrl( *m_SizeY_Value );
    m_brdSettings->m_ModuleTextWidth = ValueFromTextCtrl( *m_TicknessValue );

    // clip m_ModuleTextWidth to the 1/4 of min size, to keep it always readable
    int minsize = std::min( m_brdSettings->m_ModuleTextSize.x,
                            m_brdSettings->m_ModuleTextSize.y ) / 4;
    if( m_brdSettings->m_ModuleTextWidth > minsize )
        m_brdSettings->m_ModuleTextWidth = minsize;

    m_parent->ResetModuleTextSizes( m_filterString, m_refSelection,
                                    m_valueSelection, m_othersSelection );
    EndModal( wxID_OK );
}