Commit 3f66000b authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

Improve component unit naming consistency. (fixes lp:1369153)

* Remove redundant number from unit context menu.
* Use letters instead of numbers in component edit dialog.
parent 05073c15
Loading
Loading
Loading
Loading
+13 −17
Original line number Original line Diff line number Diff line
@@ -948,31 +948,28 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()


void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
{
{
    int choiceCount = unitChoice->GetCount();

    // Remove non existing choices (choiceCount must be <= number for parts)
    // Remove non existing choices (choiceCount must be <= number for parts)
    int unitcount = m_part ? m_part->GetUnitCount() : 1;
    int unitcount = m_part ? m_part->GetUnitCount() : 1;


    if( unitcount < 1 )
    if( unitcount < 1 )
        unitcount = 1;
        unitcount = 1;


    if( unitcount < choiceCount )
    if( unitcount > 26 )
    {
        unitcount = 26;
        while( unitcount < choiceCount )

    unitChoice->Clear();

    for( int ii=0;  ii < unitcount;  ii++ )
    {
    {
            choiceCount--;
        unitChoice->Append( wxString::Format( "%c", "?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] ) );
            unitChoice->Delete( choiceCount );
        }
    }
    }


    // For components with multiple parts per package, set the unit selection
    // For components with multiple parts per package, set the unit selection
    choiceCount = unitChoice->GetCount();
    if( m_Cmp->GetUnit() <= unitChoice->GetCount() )

    if( m_Cmp->GetUnit() <= choiceCount )
        unitChoice->SetSelection( m_Cmp->GetUnit() - 1 );
        unitChoice->SetSelection( m_Cmp->GetUnit() - 1 );


    // Disable unit selection if only one unit exists:
    // Disable unit selection if only one unit exists:
    if( choiceCount <= 1 )
    if( m_Cmp->GetUnit() <= 1 )
    {
    {
        unitChoice->Enable( false );
        unitChoice->Enable( false );
        unitsInterchageableLabel->Show( false );
        unitsInterchageableLabel->Show( false );
@@ -987,8 +984,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
            unitsInterchageableLabel->SetLabel( _( "No" ) );
            unitsInterchageableLabel->SetLabel( _( "No" ) );
    }
    }


    int orientation = m_Cmp->GetOrientation()
    int orientation = m_Cmp->GetOrientation() & ~( CMP_MIRROR_X | CMP_MIRROR_Y );
        & ~( CMP_MIRROR_X | CMP_MIRROR_Y );


    if( orientation == CMP_ORIENT_90 )
    if( orientation == CMP_ORIENT_90 )
        orientationRadioBox->SetSelection( 1 );
        orientationRadioBox->SetSelection( 1 );
+3 −4
Original line number Original line Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov  6 2013)
// C++ code generated with wxFormBuilder (version Jun  5 2014)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -26,9 +26,8 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
	m_staticTextUnit->Wrap( -1 );
	m_staticTextUnit->Wrap( -1 );
	optionsSizer->Add( m_staticTextUnit, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	optionsSizer->Add( m_staticTextUnit, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
	
	
	wxString unitChoiceChoices[] = { _("1"), _("2"), _("3"), _("4"), _("5"), _("6"), _("7"), _("8"), _("9"), _("10"), _("11"), _("12"), _("13"), _("14"), _("15"), _("16"), _("17"), _("18"), _("19"), _("20"), _("21"), _("22"), _("23"), _("24"), _("25"), _("26") };
	wxArrayString unitChoiceChoices;
	int unitChoiceNChoices = sizeof( unitChoiceChoices ) / sizeof( wxString );
	unitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, unitChoiceChoices, 0 );
	unitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, unitChoiceNChoices, unitChoiceChoices, 0 );
	unitChoice->SetSelection( 0 );
	unitChoice->SetSelection( 0 );
	optionsSizer->Add( unitChoice, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	optionsSizer->Add( unitChoice, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
	
	
+2 −2
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<wxFormBuilder_Project>
    <FileVersion major="1" minor="11" />
    <FileVersion major="1" minor="13" />
    <object class="Project" expanded="1">
    <object class="Project" expanded="1">
        <property name="class_decoration">; </property>
        <property name="class_decoration">; </property>
        <property name="code_generation">C++</property>
        <property name="code_generation">C++</property>
@@ -215,7 +215,7 @@
                                        <property name="caption"></property>
                                        <property name="caption"></property>
                                        <property name="caption_visible">1</property>
                                        <property name="caption_visible">1</property>
                                        <property name="center_pane">0</property>
                                        <property name="center_pane">0</property>
                                        <property name="choices">&quot;1&quot; &quot;2&quot; &quot;3&quot; &quot;4&quot; &quot;5&quot; &quot;6&quot; &quot;7&quot; &quot;8&quot; &quot;9&quot; &quot;10&quot; &quot;11&quot; &quot;12&quot; &quot;13&quot; &quot;14&quot; &quot;15&quot; &quot;16&quot; &quot;17&quot; &quot;18&quot; &quot;19&quot; &quot;20&quot; &quot;21&quot; &quot;22&quot; &quot;23&quot; &quot;24&quot; &quot;25&quot; &quot;26&quot;</property>
                                        <property name="choices"></property>
                                        <property name="close_button">1</property>
                                        <property name="close_button">1</property>
                                        <property name="context_help"></property>
                                        <property name="context_help"></property>
                                        <property name="context_menu">1</property>
                                        <property name="context_menu">1</property>
+1 −1
Original line number Original line Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov  6 2013)
// C++ code generated with wxFormBuilder (version Jun  5 2014)
// http://www.wxformbuilder.org/
// http://www.wxformbuilder.org/
//
//
// PLEASE DO "NOT" EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
+1 −2
Original line number Original line Diff line number Diff line
@@ -447,8 +447,7 @@ void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_L
        {
        {
            wxString num_unit;
            wxString num_unit;
            int unit = Component->GetUnit();
            int unit = Component->GetUnit();
            num_unit.Printf( _( "Unit %d %c" ), ii + 1,
            num_unit.Printf( _( "Unit %c" ), "?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] );
                             "?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] );
            wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
            wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
                                                       num_unit, wxEmptyString,
                                                       num_unit, wxEmptyString,
                                                       wxITEM_CHECK );
                                                       wxITEM_CHECK );