diff --git a/common/dialogs/dialog_color_picker.cpp b/common/dialogs/dialog_color_picker.cpp
index 0df2c5829f..439d8dc772 100644
--- a/common/dialogs/dialog_color_picker.cpp
+++ b/common/dialogs/dialog_color_picker.cpp
@@ -64,9 +64,15 @@ DIALOG_COLOR_PICKER::DIALOG_COLOR_PICKER( wxWindow* aParent, KIGFX::COLOR4D& aCu
// Build the defined colors panel:
initDefinedColors( aUserColors );
- // If there is no default color, don't give the option to reset to default
+ /**
+ * There are two types of color settings: theme colors and local overrides.
+ * Theme colors have a default value, and the Reset to Default button reverts to it.
+ * Local override colors have a default of UNSPECIFIED, which means "use the theme color".
+ * The underlying action is the same, but we change the label here because the action from
+ * the point of view of the user is slightly different.
+ */
if( aDefaultColor == KIGFX::COLOR4D::UNSPECIFIED )
- m_resetToDefault->Hide();
+ m_resetToDefault->SetLabel( _( "Clear Color" ) );
m_sdbSizerOK->SetDefault();
}
@@ -851,5 +857,9 @@ void DIALOG_COLOR_PICKER::OnResetButton( wxCommandEvent& aEvent )
m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
SetEditVals( ALL_CHANGED, false );
- drawAll();
+ // When the default is UNSPECIFIED, this is the Clear Color button, which should accept
+ if( m_defaultColor == KIGFX::COLOR4D::UNSPECIFIED )
+ AcceptAndClose();
+ else
+ drawAll();
}
diff --git a/common/widgets/color_swatch.cpp b/common/widgets/color_swatch.cpp
index 4e5c7b481b..26192790c1 100644
--- a/common/widgets/color_swatch.cpp
+++ b/common/widgets/color_swatch.cpp
@@ -56,6 +56,12 @@ wxBitmap COLOR_SWATCH::MakeBitmap( COLOR4D aColor, COLOR4D aBackground, wxSize a
iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, aSize.x, aSize.y );
+ if( aColor == COLOR4D::UNSPECIFIED )
+ {
+ aColor = aBackground.Inverted();
+ brush.SetStyle( wxBRUSHSTYLE_BDIAGONAL_HATCH );
+ }
+
brush.SetColour( aColor.ToColour() );
iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, aSize.x, aSize.y );
@@ -210,7 +216,7 @@ void COLOR_SWATCH::GetNewSwatchColor()
if( dialog.ShowModal() == wxID_OK )
newColor = dialog.GetColor();
- if( newColor != COLOR4D::UNSPECIFIED )
+ if( newColor != COLOR4D::UNSPECIFIED || m_default == COLOR4D::UNSPECIFIED )
{
m_color = newColor;
diff --git a/eeschema/dialogs/dialog_edit_line_style.cpp b/eeschema/dialogs/dialog_edit_line_style.cpp
index 232963765f..fc5713aea8 100644
--- a/eeschema/dialogs/dialog_edit_line_style.cpp
+++ b/eeschema/dialogs/dialog_edit_line_style.cpp
@@ -133,7 +133,7 @@ void DIALOG_EDIT_LINE_STYLE::onColorButtonClicked( wxCommandEvent& event )
if( dialog.ShowModal() == wxID_OK )
newColor = dialog.GetColor();
- if( newColor == COLOR4D::UNSPECIFIED || m_selectedColor == newColor )
+ if( m_selectedColor == newColor )
return;
setColor( newColor );
diff --git a/eeschema/dialogs/dialog_sch_sheet_props.cpp b/eeschema/dialogs/dialog_sch_sheet_props.cpp
index f043f4dea5..d49fae0bd0 100644
--- a/eeschema/dialogs/dialog_sch_sheet_props.cpp
+++ b/eeschema/dialogs/dialog_sch_sheet_props.cpp
@@ -151,15 +151,11 @@ bool DIALOG_SCH_SHEET_PROPS::TransferDataToWindow()
m_borderWidth.SetValue( m_sheet->GetBorderWidth() );
// set up color swatches
- COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
- KIGFX::COLOR4D borderColor = m_sheet->GetBorderColor();
- KIGFX::COLOR4D backgroundColor = m_sheet->GetBackgroundColor();
+ KIGFX::COLOR4D borderColor = m_sheet->GetBorderColor();
+ KIGFX::COLOR4D backgroundColor = m_sheet->GetBackgroundColor();
- if( borderColor == COLOR4D::UNSPECIFIED )
- borderColor = colorSettings->GetColor( LAYER_SHEET );
-
- if( backgroundColor == COLOR4D::UNSPECIFIED )
- backgroundColor = colorSettings->GetColor( LAYER_SHEET_BACKGROUND );
+ m_borderSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
+ m_backgroundSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_borderSwatch->SetSwatchColor( borderColor, false );
m_backgroundSwatch->SetSwatchColor( backgroundColor, false );
@@ -789,15 +785,3 @@ void DIALOG_SCH_SHEET_PROPS::OnInitDlg( wxInitDialogEvent& event )
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
-
-
-void DIALOG_SCH_SHEET_PROPS::OnRemoveColors( wxCommandEvent& event )
-{
- COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
-
- m_borderSwatch->SetDefaultColor( colorSettings->GetColor( LAYER_SHEET ) );
- m_backgroundSwatch->SetDefaultColor( colorSettings->GetColor( LAYER_SHEET_BACKGROUND ) );
-
- m_borderSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
- m_backgroundSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
-}
diff --git a/eeschema/dialogs/dialog_sch_sheet_props.h b/eeschema/dialogs/dialog_sch_sheet_props.h
index e5931ae909..5686f7046f 100644
--- a/eeschema/dialogs/dialog_sch_sheet_props.h
+++ b/eeschema/dialogs/dialog_sch_sheet_props.h
@@ -71,7 +71,6 @@ private:
void OnGridCellChanging( wxGridEvent& event );
void OnUpdateUI( wxUpdateUIEvent& event ) override;
void OnInitDlg( wxInitDialogEvent& event ) override;
- void OnRemoveColors( wxCommandEvent& event ) override;
void AdjustGridColumns( int aWidth );
};
diff --git a/eeschema/dialogs/dialog_sch_sheet_props_base.cpp b/eeschema/dialogs/dialog_sch_sheet_props_base.cpp
index 36ebd2c691..950c027727 100644
--- a/eeschema/dialogs/dialog_sch_sheet_props_base.cpp
+++ b/eeschema/dialogs/dialog_sch_sheet_props_base.cpp
@@ -151,14 +151,6 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
sbSizer2->Add( m_backgroundSwatch, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
- sbSizer2->Add( 0, 0, 1, wxEXPAND, 5 );
-
- m_btnResetColors = new wxButton( sbSizer2->GetStaticBox(), wxID_ANY, _("Remove Colors"), wxDefaultPosition, wxDefaultSize, 0 );
- m_btnResetColors->SetToolTip( _("Remove the specified colors for this sheet (the current color theme will be used instead)") );
-
- sbSizer2->Add( m_btnResetColors, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
-
-
bSizer5->Add( sbSizer2, 1, wxEXPAND|wxBOTTOM, 5 );
@@ -226,7 +218,6 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
m_bpMoveUp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveDown ), NULL, this );
m_bpDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnDeleteField ), NULL, this );
- m_btnResetColors->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnRemoveColors ), NULL, this );
}
DIALOG_SCH_SHEET_PROPS_BASE::~DIALOG_SCH_SHEET_PROPS_BASE()
@@ -239,6 +230,5 @@ DIALOG_SCH_SHEET_PROPS_BASE::~DIALOG_SCH_SHEET_PROPS_BASE()
m_bpMoveUp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveUp ), NULL, this );
m_bpMoveDown->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnMoveDown ), NULL, this );
m_bpDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnDeleteField ), NULL, this );
- m_btnResetColors->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_SHEET_PROPS_BASE::OnRemoveColors ), NULL, this );
}
diff --git a/eeschema/dialogs/dialog_sch_sheet_props_base.fbp b/eeschema/dialogs/dialog_sch_sheet_props_base.fbp
index ee9bf87658..1ca0c8ce9a 100644
--- a/eeschema/dialogs/dialog_sch_sheet_props_base.fbp
+++ b/eeschema/dialogs/dialog_sch_sheet_props_base.fbp
@@ -968,89 +968,6 @@
-
-
- 5
- wxALIGN_CENTER_VERTICAL|wxALL
- 0
-
- 1
- 1
- 1
- 1
-
-
-
-
-
-
-
-
- 1
- 0
- 1
-
- 1
-
- 0
- 0
-
- Dock
- 0
- Left
- 1
-
- 1
-
-
- 0
- 0
- wxID_ANY
- Remove Colors
-
- 0
-
- 0
-
-
- 0
-
- 1
- m_btnResetColors
- 1
-
-
- protected
- 1
-
-
-
- Resizable
- 1
-
-
- ; ; forward_declare
- 0
- Remove the specified colors for this sheet (the current color theme will be used instead)
-
- wxFILTER_NONE
- wxDefaultValidator
-
-
-
-
- OnRemoveColors
-
-
diff --git a/eeschema/dialogs/dialog_sch_sheet_props_base.h b/eeschema/dialogs/dialog_sch_sheet_props_base.h
index 41356067e6..39e995e434 100644
--- a/eeschema/dialogs/dialog_sch_sheet_props_base.h
+++ b/eeschema/dialogs/dialog_sch_sheet_props_base.h
@@ -56,7 +56,6 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
COLOR_SWATCH* m_borderSwatch;
wxStaticText* m_backgroundColorLabel;
COLOR_SWATCH* m_backgroundSwatch;
- wxButton* m_btnResetColors;
wxStaticText* m_hiearchicalPathLabel;
wxTextCtrl* m_heirarchyPath;
wxStaticText* m_timestampLabel;
@@ -74,7 +73,6 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
virtual void OnMoveUp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnMoveDown( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteField( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnRemoveColors( wxCommandEvent& event ) { event.Skip(); }
public:
diff --git a/eeschema/dialogs/panel_eeschema_color_settings.cpp b/eeschema/dialogs/panel_eeschema_color_settings.cpp
index a5cbd6b1c1..15d89bd5b1 100644
--- a/eeschema/dialogs/panel_eeschema_color_settings.cpp
+++ b/eeschema/dialogs/panel_eeschema_color_settings.cpp
@@ -412,6 +412,9 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::ResetPanel()
void PANEL_EESCHEMA_COLOR_SETTINGS::updatePreview()
{
+ if( !m_preview )
+ return;
+
KIGFX::VIEW* view = m_preview->GetView();
auto settings = static_cast( view->GetPainter()->GetSettings() );
settings->LoadColors( m_currentSettings );