From c4694e029db2cb85cc7a2c5759efba8bea02f791 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Sat, 16 Jan 2016 18:50:45 -0500 Subject: [PATCH 1/6] Move color configuration into a separate widget --- eeschema/CMakeLists.txt | 6 + eeschema/dialogs/dialog_color_config.cpp | 251 +-------------- eeschema/dialogs/dialog_color_config.h | 10 +- eeschema/dialogs/dialog_color_config_base.cpp | 18 +- eeschema/dialogs/dialog_color_config_base.fbp | 15 +- eeschema/dialogs/dialog_color_config_base.h | 6 +- eeschema/widgets/widget_color_config.cpp | 295 ++++++++++++++++++ eeschema/widgets/widget_color_config.h | 61 ++++ 8 files changed, 379 insertions(+), 283 deletions(-) create mode 100644 eeschema/widgets/widget_color_config.cpp create mode 100644 eeschema/widgets/widget_color_config.h diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index c8d9a46813..713b51db56 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -72,6 +72,11 @@ set( EESCHEMA_DLGS dialogs/dialog_schematic_find_base.cpp ) +set( EESCHEMA_WIDGETS + widgets/widget_color_config.cpp + ) + + set( EESCHEMA_SRCS autoplace_fields.cpp annotate.cpp @@ -90,6 +95,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.cpp b/eeschema/dialogs/dialog_color_config.cpp index c59b067ebd..10874594e8 100644 --- a/eeschema/dialogs/dialog_color_config.cpp +++ b/eeschema/dialogs/dialog_color_config.cpp @@ -33,264 +33,21 @@ #include - #define ID_COLOR_SETUP 1800 -// Specify the width and height of every (color-displaying / bitmap) button -const int BUTT_SIZE_X = 16; -const int BUTT_SIZE_Y = 16; - - -/********************/ -/* Layer menu list. */ -/********************/ - -struct COLORBUTTON -{ - wxString m_Name; - int m_Layer; -}; - -struct BUTTONINDEX -{ - wxString m_Name; - COLORBUTTON* m_Buttons; -}; - -static COLORBUTTON generalColorButtons[] = { - { _( "Wire" ), LAYER_WIRE }, - { _( "Bus" ), LAYER_BUS }, - { _( "Junction" ), LAYER_JUNCTION }, - { _( "Label" ), LAYER_LOCLABEL }, - { _( "Global label" ), LAYER_GLOBLABEL }, - { _( "Net name" ), LAYER_NETNAM }, - { _( "Notes" ), LAYER_NOTES }, - { _( "No connect symbol" ), LAYER_NOCONNECT }, - { wxT( "" ), -1 } // Sentinel marking end of list. -}; - -static COLORBUTTON componentColorButtons[] = { - { _( "Body" ), LAYER_DEVICE }, - { _( "Body background" ), LAYER_DEVICE_BACKGROUND }, - { _( "Pin" ), LAYER_PIN }, - { _( "Pin number" ), LAYER_PINNUM }, - { _( "Pin name" ), LAYER_PINNAM }, - { _( "Reference" ), LAYER_REFERENCEPART }, - { _( "Value" ), LAYER_VALUEPART }, - { _( "Fields" ), LAYER_FIELDS }, - { wxT( "" ), -1 } // Sentinel marking end of list. -}; - -static COLORBUTTON sheetColorButtons[] = { - { _( "Sheet" ), LAYER_SHEET }, - { _( "Sheet file name" ), LAYER_SHEETFILENAME }, - { _( "Sheet name" ), LAYER_SHEETNAME }, - { _( "Sheet label" ), LAYER_SHEETLABEL }, - { _( "Hierarchical label" ),LAYER_HIERLABEL }, - { wxT( "" ), -1 } // Sentinel marking end of list. -}; - -static COLORBUTTON miscColorButtons[] = { - { _( "ERC warning" ), LAYER_ERC_WARN }, - { _( "ERC error" ), LAYER_ERC_ERR }, - { _( "Grid" ), LAYER_GRID }, - { wxT( "" ), -1 } // Sentinel marking end of list. -}; - - -static BUTTONINDEX buttonGroups[] = { - { _( "General" ), generalColorButtons }, - { _( "Component" ), componentColorButtons }, - { _( "Sheet" ), sheetColorButtons }, - { _( "Miscellaneous" ), miscColorButtons }, - { wxT( "" ), NULL } -}; - - -static EDA_COLOR_T currentColors[ LAYERSCH_ID_COUNT ]; - - DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG( EDA_DRAW_FRAME* aParent ) : DIALOG_COLOR_CONFIG_BASE( aParent ) { m_parent = aParent; - CreateControls(); + + m_colorConfig = new WIDGET_COLOR_CONFIG( this, aParent ); + m_mainBoxSizer->Insert( 0, m_colorConfig, 1, wxEXPAND | wxALL, 5 ); GetSizer()->SetSizeHints( this ); } -void DIALOG_COLOR_CONFIG::CreateControls() -{ - wxStaticText* label; - int buttonId = 1800; - - BUTTONINDEX* groups = buttonGroups; - wxBoxSizer* columnBoxSizer = NULL; - - while( groups->m_Buttons != NULL ) - { - COLORBUTTON* buttons = groups->m_Buttons; - - columnBoxSizer = new wxBoxSizer( wxVERTICAL ); - m_mainBoxSizer->Add( columnBoxSizer, 1, wxALIGN_TOP | wxLEFT | wxTOP, 5 ); - wxBoxSizer* rowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); - columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); - - // Add a text string to identify the column of color select buttons. - label = new wxStaticText( this, wxID_ANY, groups->m_Name ); - - // Make the column label font bold. - wxFont font( label->GetFont() ); - font.SetWeight( wxFONTWEIGHT_BOLD ); - label->SetFont( font ); - - rowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); - - while( buttons->m_Layer >= 0 ) - { - rowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); - columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxALL, 0 ); - - wxMemoryDC iconDC; - wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); - - iconDC.SelectObject( bitmap ); - - EDA_COLOR_T color = GetLayerColor( LAYERSCH_ID( buttons->m_Layer ) ); - currentColors[ buttons->m_Layer ] = color; - - iconDC.SetPen( *wxBLACK_PEN ); - - wxBrush brush; - ColorSetBrush( &brush, color ); - brush.SetStyle( wxBRUSHSTYLE_SOLID ); - iconDC.SetBrush( brush ); - iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); - - wxBitmapButton* bitmapButton = new wxBitmapButton( - this, buttonId, bitmap, wxDefaultPosition, - wxSize( BUTT_SIZE_X+8, BUTT_SIZE_Y+6 ) ); - bitmapButton->SetClientData( (void*) buttons ); - - rowBoxSizer->Add( bitmapButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 ); - - label = new wxStaticText( this, wxID_ANY, wxGetTranslation( buttons->m_Name ) ); - rowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 ); - buttonId += 1; - buttons++; - } - - groups++; - } - - Connect( 1800, buttonId - 1, wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler( DIALOG_COLOR_CONFIG::SetColor ) ); - - wxArrayString selBgColorStrings; - selBgColorStrings.Add( _( "White" ) ); - selBgColorStrings.Add( _( "Black" ) ); - 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 ); - - if( columnBoxSizer ) - { - // Add a spacer to improve appearance. - columnBoxSizer->AddSpacer( 5 ); - columnBoxSizer->Add( m_SelBgColor, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 5 ); - } - - currentColors[ LAYER_BACKGROUND ] = m_parent->GetDrawBgColor(); - - // Dialog now needs to be resized, but the associated command is found elsewhere. -} - - -void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event ) -{ - wxBitmapButton* button = (wxBitmapButton*) event.GetEventObject(); - - wxCHECK_RET( button != NULL, wxT( "Color button event object is NULL." ) ); - - COLORBUTTON* colorButton = (COLORBUTTON*) button->GetClientData(); - - wxCHECK_RET( colorButton != NULL, wxT( "Client data not set for color button." ) ); - - EDA_COLOR_T color = DisplayColorFrame( this, colorButton->m_Layer ); - - if( color < 0 || currentColors[ colorButton->m_Layer ] == color ) - return; - - currentColors[ colorButton->m_Layer ] = color; - - wxMemoryDC iconDC; - - wxBitmap bitmap = button->GetBitmapLabel(); - iconDC.SelectObject( bitmap ); - iconDC.SetPen( *wxBLACK_PEN ); - - wxBrush brush; - - ColorSetBrush( &brush, color); - - brush.SetStyle( wxBRUSHSTYLE_SOLID ); - - iconDC.SetBrush( brush ); - iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); - button->SetBitmapLabel( bitmap ); - button->Refresh(); - - Refresh( false ); -} - - bool DIALOG_COLOR_CONFIG::TransferDataFromWindow() { - 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; - - for( LAYERSCH_ID clyr = LAYER_WIRE; clyr < LAYERSCH_ID_COUNT; ++clyr ) - { - if( bgcolor == currentColors[ clyr ] && clyr != LAYER_BACKGROUND ) - { - warning = true; - break; - } - } - - // Prompt the user if an item has the same color as the background - // because this item cannot be seen: - if( warning ) - { - 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(); - - return true; + return m_colorConfig->TransferDataFromControl(); } diff --git a/eeschema/dialogs/dialog_color_config.h b/eeschema/dialogs/dialog_color_config.h index 0f07367971..a35efef896 100644 --- a/eeschema/dialogs/dialog_color_config.h +++ b/eeschema/dialogs/dialog_color_config.h @@ -26,7 +26,7 @@ #define DIALOG_COLOR_CONFIG_H_ #include - +#include "../widgets/widget_color_config.h" class wxBoxSizer; class wxStaticLine; @@ -39,14 +39,8 @@ class wxStdDialogButtonSizer; class DIALOG_COLOR_CONFIG : public DIALOG_COLOR_CONFIG_BASE { -private: EDA_DRAW_FRAME* m_parent; - wxRadioBox* m_SelBgColor; - - // Creates the controls and sizers - void CreateControls(); - - void SetColor( wxCommandEvent& aEvent ); + WIDGET_COLOR_CONFIG* m_colorConfig; public: // Constructors and destructor diff --git a/eeschema/dialogs/dialog_color_config_base.cpp b/eeschema/dialogs/dialog_color_config_base.cpp index 8991523b7c..b2019202ee 100644 --- a/eeschema/dialogs/dialog_color_config_base.cpp +++ b/eeschema/dialogs/dialog_color_config_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 5 2014) +// C++ code generated with wxFormBuilder (version Dec 28 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -13,16 +13,10 @@ DIALOG_COLOR_CONFIG_BASE::DIALOG_COLOR_CONFIG_BASE( wxWindow* parent, wxWindowID { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - wxBoxSizer* bmainSizer; - bmainSizer = new wxBoxSizer( wxVERTICAL ); - - m_mainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); - - - bmainSizer->Add( m_mainBoxSizer, 1, wxEXPAND, 5 ); + m_mainBoxSizer = new wxBoxSizer( wxVERTICAL ); m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bmainSizer->Add( m_staticline, 0, wxEXPAND | wxALL, 5 ); + m_mainBoxSizer->Add( m_staticline, 0, wxEXPAND | wxALL, 5 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); @@ -33,12 +27,12 @@ DIALOG_COLOR_CONFIG_BASE::DIALOG_COLOR_CONFIG_BASE( wxWindow* parent, wxWindowID m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->Realize(); - bmainSizer->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 ); + m_mainBoxSizer->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 ); - this->SetSizer( bmainSizer ); + this->SetSizer( m_mainBoxSizer ); this->Layout(); - bmainSizer->Fit( this ); + m_mainBoxSizer->Fit( this ); this->Centre( wxBOTH ); } diff --git a/eeschema/dialogs/dialog_color_config_base.fbp b/eeschema/dialogs/dialog_color_config_base.fbp index d739b5795e..b22dcea0de 100644 --- a/eeschema/dialogs/dialog_color_config_base.fbp +++ b/eeschema/dialogs/dialog_color_config_base.fbp @@ -90,20 +90,9 @@ - bmainSizer + m_mainBoxSizer wxVERTICAL - none - - 5 - wxEXPAND - 1 - - - m_mainBoxSizer - wxHORIZONTAL - protected - - + protected 5 wxEXPAND | wxALL diff --git a/eeschema/dialogs/dialog_color_config_base.h b/eeschema/dialogs/dialog_color_config_base.h index 83697b118c..3fe817a650 100644 --- a/eeschema/dialogs/dialog_color_config_base.h +++ b/eeschema/dialogs/dialog_color_config_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 5 2014) +// C++ code generated with wxFormBuilder (version Dec 28 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -14,13 +14,13 @@ class DIALOG_SHIM; #include "dialog_shim.h" -#include -#include #include +#include #include #include #include #include +#include #include #include diff --git a/eeschema/widgets/widget_color_config.cpp b/eeschema/widgets/widget_color_config.cpp new file mode 100644 index 0000000000..0236c16490 --- /dev/null +++ b/eeschema/widgets/widget_color_config.cpp @@ -0,0 +1,295 @@ +/* + * 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) 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 + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* Set up color Layers for Eeschema + */ + +#include +#include +#include + +#include + +#include "widget_color_config.h" + +// Specify the width and height of every (color-displaying / bitmap) button +const int BUTT_SIZE_X = 16; +const int BUTT_SIZE_Y = 16; + + +/********************/ +/* Layer menu list. */ +/********************/ + +struct COLORBUTTON +{ + wxString m_Name; + int m_Layer; +}; + +struct BUTTONINDEX +{ + wxString m_Name; + COLORBUTTON* m_Buttons; +}; + +static COLORBUTTON generalColorButtons[] = { + { _( "Wire" ), LAYER_WIRE }, + { _( "Bus" ), LAYER_BUS }, + { _( "Junction" ), LAYER_JUNCTION }, + { _( "Label" ), LAYER_LOCLABEL }, + { _( "Global label" ), LAYER_GLOBLABEL }, + { _( "Net name" ), LAYER_NETNAM }, + { _( "Notes" ), LAYER_NOTES }, + { _( "No connect symbol" ), LAYER_NOCONNECT }, + { wxT( "" ), -1 } // Sentinel marking end of list. +}; + +static COLORBUTTON componentColorButtons[] = { + { _( "Body" ), LAYER_DEVICE }, + { _( "Body background" ), LAYER_DEVICE_BACKGROUND }, + { _( "Pin" ), LAYER_PIN }, + { _( "Pin number" ), LAYER_PINNUM }, + { _( "Pin name" ), LAYER_PINNAM }, + { _( "Reference" ), LAYER_REFERENCEPART }, + { _( "Value" ), LAYER_VALUEPART }, + { _( "Fields" ), LAYER_FIELDS }, + { wxT( "" ), -1 } // Sentinel marking end of list. +}; + +static COLORBUTTON sheetColorButtons[] = { + { _( "Sheet" ), LAYER_SHEET }, + { _( "Sheet file name" ), LAYER_SHEETFILENAME }, + { _( "Sheet name" ), LAYER_SHEETNAME }, + { _( "Sheet label" ), LAYER_SHEETLABEL }, + { _( "Hierarchical label" ),LAYER_HIERLABEL }, + { wxT( "" ), -1 } // Sentinel marking end of list. +}; + +static COLORBUTTON miscColorButtons[] = { + { _( "ERC warning" ), LAYER_ERC_WARN }, + { _( "ERC error" ), LAYER_ERC_ERR }, + { _( "Grid" ), LAYER_GRID }, + { wxT( "" ), -1 } // Sentinel marking end of list. +}; + + +static BUTTONINDEX buttonGroups[] = { + { _( "General" ), generalColorButtons }, + { _( "Component" ), componentColorButtons }, + { _( "Sheet" ), sheetColorButtons }, + { _( "Miscellaneous" ), miscColorButtons }, + { wxT( "" ), NULL } +}; + + +static EDA_COLOR_T currentColors[ LAYERSCH_ID_COUNT ]; + + +WIDGET_COLOR_CONFIG::WIDGET_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ) : + wxPanel( aParent ), m_drawFrame( aDrawFrame ) +{ + CreateControls(); + + GetSizer()->SetSizeHints( this ); +} + + +void WIDGET_COLOR_CONFIG::CreateControls() +{ + wxStaticText* label; + int buttonId = 1800; + + m_mainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); + SetSizer( m_mainBoxSizer ); + + BUTTONINDEX* groups = buttonGroups; + wxBoxSizer* columnBoxSizer = NULL; + + while( groups->m_Buttons != NULL ) + { + COLORBUTTON* buttons = groups->m_Buttons; + + columnBoxSizer = new wxBoxSizer( wxVERTICAL ); + m_mainBoxSizer->Add( columnBoxSizer, 1, wxALIGN_TOP | wxLEFT | wxTOP, 5 ); + wxBoxSizer* rowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); + columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); + + // Add a text string to identify the column of color select buttons. + label = new wxStaticText( this, wxID_ANY, groups->m_Name ); + + // Make the column label font bold. + wxFont font( label->GetFont() ); + font.SetWeight( wxFONTWEIGHT_BOLD ); + label->SetFont( font ); + + rowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); + + while( buttons->m_Layer >= 0 ) + { + rowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); + columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxALL, 0 ); + + wxMemoryDC iconDC; + wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); + + iconDC.SelectObject( bitmap ); + + EDA_COLOR_T color = GetLayerColor( LAYERSCH_ID( buttons->m_Layer ) ); + currentColors[ buttons->m_Layer ] = color; + + iconDC.SetPen( *wxBLACK_PEN ); + + wxBrush brush; + ColorSetBrush( &brush, color ); + brush.SetStyle( wxBRUSHSTYLE_SOLID ); + iconDC.SetBrush( brush ); + iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); + + wxBitmapButton* bitmapButton = new wxBitmapButton( + this, buttonId, bitmap, wxDefaultPosition, + wxSize( BUTT_SIZE_X+8, BUTT_SIZE_Y+6 ) ); + bitmapButton->SetClientData( (void*) buttons ); + + rowBoxSizer->Add( bitmapButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 ); + + label = new wxStaticText( this, wxID_ANY, wxGetTranslation( buttons->m_Name ) ); + rowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 ); + buttonId += 1; + buttons++; + } + + groups++; + } + + Connect( 1800, buttonId - 1, wxEVT_COMMAND_BUTTON_CLICKED, + wxCommandEventHandler( WIDGET_COLOR_CONFIG::SetColor ) ); + + wxArrayString selBgColorStrings; + selBgColorStrings.Add( _( "White" ) ); + selBgColorStrings.Add( _( "Black" ) ); + m_SelBgColor = new wxRadioBox( this, wxID_ANY, _( "Background Color" ), + wxDefaultPosition, wxDefaultSize, + selBgColorStrings, 1, wxRA_SPECIFY_COLS ); + m_SelBgColor->SetSelection( ( GetDrawFrame()->GetDrawBgColor() == BLACK ) ? 1 : 0 ); + + if( columnBoxSizer ) + { + // Add a spacer to improve appearance. + columnBoxSizer->AddSpacer( 5 ); + columnBoxSizer->Add( m_SelBgColor, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 5 ); + } + + currentColors[ LAYER_BACKGROUND ] = GetDrawFrame()->GetDrawBgColor(); + + // Dialog now needs to be resized, but the associated command is found elsewhere. +} + + +void WIDGET_COLOR_CONFIG::SetColor( wxCommandEvent& event ) +{ + wxBitmapButton* button = (wxBitmapButton*) event.GetEventObject(); + + wxCHECK_RET( button != NULL, wxT( "Color button event object is NULL." ) ); + + COLORBUTTON* colorButton = (COLORBUTTON*) button->GetClientData(); + + wxCHECK_RET( colorButton != NULL, wxT( "Client data not set for color button." ) ); + + EDA_COLOR_T color = DisplayColorFrame( this, colorButton->m_Layer ); + + if( color < 0 || currentColors[ colorButton->m_Layer ] == color ) + return; + + currentColors[ colorButton->m_Layer ] = color; + + wxMemoryDC iconDC; + + wxBitmap bitmap = button->GetBitmapLabel(); + iconDC.SelectObject( bitmap ); + iconDC.SetPen( *wxBLACK_PEN ); + + wxBrush brush; + + ColorSetBrush( &brush, color); + + brush.SetStyle( wxBRUSHSTYLE_SOLID ); + + iconDC.SetBrush( brush ); + iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); + button->SetBitmapLabel( bitmap ); + button->Refresh(); + + Refresh( false ); +} + + +bool WIDGET_COLOR_CONFIG::TransferDataFromControl() +{ + 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; + + for( LAYERSCH_ID clyr = LAYER_WIRE; clyr < LAYERSCH_ID_COUNT; ++clyr ) + { + if( bgcolor == currentColors[ clyr ] && clyr != LAYER_BACKGROUND ) + { + warning = true; + break; + } + } + + // Prompt the user if an item has the same color as the background + // because this item cannot be seen: + if( warning ) + { + 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 + GetDrawFrame()->SetDrawBgColor( bgcolor ); + currentColors[ LAYER_BACKGROUND ] = bgcolor; + + + for( LAYERSCH_ID clyr = LAYER_WIRE; clyr < LAYERSCH_ID_COUNT; ++clyr ) + { + SetLayerColor( currentColors[ clyr ], clyr ); + } + + GetDrawFrame()->SetGridColor( GetLayerColor( LAYER_GRID ) ); + GetDrawFrame()->GetCanvas()->Refresh(); + + return true; +} diff --git a/eeschema/widgets/widget_color_config.h b/eeschema/widgets/widget_color_config.h new file mode 100644 index 0000000000..0b4208b515 --- /dev/null +++ b/eeschema/widgets/widget_color_config.h @@ -0,0 +1,61 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2007 G. Harland + * 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 + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef WIDGET_COLOR_CONFIG_H_ +#define WIDGET_COLOR_CONFIG_H_ + +#include +#include + +class wxBoxSizer; +class wxStaticLine; +class wxStdDialogButtonSizer; + + +/***********************************************/ +/* Derived class for the frame color settings. */ +/***********************************************/ + +class WIDGET_COLOR_CONFIG : public wxPanel +{ +private: + 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 + WIDGET_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ); + + bool TransferDataFromControl(); +}; + +#endif // WIDGET_COLOR_CONFIG_H_ From 8c2427d3fa0191623751a813da38e4dea7458f52 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Sat, 16 Jan 2016 18:50:55 -0500 Subject: [PATCH 2/6] Add and use WIDGET_COLOR_CONFIG::InstallOnPanel --- eeschema/dialogs/dialog_color_config.cpp | 2 +- eeschema/dialogs/dialog_color_config_base.cpp | 4 +- eeschema/dialogs/dialog_color_config_base.fbp | 82 ++++++++++++++++++- eeschema/dialogs/dialog_color_config_base.h | 6 +- eeschema/widgets/widget_color_config.cpp | 9 ++ eeschema/widgets/widget_color_config.h | 8 ++ 6 files changed, 106 insertions(+), 5 deletions(-) diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/dialogs/dialog_color_config.cpp index 10874594e8..0abb7de186 100644 --- a/eeschema/dialogs/dialog_color_config.cpp +++ b/eeschema/dialogs/dialog_color_config.cpp @@ -41,7 +41,7 @@ DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG( EDA_DRAW_FRAME* aParent ) : m_parent = aParent; m_colorConfig = new WIDGET_COLOR_CONFIG( this, aParent ); - m_mainBoxSizer->Insert( 0, m_colorConfig, 1, wxEXPAND | wxALL, 5 ); + m_colorConfig->InstallOnPanel( m_pnlColors ); GetSizer()->SetSizeHints( this ); } diff --git a/eeschema/dialogs/dialog_color_config_base.cpp b/eeschema/dialogs/dialog_color_config_base.cpp index b2019202ee..a2ea063877 100644 --- a/eeschema/dialogs/dialog_color_config_base.cpp +++ b/eeschema/dialogs/dialog_color_config_base.cpp @@ -15,6 +15,9 @@ DIALOG_COLOR_CONFIG_BASE::DIALOG_COLOR_CONFIG_BASE( wxWindow* parent, wxWindowID m_mainBoxSizer = new wxBoxSizer( wxVERTICAL ); + m_pnlColors = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_mainBoxSizer->Add( m_pnlColors, 1, wxEXPAND | wxALL, 5 ); + m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_mainBoxSizer->Add( m_staticline, 0, wxEXPAND | wxALL, 5 ); @@ -32,7 +35,6 @@ DIALOG_COLOR_CONFIG_BASE::DIALOG_COLOR_CONFIG_BASE( wxWindow* parent, wxWindowID this->SetSizer( m_mainBoxSizer ); this->Layout(); - m_mainBoxSizer->Fit( this ); this->Centre( wxBOTH ); } diff --git a/eeschema/dialogs/dialog_color_config_base.fbp b/eeschema/dialogs/dialog_color_config_base.fbp index b22dcea0de..8bdb2bd0cc 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 - -1,-1 + 332,286 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h EESchema Colors @@ -93,6 +93,86 @@ m_mainBoxSizer wxVERTICAL protected + + 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_pnlColors + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxEXPAND | wxALL diff --git a/eeschema/dialogs/dialog_color_config_base.h b/eeschema/dialogs/dialog_color_config_base.h index 3fe817a650..2ab0aeb3fc 100644 --- a/eeschema/dialogs/dialog_color_config_base.h +++ b/eeschema/dialogs/dialog_color_config_base.h @@ -14,12 +14,13 @@ class DIALOG_SHIM; #include "dialog_shim.h" -#include +#include #include #include #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ class DIALOG_COLOR_CONFIG_BASE : public DIALOG_SHIM protected: wxBoxSizer* m_mainBoxSizer; + wxPanel* m_pnlColors; wxStaticLine* m_staticline; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; @@ -44,7 +46,7 @@ class DIALOG_COLOR_CONFIG_BASE : public DIALOG_SHIM 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( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EESchema Colors"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 332,286 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_COLOR_CONFIG_BASE(); }; diff --git a/eeschema/widgets/widget_color_config.cpp b/eeschema/widgets/widget_color_config.cpp index 0236c16490..51b77f8e61 100644 --- a/eeschema/widgets/widget_color_config.cpp +++ b/eeschema/widgets/widget_color_config.cpp @@ -293,3 +293,12 @@ bool WIDGET_COLOR_CONFIG::TransferDataFromControl() return true; } + + +void WIDGET_COLOR_CONFIG::InstallOnPanel( wxPanel* aPanel ) +{ + wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); + + sizer->Add( this, 1, wxALL | wxEXPAND, 0 ); + aPanel->SetSizer( sizer ); +} diff --git a/eeschema/widgets/widget_color_config.h b/eeschema/widgets/widget_color_config.h index 0b4208b515..e5fdf4ee69 100644 --- a/eeschema/widgets/widget_color_config.h +++ b/eeschema/widgets/widget_color_config.h @@ -56,6 +56,14 @@ public: WIDGET_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ); bool TransferDataFromControl(); + + /** + * Method InstallOnPanel + * Install this WIDGET_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 // WIDGET_COLOR_CONFIG_H_ From 95137418162a26fc89b797696c35a4bdcdc531e2 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Sat, 16 Jan 2016 18:51:27 -0500 Subject: [PATCH 3/6] Rename WIDGET_COLOR_CONFIG -> WIDGET_EESCHEMA_COLOR_CONFIG --- eeschema/CMakeLists.txt | 2 +- eeschema/dialogs/dialog_color_config.cpp | 2 +- eeschema/dialogs/dialog_color_config.h | 6 +++--- ...config.cpp => widget_eeschema_color_config.cpp} | 14 +++++++------- ...lor_config.h => widget_eeschema_color_config.h} | 12 ++++++------ 5 files changed, 18 insertions(+), 18 deletions(-) rename eeschema/widgets/{widget_color_config.cpp => widget_eeschema_color_config.cpp} (95%) rename eeschema/widgets/{widget_color_config.h => widget_eeschema_color_config.h} (85%) diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 713b51db56..7a27c8f2e2 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -73,7 +73,7 @@ set( EESCHEMA_DLGS ) set( EESCHEMA_WIDGETS - widgets/widget_color_config.cpp + widgets/widget_eeschema_color_config.cpp ) diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/dialogs/dialog_color_config.cpp index 0abb7de186..2297729421 100644 --- a/eeschema/dialogs/dialog_color_config.cpp +++ b/eeschema/dialogs/dialog_color_config.cpp @@ -40,7 +40,7 @@ DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG( EDA_DRAW_FRAME* aParent ) : { m_parent = aParent; - m_colorConfig = new WIDGET_COLOR_CONFIG( this, aParent ); + m_colorConfig = new WIDGET_EESCHEMA_COLOR_CONFIG( this, aParent ); m_colorConfig->InstallOnPanel( m_pnlColors ); GetSizer()->SetSizeHints( this ); diff --git a/eeschema/dialogs/dialog_color_config.h b/eeschema/dialogs/dialog_color_config.h index a35efef896..c4be6d6a97 100644 --- a/eeschema/dialogs/dialog_color_config.h +++ b/eeschema/dialogs/dialog_color_config.h @@ -26,7 +26,7 @@ #define DIALOG_COLOR_CONFIG_H_ #include -#include "../widgets/widget_color_config.h" +#include "../widgets/widget_eeschema_color_config.h" class wxBoxSizer; class wxStaticLine; @@ -39,8 +39,8 @@ class wxStdDialogButtonSizer; class DIALOG_COLOR_CONFIG : public DIALOG_COLOR_CONFIG_BASE { - EDA_DRAW_FRAME* m_parent; - WIDGET_COLOR_CONFIG* m_colorConfig; + EDA_DRAW_FRAME* m_parent; + WIDGET_EESCHEMA_COLOR_CONFIG* m_colorConfig; public: // Constructors and destructor diff --git a/eeschema/widgets/widget_color_config.cpp b/eeschema/widgets/widget_eeschema_color_config.cpp similarity index 95% rename from eeschema/widgets/widget_color_config.cpp rename to eeschema/widgets/widget_eeschema_color_config.cpp index 51b77f8e61..af48116152 100644 --- a/eeschema/widgets/widget_color_config.cpp +++ b/eeschema/widgets/widget_eeschema_color_config.cpp @@ -31,7 +31,7 @@ #include -#include "widget_color_config.h" +#include "widget_eeschema_color_config.h" // Specify the width and height of every (color-displaying / bitmap) button const int BUTT_SIZE_X = 16; @@ -107,7 +107,7 @@ static BUTTONINDEX buttonGroups[] = { static EDA_COLOR_T currentColors[ LAYERSCH_ID_COUNT ]; -WIDGET_COLOR_CONFIG::WIDGET_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ) : +WIDGET_EESCHEMA_COLOR_CONFIG::WIDGET_EESCHEMA_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ) : wxPanel( aParent ), m_drawFrame( aDrawFrame ) { CreateControls(); @@ -116,7 +116,7 @@ WIDGET_COLOR_CONFIG::WIDGET_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDr } -void WIDGET_COLOR_CONFIG::CreateControls() +void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls() { wxStaticText* label; int buttonId = 1800; @@ -184,7 +184,7 @@ void WIDGET_COLOR_CONFIG::CreateControls() } Connect( 1800, buttonId - 1, wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler( WIDGET_COLOR_CONFIG::SetColor ) ); + wxCommandEventHandler( WIDGET_EESCHEMA_COLOR_CONFIG::SetColor ) ); wxArrayString selBgColorStrings; selBgColorStrings.Add( _( "White" ) ); @@ -207,7 +207,7 @@ void WIDGET_COLOR_CONFIG::CreateControls() } -void WIDGET_COLOR_CONFIG::SetColor( wxCommandEvent& event ) +void WIDGET_EESCHEMA_COLOR_CONFIG::SetColor( wxCommandEvent& event ) { wxBitmapButton* button = (wxBitmapButton*) event.GetEventObject(); @@ -245,7 +245,7 @@ void WIDGET_COLOR_CONFIG::SetColor( wxCommandEvent& event ) } -bool WIDGET_COLOR_CONFIG::TransferDataFromControl() +bool WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl() { bool warning = false; @@ -295,7 +295,7 @@ bool WIDGET_COLOR_CONFIG::TransferDataFromControl() } -void WIDGET_COLOR_CONFIG::InstallOnPanel( wxPanel* aPanel ) +void WIDGET_EESCHEMA_COLOR_CONFIG::InstallOnPanel( wxPanel* aPanel ) { wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL ); diff --git a/eeschema/widgets/widget_color_config.h b/eeschema/widgets/widget_eeschema_color_config.h similarity index 85% rename from eeschema/widgets/widget_color_config.h rename to eeschema/widgets/widget_eeschema_color_config.h index e5fdf4ee69..1f99a31193 100644 --- a/eeschema/widgets/widget_color_config.h +++ b/eeschema/widgets/widget_eeschema_color_config.h @@ -22,8 +22,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef WIDGET_COLOR_CONFIG_H_ -#define WIDGET_COLOR_CONFIG_H_ +#ifndef WIDGET_EESCHEMA_COLOR_CONFIG_H_ +#define WIDGET_EESCHEMA_COLOR_CONFIG_H_ #include #include @@ -37,7 +37,7 @@ class wxStdDialogButtonSizer; /* Derived class for the frame color settings. */ /***********************************************/ -class WIDGET_COLOR_CONFIG : public wxPanel +class WIDGET_EESCHEMA_COLOR_CONFIG : public wxPanel { private: EDA_DRAW_FRAME* m_drawFrame; @@ -53,17 +53,17 @@ private: public: // Constructors and destructor - WIDGET_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ); + WIDGET_EESCHEMA_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ); bool TransferDataFromControl(); /** * Method InstallOnPanel - * Install this WIDGET_COLOR_CONFIG onto an empty panel. This is useful + * 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 // WIDGET_COLOR_CONFIG_H_ +#endif // WIDGET_EESCHEMA_COLOR_CONFIG_H_ From bf036422204d84b3250e6a6a681e5ea829003107 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Sat, 16 Jan 2016 18:51:38 -0500 Subject: [PATCH 4/6] Pull colors widget into preferences dialog --- eeschema/dialogs/dialog_eeschema_options.cpp | 8 + eeschema/dialogs/dialog_eeschema_options.h | 4 +- .../dialogs/dialog_eeschema_options_base.cpp | 38 ++-- .../dialogs/dialog_eeschema_options_base.fbp | 184 +++++++++++++++++- .../dialogs/dialog_eeschema_options_base.h | 4 +- .../widgets/widget_eeschema_color_config.cpp | 2 - 6 files changed, 214 insertions(+), 26 deletions(-) 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/widgets/widget_eeschema_color_config.cpp b/eeschema/widgets/widget_eeschema_color_config.cpp index af48116152..f23c2e9dcf 100644 --- a/eeschema/widgets/widget_eeschema_color_config.cpp +++ b/eeschema/widgets/widget_eeschema_color_config.cpp @@ -111,8 +111,6 @@ WIDGET_EESCHEMA_COLOR_CONFIG::WIDGET_EESCHEMA_COLOR_CONFIG( wxWindow* aParent, E wxPanel( aParent ), m_drawFrame( aDrawFrame ) { CreateControls(); - - GetSizer()->SetSizeHints( this ); } From b891fa4358584bdfc2b4a4ec1f8e8ebdceaa2743 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Sat, 16 Jan 2016 18:51:48 -0500 Subject: [PATCH 5/6] Remove separate color configuration dialog --- eeschema/eeschema_config.cpp | 8 -------- eeschema/menubar.cpp | 7 ------- eeschema/schframe.cpp | 1 - eeschema/schframe.h | 1 - 4 files changed, 17 deletions(-) diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 804045e45c..3c971d746a 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -195,14 +195,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/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/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 ); From 5d805e94eb721924f798b34278c4e33292b605c1 Mon Sep 17 00:00:00 2001 From: Chris Pavlina Date: Sat, 16 Jan 2016 18:51:56 -0500 Subject: [PATCH 6/6] Remove last vestiges of DIALOG_COLOR_CONFIG The color config dialog in libedit edits the same settings as the one in eeschema, so there's no reason for it - it's just duplicated. --- eeschema/CMakeLists.txt | 2 - eeschema/dialogs/dialog_color_config.cpp | 53 ---- eeschema/dialogs/dialog_color_config.h | 52 ---- eeschema/dialogs/dialog_color_config_base.cpp | 44 --- eeschema/dialogs/dialog_color_config_base.fbp | 286 ------------------ eeschema/dialogs/dialog_color_config_base.h | 54 ---- eeschema/eeschema.cpp | 1 - eeschema/eeschema_config.cpp | 9 - eeschema/libeditframe.cpp | 2 - eeschema/libeditframe.h | 1 - eeschema/menubar_libedit.cpp | 7 - include/id.h | 2 - 12 files changed, 513 deletions(-) delete mode 100644 eeschema/dialogs/dialog_color_config.cpp delete mode 100644 eeschema/dialogs/dialog_color_config.h delete mode 100644 eeschema/dialogs/dialog_color_config_base.cpp delete mode 100644 eeschema/dialogs/dialog_color_config_base.fbp delete mode 100644 eeschema/dialogs/dialog_color_config_base.h diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 7a27c8f2e2..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 diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/dialogs/dialog_color_config.cpp deleted file mode 100644 index 2297729421..0000000000 --- a/eeschema/dialogs/dialog_color_config.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -/* Set up color Layers for Eeschema - */ - -#include -#include -#include - -#include - -#include - -#define ID_COLOR_SETUP 1800 - -DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG( EDA_DRAW_FRAME* aParent ) : - DIALOG_COLOR_CONFIG_BASE( aParent ) -{ - m_parent = aParent; - - m_colorConfig = new WIDGET_EESCHEMA_COLOR_CONFIG( this, aParent ); - m_colorConfig->InstallOnPanel( m_pnlColors ); - - GetSizer()->SetSizeHints( this ); -} - - -bool DIALOG_COLOR_CONFIG::TransferDataFromWindow() -{ - return m_colorConfig->TransferDataFromControl(); -} diff --git a/eeschema/dialogs/dialog_color_config.h b/eeschema/dialogs/dialog_color_config.h deleted file mode 100644 index c4be6d6a97..0000000000 --- a/eeschema/dialogs/dialog_color_config.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef DIALOG_COLOR_CONFIG_H_ -#define DIALOG_COLOR_CONFIG_H_ - -#include -#include "../widgets/widget_eeschema_color_config.h" - -class wxBoxSizer; -class wxStaticLine; -class wxStdDialogButtonSizer; - - -/***********************************************/ -/* Derived class for the frame color settings. */ -/***********************************************/ - -class DIALOG_COLOR_CONFIG : public DIALOG_COLOR_CONFIG_BASE -{ - EDA_DRAW_FRAME* m_parent; - WIDGET_EESCHEMA_COLOR_CONFIG* m_colorConfig; - -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 deleted file mode 100644 index a2ea063877..0000000000 --- a/eeschema/dialogs/dialog_color_config_base.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 28 2015) -// 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 ); - - m_mainBoxSizer = new wxBoxSizer( wxVERTICAL ); - - m_pnlColors = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_mainBoxSizer->Add( m_pnlColors, 1, wxEXPAND | wxALL, 5 ); - - m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - m_mainBoxSizer->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(); - - m_mainBoxSizer->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 ); - - - this->SetSizer( m_mainBoxSizer ); - this->Layout(); - - 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 8bdb2bd0cc..0000000000 --- a/eeschema/dialogs/dialog_color_config_base.fbp +++ /dev/null @@ -1,286 +0,0 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_color_config_base - 1000 - none - 1 - dialog_color_config_base - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - wxBOTH - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - DIALOG_COLOR_CONFIG_BASE - - 332,286 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - EESchema Colors - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - m_mainBoxSizer - wxVERTICAL - protected - - 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_pnlColors - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND | wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer - protected - - - - - - - - - - - - - - diff --git a/eeschema/dialogs/dialog_color_config_base.h b/eeschema/dialogs/dialog_color_config_base.h deleted file mode 100644 index 2ab0aeb3fc..0000000000 --- a/eeschema/dialogs/dialog_color_config_base.h +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 28 2015) -// 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 -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_COLOR_CONFIG_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_COLOR_CONFIG_BASE : public DIALOG_SHIM -{ - private: - - protected: - wxBoxSizer* m_mainBoxSizer; - wxPanel* m_pnlColors; - 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( 332,286 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_COLOR_CONFIG_BASE(); - -}; - -#endif //__DIALOG_COLOR_CONFIG_BASE_H__ 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 3c971d746a..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(); 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_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/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,