Repair some more merge conflicts.

This commit is contained in:
Jeff Young 2020-08-16 21:29:41 +01:00
parent 0debaa5866
commit 1134d99bb7
3 changed files with 56 additions and 21 deletions

View File

@ -33,7 +33,7 @@
#include <widgets/bitmap_toggle.h>
#include <widgets/color_swatch.h>
#include <widgets/indicator_icon.h>
#include <dialog_helpers.h>
/// Template for object appearance settings
const APPEARANCE_CONTROLS::APPEARANCE_SETTING APPEARANCE_CONTROLS::s_objectSettings[] = {
@ -1433,11 +1433,12 @@ void APPEARANCE_CONTROLS::rebuildLayerPresetsWidget()
{
m_cbLayerPresets->Clear();
for( auto& pair : m_layerPresets )
for( std::pair<const wxString, LAYER_PRESET>& pair : m_layerPresets )
m_cbLayerPresets->Append( pair.first, static_cast<void*>( &pair.second ) );
m_cbLayerPresets->Append( wxT( "-----" ) );
m_cbLayerPresets->Append( _( "Save new preset" ) );
m_cbLayerPresets->Append( _( "Save new preset..." ) );
m_cbLayerPresets->Append( _( "Delete preset..." ) );
m_cbLayerPresets->SetSelection( 0 );
@ -1456,7 +1457,7 @@ void APPEARANCE_CONTROLS::syncLayerPresetSelection()
GAL_SET visibleObjects = board->GetVisibleElements();
auto it = std::find_if( m_layerPresets.begin(), m_layerPresets.end(),
[&]( const auto& aPair )
[&]( const std::pair<const wxString, LAYER_PRESET>& aPair )
{
return ( aPair.second.layers == visibleLayers
&& aPair.second.renderLayers == visibleObjects );
@ -1465,7 +1466,7 @@ void APPEARANCE_CONTROLS::syncLayerPresetSelection()
if( it != m_layerPresets.end() )
m_cbLayerPresets->SetStringSelection( it->first );
else
m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 2 ); // separator
m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 3 ); // separator
m_currentPreset = static_cast<LAYER_PRESET*>(
m_cbLayerPresets->GetClientData( m_cbLayerPresets->GetSelection() ) );
@ -1486,7 +1487,7 @@ void APPEARANCE_CONTROLS::updateLayerPresetSelection( const wxString& aName )
}
else if( idx < 0 )
{
m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 2 ); // separator
m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 3 ); // separator
updateDeleteLayerPresetButton();
}
}
@ -1505,16 +1506,16 @@ void APPEARANCE_CONTROLS::onLayerPresetChanged( wxCommandEvent& aEvent )
if( m_currentPreset )
m_cbLayerPresets->SetStringSelection( m_currentPreset->name );
else
m_cbLayerPresets->SetSelection( count - 2 );
m_cbLayerPresets->SetSelection( count - 3 );
};
if( index == count - 2 )
if( index == count - 3 )
{
// Separator: reject the selection
resetSelection();
return;
}
else if( index == count - 1 )
else if( index == count - 2 )
{
// Save current state to new preset
wxTextEntryDialog dlg( this, _( "New layer preset name:" ), _( "Save Layer Preset" ) );
@ -1546,6 +1547,40 @@ void APPEARANCE_CONTROLS::onLayerPresetChanged( wxCommandEvent& aEvent )
return;
}
else if( index == count - 1 )
{
// Delete a preset
wxArrayString headers;
std::vector<wxArrayString> items;
headers.Add( _( "Presets" ) );
for( std::pair<const wxString, LAYER_PRESET>& pair : m_layerPresets )
{
if( !pair.second.readOnly )
{
wxArrayString item;
item.Add( pair.first );
items.emplace_back( item );
}
}
EDA_LIST_DIALOG dlg( m_frame, _( "Delete Preset" ), headers, items, wxEmptyString );
dlg.SetListLabel( _( "Select netclass:" ) );
if( dlg.ShowModal() == wxID_OK )
{
wxString presetName = dlg.GetTextSelection();
m_layerPresets.erase( presetName );
m_cbLayerPresets->Delete( m_cbLayerPresets->FindString( presetName ) );
m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 3 );
m_currentPreset = nullptr;
}
return;
}
LAYER_PRESET* preset = static_cast<LAYER_PRESET*>( m_cbLayerPresets->GetClientData( index ) );
m_currentPreset = preset;
@ -1602,7 +1637,7 @@ void APPEARANCE_CONTROLS::OnBtnDeleteLayerPreset( wxCommandEvent& event )
m_layerPresets.erase( current->name );
m_cbLayerPresets->Delete( index );
m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 2 );
m_cbLayerPresets->SetSelection( m_cbLayerPresets->GetCount() - 3 );
m_currentPreset = nullptr;
}

View File

@ -205,7 +205,7 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bSizer191;
bSizer191 = new wxBoxSizer( wxHORIZONTAL );
m_rbNetColorAll = new wxRadioButton( m_paneNetDisplay->GetPane(), wxID_ANY, wxT("All"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbNetColorAll = new wxRadioButton( m_paneNetDisplay->GetPane(), wxID_ANY, wxT("All"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_rbNetColorAll->SetToolTip( wxT("Net and netclass colors are shown on all copper items") );
bSizer191->Add( m_rbNetColorAll, 1, wxRIGHT|wxLEFT, 5 );
@ -216,7 +216,7 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
bSizer191->Add( m_rbNetColorRatsnest, 1, wxLEFT, 5 );
m_rbNetColorOff = new wxRadioButton( m_paneNetDisplay->GetPane(), wxID_ANY, wxT("None"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_rbNetColorOff = new wxRadioButton( m_paneNetDisplay->GetPane(), wxID_ANY, wxT("None"), wxDefaultPosition, wxDefaultSize, 0 );
m_rbNetColorOff->SetToolTip( wxT("Net and netclass colors are not shown") );
bSizer191->Add( m_rbNetColorOff, 1, wxLEFT, 5 );
@ -247,13 +247,13 @@ APPEARANCE_CONTROLS_BASE::APPEARANCE_CONTROLS_BASE( wxWindow* parent, wxWindowID
m_cbLayerPresets->SetSelection( 1 );
m_cbLayerPresets->SetToolTip( wxT("Layer presets") );
presetsSizer->Add( m_cbLayerPresets, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
presetsSizer->Add( m_cbLayerPresets, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_btnDeletePreset = new wxBitmapButton( presetsSizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_btnDeletePreset->Enable( false );
m_btnDeletePreset->SetToolTip( wxT("Delete this layer preset") );
presetsSizer->Add( m_btnDeletePreset, 0, wxALIGN_CENTER_VERTICAL, 5 );
presetsSizer->Add( m_btnDeletePreset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_sizerOuter->Add( presetsSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );

View File

@ -1614,7 +1614,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCollapsiblePaneChanged">OnNetDisplayPaneChanged</event>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer1211</property>
<property name="orient">wxVERTICAL</property>
@ -1680,11 +1680,11 @@
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer191</property>
<property name="orient">wxHORIZONTAL</property>
@ -1739,7 +1739,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxRB_GROUP</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Net and netclass colors are shown on all copper items</property>
@ -1867,7 +1867,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRB_GROUP</property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Net and netclass colors are not shown</property>
@ -1905,7 +1905,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">1</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
@ -1970,7 +1970,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property>