diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/dialogs/dialog_color_config.cpp
index 833747d000..c59b067ebd 100644
--- a/eeschema/dialogs/dialog_color_config.cpp
+++ b/eeschema/dialogs/dialog_color_config.cpp
@@ -65,7 +65,7 @@ static COLORBUTTON generalColorButtons[] = {
{ _( "Global label" ), LAYER_GLOBLABEL },
{ _( "Net name" ), LAYER_NETNAM },
{ _( "Notes" ), LAYER_NOTES },
- { _( "No Connect Symbol" ), LAYER_NOCONNECT },
+ { _( "No connect symbol" ), LAYER_NOCONNECT },
{ wxT( "" ), -1 } // Sentinel marking end of list.
};
@@ -91,8 +91,8 @@ static COLORBUTTON sheetColorButtons[] = {
};
static COLORBUTTON miscColorButtons[] = {
- { _( "Erc warning" ), LAYER_ERC_WARN },
- { _( "Erc error" ), LAYER_ERC_ERR },
+ { _( "ERC warning" ), LAYER_ERC_WARN },
+ { _( "ERC error" ), LAYER_ERC_ERR },
{ _( "Grid" ), LAYER_GRID },
{ wxT( "" ), -1 } // Sentinel marking end of list.
};
@@ -204,8 +204,6 @@ void DIALOG_COLOR_CONFIG::CreateControls()
currentColors[ LAYER_BACKGROUND ] = m_parent->GetDrawBgColor();
-// button->SetFocus();
-
// Dialog now needs to be resized, but the associated command is found elsewhere.
}
@@ -248,56 +246,51 @@ void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event )
}
-bool DIALOG_COLOR_CONFIG::UpdateColorsSettings()
+bool DIALOG_COLOR_CONFIG::TransferDataFromWindow()
{
- // Update color of background
+ bool warning = false;
+
+ // Check for color conflicts with background color to give user a chance to bail
+ // out before making changes.
+
EDA_COLOR_T bgcolor = WHITE;
if( m_SelBgColor->GetSelection() > 0 )
bgcolor = BLACK;
- m_parent->SetDrawBgColor( bgcolor );
- currentColors[ LAYER_BACKGROUND ] = bgcolor;
-
- bool warning = false;
-
for( LAYERSCH_ID clyr = LAYER_WIRE; clyr < LAYERSCH_ID_COUNT; ++clyr )
{
- SetLayerColor( currentColors[ clyr ], clyr );
-
- if( bgcolor == GetLayerColor( clyr ) && clyr != LAYER_BACKGROUND )
+ if( bgcolor == currentColors[ clyr ] && clyr != LAYER_BACKGROUND )
+ {
warning = true;
+ break;
+ }
}
- m_parent->SetGridColor( GetLayerColor( LAYER_GRID ) );
-
- if( bgcolor == GetLayerColor( LAYER_GRID ) )
- warning = true;
-
- return warning;
-}
-
-
-void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& event )
-{
- bool warning = UpdateColorsSettings();
-
// Prompt the user if an item has the same color as the background
// because this item cannot be seen:
if( warning )
- wxMessageBox( _("Warning:\nSome items have the same color as the background\n"
- "and they will not be seen on screen") );
+ {
+ if( wxMessageBox( _( "Some items have the same color as the background\n"
+ "and they will not be seen on the screen. Are you\n"
+ "sure you want to use these colors?" ),
+ _( "Warning" ),
+ wxYES_NO | wxICON_QUESTION, this ) == wxNO )
+ return false;
+ }
+ // Update color of background
+ m_parent->SetDrawBgColor( bgcolor );
+ currentColors[ LAYER_BACKGROUND ] = bgcolor;
+
+
+ for( LAYERSCH_ID clyr = LAYER_WIRE; clyr < LAYERSCH_ID_COUNT; ++clyr )
+ {
+ SetLayerColor( currentColors[ clyr ], clyr );
+ }
+
+ m_parent->SetGridColor( GetLayerColor( LAYER_GRID ) );
m_parent->GetCanvas()->Refresh();
- event.Skip();
-}
-
-
-
-
-void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& event )
-{
- UpdateColorsSettings();
- m_parent->GetCanvas()->Refresh();
+ return true;
}
diff --git a/eeschema/dialogs/dialog_color_config.h b/eeschema/dialogs/dialog_color_config.h
index 60c296e4b7..0f07367971 100644
--- a/eeschema/dialogs/dialog_color_config.h
+++ b/eeschema/dialogs/dialog_color_config.h
@@ -46,14 +46,13 @@ private:
// Creates the controls and sizers
void CreateControls();
- bool UpdateColorsSettings();
void SetColor( wxCommandEvent& aEvent );
- void OnOkClick( wxCommandEvent& aEvent );
- void OnApplyClick( wxCommandEvent& aEvent );
public:
// Constructors and destructor
DIALOG_COLOR_CONFIG( EDA_DRAW_FRAME* aParent );
+
+ bool TransferDataFromWindow();
};
#endif // DIALOG_COLOR_CONFIG_H_
diff --git a/eeschema/dialogs/dialog_color_config_base.cpp b/eeschema/dialogs/dialog_color_config_base.cpp
index df41683750..8991523b7c 100644
--- a/eeschema/dialogs/dialog_color_config_base.cpp
+++ b/eeschema/dialogs/dialog_color_config_base.cpp
@@ -38,18 +38,11 @@ DIALOG_COLOR_CONFIG_BASE::DIALOG_COLOR_CONFIG_BASE( wxWindow* parent, wxWindowID
this->SetSizer( bmainSizer );
this->Layout();
+ bmainSizer->Fit( this );
this->Centre( wxBOTH );
-
- // Connect Events
- m_sdbSizerApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COLOR_CONFIG_BASE::OnApplyClick ), NULL, this );
- m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COLOR_CONFIG_BASE::OnOkClick ), NULL, this );
}
DIALOG_COLOR_CONFIG_BASE::~DIALOG_COLOR_CONFIG_BASE()
{
- // Disconnect Events
- m_sdbSizerApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COLOR_CONFIG_BASE::OnApplyClick ), NULL, this );
- m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COLOR_CONFIG_BASE::OnOkClick ), NULL, this );
-
}
diff --git a/eeschema/dialogs/dialog_color_config_base.fbp b/eeschema/dialogs/dialog_color_config_base.fbp
index e54c0a3dba..d739b5795e 100644
--- a/eeschema/dialogs/dialog_color_config_base.fbp
+++ b/eeschema/dialogs/dialog_color_config_base.fbp
@@ -44,7 +44,7 @@
DIALOG_COLOR_CONFIG_BASE
- 446,344
+ -1,-1
wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
DIALOG_SHIM; dialog_shim.h
EESchema Colors
@@ -201,12 +201,12 @@
m_sdbSizer
protected
- OnApplyClick
+
- OnOkClick
+
diff --git a/eeschema/dialogs/dialog_color_config_base.h b/eeschema/dialogs/dialog_color_config_base.h
index dcb5d3c85f..83697b118c 100644
--- a/eeschema/dialogs/dialog_color_config_base.h
+++ b/eeschema/dialogs/dialog_color_config_base.h
@@ -41,15 +41,10 @@ class DIALOG_COLOR_CONFIG_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerApply;
wxButton* m_sdbSizerCancel;
-
- // Virtual event handlers, overide them in your derived class
- virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); }
- virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
-
public:
- DIALOG_COLOR_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EESchema Colors"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 446,344 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
+ DIALOG_COLOR_CONFIG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EESchema Colors"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_COLOR_CONFIG_BASE();
};