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

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
......@@ -948,31 +948,28 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
{
int choiceCount = unitChoice->GetCount();
// Remove non existing choices (choiceCount must be <= number for parts)
int unitcount = m_part ? m_part->GetUnitCount() : 1;
if( unitcount < 1 )
unitcount = 1;
if( unitcount < choiceCount )
if( unitcount > 26 )
unitcount = 26;
unitChoice->Clear();
for( int ii=0; ii < unitcount; ii++ )
{
while( unitcount < choiceCount )
{
choiceCount--;
unitChoice->Delete( choiceCount );
}
unitChoice->Append( wxString::Format( "%c", "?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] ) );
}
// For components with multiple parts per package, set the unit selection
choiceCount = unitChoice->GetCount();
if( m_Cmp->GetUnit() <= choiceCount )
if( m_Cmp->GetUnit() <= unitChoice->GetCount() )
unitChoice->SetSelection( m_Cmp->GetUnit() - 1 );
// Disable unit selection if only one unit exists:
if( choiceCount <= 1 )
if( m_Cmp->GetUnit() <= 1 )
{
unitChoice->Enable( false );
unitsInterchageableLabel->Show( false );
......@@ -982,13 +979,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
{
// Show the "Units are not interchangeable" message option?
if( !m_part || !m_part->UnitsLocked() )
unitsInterchageableLabel->SetLabel( _("Yes") );
unitsInterchageableLabel->SetLabel( _( "Yes" ) );
else
unitsInterchageableLabel->SetLabel( _("No") );
unitsInterchageableLabel->SetLabel( _( "No" ) );
}
int orientation = m_Cmp->GetOrientation()
& ~( CMP_MIRROR_X | CMP_MIRROR_Y );
int orientation = m_Cmp->GetOrientation() & ~( CMP_MIRROR_X | CMP_MIRROR_Y );
if( orientation == CMP_ORIENT_90 )
orientationRadioBox->SetSelection( 1 );
......@@ -1026,7 +1022,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
chipnameTextCtrl->SetValue( m_Cmp->m_part_name );
// Set the component's unique ID time stamp.
m_textCtrlTimeStamp->SetValue( wxString::Format( wxT("%8.8lX"),
m_textCtrlTimeStamp->SetValue( wxString::Format( wxT( "%8.8lX" ),
(unsigned long) m_Cmp->GetTimeStamp() ) );
}
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// 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 );
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") };
int unitChoiceNChoices = sizeof( unitChoiceChoices ) / sizeof( wxString );
unitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, unitChoiceNChoices, unitChoiceChoices, 0 );
wxArrayString unitChoiceChoices;
unitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, unitChoiceChoices, 0 );
unitChoice->SetSelection( 0 );
optionsSizer->Add( unitChoice, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
......@@ -215,7 +215,7 @@
<property name="caption"></property>
<property name="caption_visible">1</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="context_help"></property>
<property name="context_menu">1</property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......
......@@ -447,8 +447,7 @@ void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_L
{
wxString num_unit;
int unit = Component->GetUnit();
num_unit.Printf( _( "Unit %d %c" ), ii + 1,
"?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] );
num_unit.Printf( _( "Unit %c" ), "?ABCDEFGHIJKLMNOPQRSTUVWXYZ"[ ii + 1 ] );
wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
num_unit, wxEmptyString,
wxITEM_CHECK );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment