|
|
@ -50,6 +50,10 @@ const std::map<PLOT_DASH_TYPE, struct lineTypeStruct> lineTypeNames = { |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_STYLE _( "Default" )
|
|
|
|
#define INDETERMINATE_STYLE _( "Leave unchanged" )
|
|
|
|
|
|
|
|
|
|
|
|
DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE( SCH_EDIT_FRAME* aParent, |
|
|
|
std::deque<SCH_ITEM*>& strokeItems ) : |
|
|
|
DIALOG_EDIT_LINE_STYLE_BASE( aParent ), |
|
|
@ -66,7 +70,7 @@ DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE( SCH_EDIT_FRAME* aParent, |
|
|
|
for( auto& typeEntry : lineTypeNames ) |
|
|
|
m_typeCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) ); |
|
|
|
|
|
|
|
m_typeCombo->Append( INDETERMINATE_ACTION ); |
|
|
|
m_typeCombo->Append( DEFAULT_STYLE ); |
|
|
|
|
|
|
|
m_sdbSizerOK->SetDefault(); |
|
|
|
|
|
|
@ -112,13 +116,18 @@ bool DIALOG_EDIT_LINE_STYLE::TransferDataToWindow() |
|
|
|
} ) ) |
|
|
|
{ |
|
|
|
int style = static_cast<int>( first_stroke_item->GetStroke().GetType() ); |
|
|
|
wxCHECK_MSG( style < (int)lineTypeNames.size(), false, |
|
|
|
"Line type for first line is not found in the type lookup map" ); |
|
|
|
m_typeCombo->SetSelection( style ); |
|
|
|
|
|
|
|
if( style == -1 ) |
|
|
|
m_typeCombo->SetStringSelection( DEFAULT_STYLE ); |
|
|
|
else if( style < (int) lineTypeNames.size() ) |
|
|
|
m_typeCombo->SetSelection( style ); |
|
|
|
else |
|
|
|
wxFAIL_MSG( "Line type not found in the type lookup map" ); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
m_typeCombo->SetStringSelection( INDETERMINATE_ACTION ); |
|
|
|
m_typeCombo->Append( INDETERMINATE_STYLE ); |
|
|
|
m_typeCombo->SetStringSelection( INDETERMINATE_STYLE ); |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
@ -130,9 +139,7 @@ void DIALOG_EDIT_LINE_STYLE::resetDefaults( wxCommandEvent& event ) |
|
|
|
m_width.SetValue( 0 ); |
|
|
|
m_colorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false ); |
|
|
|
|
|
|
|
// This isn't quite right: they really want to set each stroke to the stroke set by the
|
|
|
|
// netclass (if any).
|
|
|
|
m_typeCombo->SetSelection( 0 ); |
|
|
|
m_typeCombo->SetStringSelection( DEFAULT_STYLE ); |
|
|
|
|
|
|
|
Refresh(); |
|
|
|
} |
|
|
@ -148,32 +155,24 @@ bool DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow() |
|
|
|
|
|
|
|
m_frame->SaveCopyInUndoList( pickedItems, UNDO_REDO::CHANGED, false ); |
|
|
|
|
|
|
|
for( auto& strokeItem : m_strokeItems ) |
|
|
|
for( SCH_ITEM* strokeItem : m_strokeItems ) |
|
|
|
{ |
|
|
|
stroke = strokeItem->GetStroke(); |
|
|
|
|
|
|
|
if( !m_width.IsIndeterminate() ) |
|
|
|
{ |
|
|
|
stroke = strokeItem->GetStroke(); |
|
|
|
stroke.SetWidth( m_width.GetValue() ); |
|
|
|
strokeItem->SetStroke( stroke ); |
|
|
|
} |
|
|
|
|
|
|
|
int selection = m_typeCombo->GetSelection(); |
|
|
|
|
|
|
|
if( selection < (int)lineTypeNames.size() ) |
|
|
|
{ |
|
|
|
stroke = strokeItem->GetStroke(); |
|
|
|
|
|
|
|
auto it = lineTypeNames.begin(); |
|
|
|
std::advance( it, selection ); |
|
|
|
auto it = lineTypeNames.begin(); |
|
|
|
std::advance( it, m_typeCombo->GetSelection() ); |
|
|
|
|
|
|
|
if( it == lineTypeNames.end() ) |
|
|
|
stroke.SetType( PLOT_DASH_TYPE::DEFAULT ); |
|
|
|
else |
|
|
|
stroke.SetType( it->first ); |
|
|
|
strokeItem->SetStroke( stroke ); |
|
|
|
} |
|
|
|
|
|
|
|
stroke = strokeItem->GetStroke(); |
|
|
|
stroke.SetColor( m_colorSwatch->GetSwatchColor() ); |
|
|
|
strokeItem->SetStroke( stroke ); |
|
|
|
|
|
|
|
strokeItem->SetStroke( stroke ); |
|
|
|
m_frame->UpdateItem( strokeItem ); |
|
|
|
} |
|
|
|
|
|
|
|