diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt
index c8d9a46813..fd13769f4a 100644
--- a/eeschema/CMakeLists.txt
+++ b/eeschema/CMakeLists.txt
@@ -25,8 +25,6 @@ set( EESCHEMA_DLGS
dialogs/dialog_bom.cpp
dialogs/dialog_bom_base.cpp
dialogs/dialog_bom_cfg_keywords.cpp
- dialogs/dialog_color_config.cpp
- dialogs/dialog_color_config_base.cpp
dialogs/dialog_choose_component.cpp
dialogs/dialog_choose_component_base.cpp
dialogs/dialog_lib_edit_text.cpp
@@ -72,6 +70,11 @@ set( EESCHEMA_DLGS
dialogs/dialog_schematic_find_base.cpp
)
+set( EESCHEMA_WIDGETS
+ widgets/widget_eeschema_color_config.cpp
+ )
+
+
set( EESCHEMA_SRCS
autoplace_fields.cpp
annotate.cpp
@@ -90,6 +93,7 @@ set( EESCHEMA_SRCS
controle.cpp
cross-probing.cpp
${EESCHEMA_DLGS}
+ ${EESCHEMA_WIDGETS}
edit_component_in_schematic.cpp
edit_bitmap.cpp
edit_label.cpp
diff --git a/eeschema/dialogs/dialog_color_config_base.cpp b/eeschema/dialogs/dialog_color_config_base.cpp
deleted file mode 100644
index 8991523b7c..0000000000
--- a/eeschema/dialogs/dialog_color_config_base.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Jun 5 2014)
-// http://www.wxformbuilder.org/
-//
-// PLEASE DO "NOT" EDIT THIS FILE!
-///////////////////////////////////////////////////////////////////////////
-
-#include "dialog_color_config_base.h"
-
-///////////////////////////////////////////////////////////////////////////
-
-DIALOG_COLOR_CONFIG_BASE::DIALOG_COLOR_CONFIG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
-{
- this->SetSizeHints( wxDefaultSize, wxDefaultSize );
-
- wxBoxSizer* bmainSizer;
- bmainSizer = new wxBoxSizer( wxVERTICAL );
-
- m_mainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
-
-
- bmainSizer->Add( m_mainBoxSizer, 1, wxEXPAND, 5 );
-
- m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
- bmainSizer->Add( m_staticline, 0, wxEXPAND | wxALL, 5 );
-
- m_sdbSizer = new wxStdDialogButtonSizer();
- m_sdbSizerOK = new wxButton( this, wxID_OK );
- m_sdbSizer->AddButton( m_sdbSizerOK );
- m_sdbSizerApply = new wxButton( this, wxID_APPLY );
- m_sdbSizer->AddButton( m_sdbSizerApply );
- m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
- m_sdbSizer->AddButton( m_sdbSizerCancel );
- m_sdbSizer->Realize();
-
- bmainSizer->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
-
-
- this->SetSizer( bmainSizer );
- this->Layout();
- bmainSizer->Fit( this );
-
- this->Centre( wxBOTH );
-}
-
-DIALOG_COLOR_CONFIG_BASE::~DIALOG_COLOR_CONFIG_BASE()
-{
-}
diff --git a/eeschema/dialogs/dialog_color_config_base.fbp b/eeschema/dialogs/dialog_color_config_base.fbp
deleted file mode 100644
index d739b5795e..0000000000
--- a/eeschema/dialogs/dialog_color_config_base.fbp
+++ /dev/null
@@ -1,217 +0,0 @@
-
-
-
-
-
diff --git a/eeschema/dialogs/dialog_color_config_base.h b/eeschema/dialogs/dialog_color_config_base.h
deleted file mode 100644
index 83697b118c..0000000000
--- a/eeschema/dialogs/dialog_color_config_base.h
+++ /dev/null
@@ -1,52 +0,0 @@
-///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Jun 5 2014)
-// http://www.wxformbuilder.org/
-//
-// PLEASE DO "NOT" EDIT THIS FILE!
-///////////////////////////////////////////////////////////////////////////
-
-#ifndef __DIALOG_COLOR_CONFIG_BASE_H__
-#define __DIALOG_COLOR_CONFIG_BASE_H__
-
-#include
-#include
-#include
-class DIALOG_SHIM;
-
-#include "dialog_shim.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-///////////////////////////////////////////////////////////////////////////
-
-
-///////////////////////////////////////////////////////////////////////////////
-/// Class DIALOG_COLOR_CONFIG_BASE
-///////////////////////////////////////////////////////////////////////////////
-class DIALOG_COLOR_CONFIG_BASE : public DIALOG_SHIM
-{
- private:
-
- protected:
- wxBoxSizer* m_mainBoxSizer;
- wxStaticLine* m_staticline;
- wxStdDialogButtonSizer* m_sdbSizer;
- wxButton* m_sdbSizerOK;
- wxButton* m_sdbSizerApply;
- wxButton* m_sdbSizerCancel;
-
- public:
-
- 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();
-
-};
-
-#endif //__DIALOG_COLOR_CONFIG_BASE_H__
diff --git a/eeschema/dialogs/dialog_eeschema_options.cpp b/eeschema/dialogs/dialog_eeschema_options.cpp
index 5ce1477ebb..4c32b14b5a 100644
--- a/eeschema/dialogs/dialog_eeschema_options.cpp
+++ b/eeschema/dialogs/dialog_eeschema_options.cpp
@@ -31,6 +31,7 @@
#include
#include
+#include "../widgets/widget_eeschema_color_config.h"
#include
#include
@@ -59,6 +60,10 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( SCH_EDIT_FRAME* parent ) :
m_hotkeyListCtrl = new WIDGET_HOTKEY_LIST( m_panelHotkeys, sections );
m_hotkeyListCtrl->InstallOnPanel( m_panelHotkeys );
+ // Embed the color configurator
+ m_colorConfigCtrl = new WIDGET_EESCHEMA_COLOR_CONFIG( m_panelColors, GetParent() );
+ m_colorConfigCtrl->InstallOnPanel( m_panelColors );
+
// Make sure we select the first tab of the options tab page
m_notebook->SetSelection( 0 );
@@ -288,6 +293,9 @@ bool DIALOG_EESCHEMA_OPTIONS::TransferDataFromWindow()
if( !m_hotkeyListCtrl->TransferDataFromControl() )
return false;
+ if( !m_colorConfigCtrl->TransferDataFromControl() )
+ return false;
+
// Refresh hotkeys
GetParent()->ReCreateMenuBar();
GetParent()->Refresh();
diff --git a/eeschema/dialogs/dialog_eeschema_options.h b/eeschema/dialogs/dialog_eeschema_options.h
index d5daca2f80..8f18d05ef9 100644
--- a/eeschema/dialogs/dialog_eeschema_options.h
+++ b/eeschema/dialogs/dialog_eeschema_options.h
@@ -34,13 +34,15 @@
#include
#include
+class WIDGET_EESCHEMA_COLOR_CONFIG;
class WIDGET_HOTKEY_LIST;
class SCH_EDIT_FRAME;
class DIALOG_EESCHEMA_OPTIONS : public DIALOG_EESCHEMA_OPTIONS_BASE
{
protected:
- WIDGET_HOTKEY_LIST* m_hotkeyListCtrl;
+ WIDGET_HOTKEY_LIST* m_hotkeyListCtrl;
+ WIDGET_EESCHEMA_COLOR_CONFIG* m_colorConfigCtrl;
/** @brief The template fieldnames for this dialog */
TEMPLATE_FIELDNAMES templateFields;
diff --git a/eeschema/dialogs/dialog_eeschema_options_base.cpp b/eeschema/dialogs/dialog_eeschema_options_base.cpp
index 9c85f9ddb6..31f17cdd70 100644
--- a/eeschema/dialogs/dialog_eeschema_options_base.cpp
+++ b/eeschema/dialogs/dialog_eeschema_options_base.cpp
@@ -117,7 +117,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_panel5->SetSizer( bSizer82 );
m_panel5->Layout();
bSizer82->Fit( m_panel5 );
- m_notebook->AddPage( m_panel5, _("Display"), true );
+ m_notebook->AddPage( m_panel5, _("Display"), false );
m_panel3 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxVERTICAL );
@@ -233,7 +233,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_panel3->Layout();
bSizer8->Fit( m_panel3 );
m_notebook->AddPage( m_panel3, _("Editing"), false );
- m_controlsPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+ m_tabControls = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer81;
bSizer81 = new wxBoxSizer( wxVERTICAL );
@@ -253,46 +253,58 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
wxBoxSizer* bSizer13;
bSizer13 = new wxBoxSizer( wxHORIZONTAL );
- m_staticText20 = new wxStaticText( m_controlsPanel, wxID_ANY, _("Hotkeys:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText20 = new wxStaticText( m_tabControls, wxID_ANY, _("Hotkeys:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText20->Wrap( -1 );
bSizer13->Add( m_staticText20, 1, wxALL, 5 );
- m_staticText21 = new wxStaticText( m_controlsPanel, wxID_ANY, _("Double-click to edit"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText21 = new wxStaticText( m_tabControls, wxID_ANY, _("Double-click to edit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText21->Wrap( -1 );
bSizer13->Add( m_staticText21, 0, wxALL, 5 );
m_controlsSizer->Add( bSizer13, 0, wxEXPAND, 5 );
- m_panelHotkeys = new wxPanel( m_controlsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+ m_panelHotkeys = new wxPanel( m_tabControls, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_controlsSizer->Add( m_panelHotkeys, 1, wxEXPAND | wxALL, 5 );
- m_checkEnableZoomCenter = new wxCheckBox( m_controlsPanel, wxID_ANY, _("Cen&ter and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_checkEnableZoomCenter = new wxCheckBox( m_tabControls, wxID_ANY, _("Cen&ter and warp cursor on zoom"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkEnableZoomCenter->SetToolTip( _("Keep the cursor at its current location when zooming") );
m_controlsSizer->Add( m_checkEnableZoomCenter, 0, wxTOP|wxRIGHT|wxLEFT, 3 );
- m_checkEnableMiddleButtonPan = new wxCheckBox( m_controlsPanel, xwID_ANY, _("&Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_checkEnableMiddleButtonPan = new wxCheckBox( m_tabControls, xwID_ANY, _("&Use middle mouse button to pan"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkEnableMiddleButtonPan->SetToolTip( _("Use middle mouse button dragging to pan") );
m_controlsSizer->Add( m_checkEnableMiddleButtonPan, 0, wxTOP|wxRIGHT|wxLEFT, 3 );
- m_checkMiddleButtonPanLimited = new wxCheckBox( m_controlsPanel, wxID_ANY, _("&Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_checkMiddleButtonPanLimited = new wxCheckBox( m_tabControls, wxID_ANY, _("&Limit panning to scroll size"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkMiddleButtonPanLimited->SetToolTip( _("Middle mouse button panning limited by current scrollbar size") );
m_controlsSizer->Add( m_checkMiddleButtonPanLimited, 0, wxTOP|wxRIGHT|wxLEFT, 3 );
- m_checkAutoPan = new wxCheckBox( m_controlsPanel, wxID_ANY, _("&Pan while moving object"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_checkAutoPan = new wxCheckBox( m_tabControls, wxID_ANY, _("&Pan while moving object"), wxDefaultPosition, wxDefaultSize, 0 );
m_controlsSizer->Add( m_checkAutoPan, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 3 );
bSizer81->Add( m_controlsSizer, 1, wxALL|wxEXPAND, 5 );
- m_controlsPanel->SetSizer( bSizer81 );
- m_controlsPanel->Layout();
- bSizer81->Fit( m_controlsPanel );
- m_notebook->AddPage( m_controlsPanel, _("Controls"), false );
+ m_tabControls->SetSizer( bSizer81 );
+ m_tabControls->Layout();
+ bSizer81->Fit( m_tabControls );
+ m_notebook->AddPage( m_tabControls, _("Controls"), false );
+ m_tabColors = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+ wxBoxSizer* bSizer14;
+ bSizer14 = new wxBoxSizer( wxVERTICAL );
+
+ m_panelColors = new wxPanel( m_tabColors, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
+ bSizer14->Add( m_panelColors, 1, wxEXPAND | wxALL, 5 );
+
+
+ m_tabColors->SetSizer( bSizer14 );
+ m_tabColors->Layout();
+ bSizer14->Fit( m_tabColors );
+ m_notebook->AddPage( m_tabColors, _("Colors"), true );
m_panel2 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_panel2->SetToolTip( _("User defined field names for schematic components. ") );
diff --git a/eeschema/dialogs/dialog_eeschema_options_base.fbp b/eeschema/dialogs/dialog_eeschema_options_base.fbp
index 668ac9f496..9e4a0e650e 100644
--- a/eeschema/dialogs/dialog_eeschema_options_base.fbp
+++ b/eeschema/dialogs/dialog_eeschema_options_base.fbp
@@ -187,7 +187,7 @@
Display
- 1
+ 0
1
1
@@ -3806,7 +3806,7 @@
0
1
- m_controlsPanel
+ m_tabControls
1
@@ -3845,7 +3845,7 @@
-
+
bSizer81
wxVERTICAL
@@ -3868,20 +3868,20 @@
0
-
+
5
wxALL|wxEXPAND
1
-
+
m_controlsSizer
wxVERTICAL
protected
-
+
5
wxEXPAND
0
-
+
bSizer13
wxHORIZONTAL
@@ -4054,11 +4054,11 @@
-
+
5
wxEXPAND | wxALL
1
-
+
1
1
1
@@ -4491,6 +4491,172 @@
+
+
+ Colors
+ 1
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+
+ 0
+
+
+ 0
+
+ 1
+ m_tabColors
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+ 0
+
+
+
+ wxTAB_TRAVERSAL
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ bSizer14
+ wxVERTICAL
+ none
+
+ 5
+ wxEXPAND | wxALL
+ 1
+
+ 1
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+ 1
+ 0
+ 1
+
+ 1
+ 0
+ Dock
+ 0
+ Left
+ 1
+
+ 1
+
+ 0
+ 0
+ wxID_ANY
+
+ 0
+
+
+ 0
+
+ 1
+ m_panelColors
+ 1
+
+
+ protected
+ 1
+
+ Resizable
+ 1
+
+
+ 0
+
+
+
+ wxTAB_TRAVERSAL
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Default Fields
diff --git a/eeschema/dialogs/dialog_eeschema_options_base.h b/eeschema/dialogs/dialog_eeschema_options_base.h
index 5b20e1c9f4..eca809b1ac 100644
--- a/eeschema/dialogs/dialog_eeschema_options_base.h
+++ b/eeschema/dialogs/dialog_eeschema_options_base.h
@@ -103,7 +103,7 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_checkAutoplaceFields;
wxCheckBox* m_checkAutoplaceJustify;
wxCheckBox* m_checkAutoplaceAlign;
- wxPanel* m_controlsPanel;
+ wxPanel* m_tabControls;
wxBoxSizer* m_controlsSizer;
wxStaticText* m_staticText20;
wxStaticText* m_staticText21;
@@ -112,6 +112,8 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_checkEnableMiddleButtonPan;
wxCheckBox* m_checkMiddleButtonPanLimited;
wxCheckBox* m_checkAutoPan;
+ wxPanel* m_tabColors;
+ wxPanel* m_panelColors;
wxPanel* m_panel2;
wxGrid* m_fieldGrid;
wxButton* addFieldButton;
diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp
index cfc062ac4c..1c7703929b 100644
--- a/eeschema/eeschema.cpp
+++ b/eeschema/eeschema.cpp
@@ -42,7 +42,6 @@
#include
#include
#include
-#include
#include
#include
diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp
index 804045e45c..f2028eaa54 100644
--- a/eeschema/eeschema_config.cpp
+++ b/eeschema/eeschema_config.cpp
@@ -47,7 +47,6 @@
#include
-#include
#include
#include
#include
@@ -157,14 +156,6 @@ void LIB_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
}
-void LIB_EDIT_FRAME::OnColorConfig( wxCommandEvent& aEvent )
-{
- DIALOG_COLOR_CONFIG dlg( this );
-
- dlg.ShowModal();
-}
-
-
void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
{
int id = event.GetId();
@@ -195,14 +186,6 @@ void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
}
-void SCH_EDIT_FRAME::OnColorConfig( wxCommandEvent& aEvent )
-{
- DIALOG_COLOR_CONFIG dlg( this );
-
- dlg.ShowModal();
-}
-
-
void SCH_EDIT_FRAME::InstallConfigFrame( wxCommandEvent& event )
{
// Identical to LIB_EDIT_FRAME::InstallConfigFrame()
diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp
index bd489a0a3a..6663cf6f7d 100644
--- a/eeschema/libeditframe.cpp
+++ b/eeschema/libeditframe.cpp
@@ -130,10 +130,8 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
- EVT_MENU( ID_COLORS_SETUP, LIB_EDIT_FRAME::OnColorConfig )
EVT_MENU( wxID_PREFERENCES, LIB_EDIT_FRAME::OnPreferencesOptions )
EVT_MENU( ID_CONFIG_REQ, LIB_EDIT_FRAME::InstallConfigFrame )
- EVT_MENU( ID_COLORS_SETUP, LIB_EDIT_FRAME::Process_Config )
// Multiple item selection context menu commands.
EVT_MENU_RANGE( ID_SELECT_ITEM_START, ID_SELECT_ITEM_END, LIB_EDIT_FRAME::OnSelectItem )
diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h
index 6ae14cecf4..7b9cad055e 100644
--- a/eeschema/libeditframe.h
+++ b/eeschema/libeditframe.h
@@ -193,7 +193,6 @@ public:
static void EnsureActiveLibExists();
void InstallConfigFrame( wxCommandEvent& event );
- void OnColorConfig( wxCommandEvent& aEvent );
void OnPreferencesOptions( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp
index 2e8047dada..5ce4edf6a6 100644
--- a/eeschema/menubar.cpp
+++ b/eeschema/menubar.cpp
@@ -375,13 +375,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Configure component libraries and paths" ),
KiBitmap( library_xpm ) );
- // Colors
- AddMenuItem( preferencesMenu,
- ID_COLORS_SETUP,
- _( "Set &Colors Scheme" ),
- _( "Set color preferences" ),
- KiBitmap( palette_xpm ) );
-
// Options (Preferences on WXMAC)
#ifdef __WXMAC__
diff --git a/eeschema/menubar_libedit.cpp b/eeschema/menubar_libedit.cpp
index f2c9599107..ed3abe68f7 100644
--- a/eeschema/menubar_libedit.cpp
+++ b/eeschema/menubar_libedit.cpp
@@ -238,13 +238,6 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
_( "Set Component Editor default values and options" ),
KiBitmap( preference_xpm ) );
- // Colors
- AddMenuItem( preferencesMenu,
- ID_COLORS_SETUP,
- _( "Set &Colors Scheme" ),
- _( "Set color preferences" ),
- KiBitmap( palette_xpm ) );
-
// Language submenu
Pgm().AddMenuLanguageList( preferencesMenu );
diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp
index a9c7a07e55..ea6d2f21b8 100644
--- a/eeschema/schframe.cpp
+++ b/eeschema/schframe.cpp
@@ -237,7 +237,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
SCH_EDIT_FRAME::Process_Config )
- EVT_MENU( ID_COLORS_SETUP, SCH_EDIT_FRAME::OnColorConfig )
EVT_TOOL( wxID_PREFERENCES, SCH_EDIT_FRAME::OnPreferencesOptions )
EVT_TOOL( ID_RUN_LIBRARY, SCH_EDIT_FRAME::OnOpenLibraryEditor )
diff --git a/eeschema/schframe.h b/eeschema/schframe.h
index f7309bc171..45b820f8d0 100644
--- a/eeschema/schframe.h
+++ b/eeschema/schframe.h
@@ -266,7 +266,6 @@ public:
void SetPlotDirectoryName( const wxString& aDirName ) { m_plotDirectoryName = aDirName; }
void Process_Special_Functions( wxCommandEvent& event );
- void OnColorConfig( wxCommandEvent& aEvent );
void Process_Config( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/widgets/widget_eeschema_color_config.cpp
similarity index 88%
rename from eeschema/dialogs/dialog_color_config.cpp
rename to eeschema/widgets/widget_eeschema_color_config.cpp
index c59b067ebd..f23c2e9dcf 100644
--- a/eeschema/dialogs/dialog_color_config.cpp
+++ b/eeschema/widgets/widget_eeschema_color_config.cpp
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
- * Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
+ * Copyright (C) 2016 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -31,10 +31,7 @@
#include
-#include
-
-
-#define ID_COLOR_SETUP 1800
+#include "widget_eeschema_color_config.h"
// Specify the width and height of every (color-displaying / bitmap) button
const int BUTT_SIZE_X = 16;
@@ -110,21 +107,21 @@ static BUTTONINDEX buttonGroups[] = {
static EDA_COLOR_T currentColors[ LAYERSCH_ID_COUNT ];
-DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG( EDA_DRAW_FRAME* aParent ) :
- DIALOG_COLOR_CONFIG_BASE( aParent )
+WIDGET_EESCHEMA_COLOR_CONFIG::WIDGET_EESCHEMA_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ) :
+ wxPanel( aParent ), m_drawFrame( aDrawFrame )
{
- m_parent = aParent;
CreateControls();
-
- GetSizer()->SetSizeHints( this );
}
-void DIALOG_COLOR_CONFIG::CreateControls()
+void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls()
{
wxStaticText* label;
int buttonId = 1800;
+ m_mainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
+ SetSizer( m_mainBoxSizer );
+
BUTTONINDEX* groups = buttonGroups;
wxBoxSizer* columnBoxSizer = NULL;
@@ -185,7 +182,7 @@ void DIALOG_COLOR_CONFIG::CreateControls()
}
Connect( 1800, buttonId - 1, wxEVT_COMMAND_BUTTON_CLICKED,
- wxCommandEventHandler( DIALOG_COLOR_CONFIG::SetColor ) );
+ wxCommandEventHandler( WIDGET_EESCHEMA_COLOR_CONFIG::SetColor ) );
wxArrayString selBgColorStrings;
selBgColorStrings.Add( _( "White" ) );
@@ -193,7 +190,7 @@ void DIALOG_COLOR_CONFIG::CreateControls()
m_SelBgColor = new wxRadioBox( this, wxID_ANY, _( "Background Color" ),
wxDefaultPosition, wxDefaultSize,
selBgColorStrings, 1, wxRA_SPECIFY_COLS );
- m_SelBgColor->SetSelection( ( m_parent->GetDrawBgColor() == BLACK ) ? 1 : 0 );
+ m_SelBgColor->SetSelection( ( GetDrawFrame()->GetDrawBgColor() == BLACK ) ? 1 : 0 );
if( columnBoxSizer )
{
@@ -202,13 +199,13 @@ void DIALOG_COLOR_CONFIG::CreateControls()
columnBoxSizer->Add( m_SelBgColor, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 5 );
}
- currentColors[ LAYER_BACKGROUND ] = m_parent->GetDrawBgColor();
+ currentColors[ LAYER_BACKGROUND ] = GetDrawFrame()->GetDrawBgColor();
// Dialog now needs to be resized, but the associated command is found elsewhere.
}
-void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event )
+void WIDGET_EESCHEMA_COLOR_CONFIG::SetColor( wxCommandEvent& event )
{
wxBitmapButton* button = (wxBitmapButton*) event.GetEventObject();
@@ -246,7 +243,7 @@ void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event )
}
-bool DIALOG_COLOR_CONFIG::TransferDataFromWindow()
+bool WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl()
{
bool warning = false;
@@ -280,7 +277,7 @@ bool DIALOG_COLOR_CONFIG::TransferDataFromWindow()
}
// Update color of background
- m_parent->SetDrawBgColor( bgcolor );
+ GetDrawFrame()->SetDrawBgColor( bgcolor );
currentColors[ LAYER_BACKGROUND ] = bgcolor;
@@ -289,8 +286,17 @@ bool DIALOG_COLOR_CONFIG::TransferDataFromWindow()
SetLayerColor( currentColors[ clyr ], clyr );
}
- m_parent->SetGridColor( GetLayerColor( LAYER_GRID ) );
- m_parent->GetCanvas()->Refresh();
+ GetDrawFrame()->SetGridColor( GetLayerColor( LAYER_GRID ) );
+ GetDrawFrame()->GetCanvas()->Refresh();
return true;
}
+
+
+void WIDGET_EESCHEMA_COLOR_CONFIG::InstallOnPanel( wxPanel* aPanel )
+{
+ wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
+
+ sizer->Add( this, 1, wxALL | wxEXPAND, 0 );
+ aPanel->SetSizer( sizer );
+}
diff --git a/eeschema/dialogs/dialog_color_config.h b/eeschema/widgets/widget_eeschema_color_config.h
similarity index 63%
rename from eeschema/dialogs/dialog_color_config.h
rename to eeschema/widgets/widget_eeschema_color_config.h
index 0f07367971..1f99a31193 100644
--- a/eeschema/dialogs/dialog_color_config.h
+++ b/eeschema/widgets/widget_eeschema_color_config.h
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 G. Harland
- * Copyright (C) 1992-2015 KiCad Developers, see CHANGELOG.TXT for contributors.
+ * Copyright (C) 1992-2016 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -22,11 +22,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#ifndef DIALOG_COLOR_CONFIG_H_
-#define DIALOG_COLOR_CONFIG_H_
-
-#include
+#ifndef WIDGET_EESCHEMA_COLOR_CONFIG_H_
+#define WIDGET_EESCHEMA_COLOR_CONFIG_H_
+#include
+#include
class wxBoxSizer;
class wxStaticLine;
@@ -37,22 +37,33 @@ class wxStdDialogButtonSizer;
/* Derived class for the frame color settings. */
/***********************************************/
-class DIALOG_COLOR_CONFIG : public DIALOG_COLOR_CONFIG_BASE
+class WIDGET_EESCHEMA_COLOR_CONFIG : public wxPanel
{
private:
- EDA_DRAW_FRAME* m_parent;
+ EDA_DRAW_FRAME* m_drawFrame;
wxRadioBox* m_SelBgColor;
+ wxBoxSizer* m_mainBoxSizer;
// Creates the controls and sizers
void CreateControls();
void SetColor( wxCommandEvent& aEvent );
+ virtual EDA_DRAW_FRAME* GetDrawFrame() { return m_drawFrame; }
+
public:
// Constructors and destructor
- DIALOG_COLOR_CONFIG( EDA_DRAW_FRAME* aParent );
+ WIDGET_EESCHEMA_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame );
- bool TransferDataFromWindow();
+ bool TransferDataFromControl();
+
+ /**
+ * Method InstallOnPanel
+ * Install this WIDGET_EESCHEMA_COLOR_CONFIG onto an empty panel. This is useful
+ * when combining with wxFormBuilder, as an empty panel can be left as a
+ * placeholder in the layout.
+ */
+ void InstallOnPanel( wxPanel* aPanel );
};
-#endif // DIALOG_COLOR_CONFIG_H_
+#endif // WIDGET_EESCHEMA_COLOR_CONFIG_H_
diff --git a/include/id.h b/include/id.h
index c864171a72..a50a950901 100644
--- a/include/id.h
+++ b/include/id.h
@@ -124,8 +124,6 @@ enum main_id
ID_NO_TOOL_SELECTED,
ID_SEL_BG_COLOR,
- ID_COLORS_SETUP,
-
ID_REPEAT_BUTT,
ID_LANGUAGE_CHOICE,