From 5b5e9102bb5ee3aac2f160cf6470f5d278ff8d41 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 4 Oct 2021 14:53:44 +0200 Subject: [PATCH] pcb_calculator rework: move color code panel to its own files panel_color_code_xx --- pcb_calculator/CMakeLists.txt | 3 +- pcb_calculator/dialogs/panel_color_code.h | 50 + .../dialogs/panel_color_code_base.cpp | 92 ++ .../dialogs/panel_color_code_base.fbp | 870 ++++++++++++++++++ .../dialogs/panel_color_code_base.h | 62 ++ .../dialogs/pcb_calculator_frame_base.cpp | 73 +- .../dialogs/pcb_calculator_frame_base.fbp | 822 +---------------- .../dialogs/pcb_calculator_frame_base.h | 17 +- .../{colorcode.cpp => panel_color_code.cpp} | 53 +- pcb_calculator/pcb_calculator_frame.cpp | 16 +- pcb_calculator/pcb_calculator_frame.h | 10 - 11 files changed, 1128 insertions(+), 940 deletions(-) create mode 100644 pcb_calculator/dialogs/panel_color_code.h create mode 100644 pcb_calculator/dialogs/panel_color_code_base.cpp create mode 100644 pcb_calculator/dialogs/panel_color_code_base.fbp create mode 100644 pcb_calculator/dialogs/panel_color_code_base.h rename pcb_calculator/{colorcode.cpp => panel_color_code.cpp} (57%) diff --git a/pcb_calculator/CMakeLists.txt b/pcb_calculator/CMakeLists.txt index 8441118b70..94d86784b5 100644 --- a/pcb_calculator/CMakeLists.txt +++ b/pcb_calculator/CMakeLists.txt @@ -10,7 +10,6 @@ include_directories( set( PCB_CALCULATOR_SRCS eserie.cpp board_classes_values.cpp - colorcode.cpp common_data.cpp electrical_spacing_values.cpp params_read_write.cpp @@ -19,6 +18,7 @@ set( PCB_CALCULATOR_SRCS datafile_read_write.cpp panel_attenuators.cpp panel_regulator.cpp + panel_color_code.cpp tracks_width_versus_current.cpp via.cpp transline_ident.cpp @@ -38,6 +38,7 @@ set( PCB_CALCULATOR_SRCS dialogs/dialog_regulator_form.cpp dialogs/panel_attenuators_base.cpp dialogs/panel_regulator_base.cpp + dialogs/panel_color_code_base.cpp ../common/env_vars.cpp # needed on MSW to avoid a link issue (a symbol not found) ) diff --git a/pcb_calculator/dialogs/panel_color_code.h b/pcb_calculator/dialogs/panel_color_code.h new file mode 100644 index 0000000000..ca767a9bab --- /dev/null +++ b/pcb_calculator/dialogs/panel_color_code.h @@ -0,0 +1,50 @@ +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.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 3 + * 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, see . + */ + +#ifndef PANEL_COLOR_CODE_H +#define PANEL_COLOR_CODE_H + +#include "panel_color_code_base.h" +class PCB_CALCULATOR_SETTINGS; + + +class PANEL_COLOR_CODE : public PANEL_COLOR_CODE_BASE +{ +public: + PANEL_COLOR_CODE( wxWindow* parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + ~PANEL_COLOR_CODE(); + + void OnToleranceSelection( wxCommandEvent& event ) override; + void ToleranceSelection( int aSelection ); + void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg ); + void SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg ); + +private: + void initColorCodePanel(); + + wxBitmap* m_ccValueNamesBitmap; + wxBitmap* m_ccValuesBitmap; + wxBitmap* m_ccMultipliersBitmap; + wxBitmap* m_ccTolerancesBitmap; +}; + +#endif \ No newline at end of file diff --git a/pcb_calculator/dialogs/panel_color_code_base.cpp b/pcb_calculator/dialogs/panel_color_code_base.cpp new file mode 100644 index 0000000000..0d0816a9ce --- /dev/null +++ b/pcb_calculator/dialogs/panel_color_code_base.cpp @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 26 2018) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "panel_color_code_base.h" + +/////////////////////////////////////////////////////////////////////////// + +PANEL_COLOR_CODE_BASE::PANEL_COLOR_CODE_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ + wxBoxSizer* bSizerPanelColorCode; + bSizerPanelColorCode = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerOpts; + bSizerOpts = new wxBoxSizer( wxVERTICAL ); + + wxString m_rbToleranceSelectionChoices[] = { _("10% / 5%"), _("<= 2%") }; + int m_rbToleranceSelectionNChoices = sizeof( m_rbToleranceSelectionChoices ) / sizeof( wxString ); + m_rbToleranceSelection = new wxRadioBox( this, wxID_ANY, _("Tolerance"), wxDefaultPosition, wxDefaultSize, m_rbToleranceSelectionNChoices, m_rbToleranceSelectionChoices, 1, wxRA_SPECIFY_COLS ); + m_rbToleranceSelection->SetSelection( 0 ); + bSizerOpts->Add( m_rbToleranceSelection, 0, wxBOTTOM|wxRIGHT, 30 ); + + + bSizerPanelColorCode->Add( bSizerOpts, 0, wxALL, 8 ); + + wxFlexGridSizer* fgSizerColoCode; + fgSizerColoCode = new wxFlexGridSizer( 2, 6, 0, 0 ); + fgSizerColoCode->SetFlexibleDirection( wxBOTH ); + fgSizerColoCode->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticTextBand1 = new wxStaticText( this, wxID_ANY, _("1st Band"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBand1->Wrap( -1 ); + fgSizerColoCode->Add( m_staticTextBand1, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_staticTextBand2 = new wxStaticText( this, wxID_ANY, _("2nd Band"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBand2->Wrap( -1 ); + fgSizerColoCode->Add( m_staticTextBand2, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_staticTextBand3 = new wxStaticText( this, wxID_ANY, _("3rd Band"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBand3->Wrap( -1 ); + fgSizerColoCode->Add( m_staticTextBand3, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_staticTextBand4 = new wxStaticText( this, wxID_ANY, _("4th Band"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBand4->Wrap( -1 ); + fgSizerColoCode->Add( m_staticTextBand4, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_staticTextBand5 = new wxStaticText( this, wxID_ANY, _("Multiplier"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBand5->Wrap( -1 ); + fgSizerColoCode->Add( m_staticTextBand5, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_staticTextBand6 = new wxStaticText( this, wxID_ANY, _("Tolerance"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBand6->Wrap( -1 ); + fgSizerColoCode->Add( m_staticTextBand6, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_Band1bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerColoCode->Add( m_Band1bitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_Band2bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerColoCode->Add( m_Band2bitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_Band3bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerColoCode->Add( m_Band3bitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + m_Band4bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerColoCode->Add( m_Band4bitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + m_Band_mult_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerColoCode->Add( m_Band_mult_bitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + m_Band_tol_bitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerColoCode->Add( m_Band_tol_bitmap, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + + bSizerPanelColorCode->Add( fgSizerColoCode, 1, wxEXPAND|wxLEFT, 5 ); + + + this->SetSizer( bSizerPanelColorCode ); + this->Layout(); + + // Connect Events + m_rbToleranceSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PANEL_COLOR_CODE_BASE::OnToleranceSelection ), NULL, this ); +} + +PANEL_COLOR_CODE_BASE::~PANEL_COLOR_CODE_BASE() +{ + // Disconnect Events + m_rbToleranceSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PANEL_COLOR_CODE_BASE::OnToleranceSelection ), NULL, this ); + +} diff --git a/pcb_calculator/dialogs/panel_color_code_base.fbp b/pcb_calculator/dialogs/panel_color_code_base.fbp new file mode 100644 index 0000000000..a68fdea5f5 --- /dev/null +++ b/pcb_calculator/dialogs/panel_color_code_base.fbp @@ -0,0 +1,870 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + panel_color_code_base + 1000 + none + + 1 + panel_color_code_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_COLOR_CODE_BASE + + 500,300 + ; ; forward_declare + + + + wxTAB_TRAVERSAL + + + bSizerPanelColorCode + wxHORIZONTAL + none + + 8 + wxALL + 0 + + + bSizerOpts + wxVERTICAL + none + + 30 + wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "10% / 5%" "<= 2%" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Tolerance + 1 + + 0 + + + 0 + + 1 + m_rbToleranceSelection + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnToleranceSelection + + + + + + 5 + wxEXPAND|wxLEFT + 1 + + 6 + wxBOTH + + + 0 + + fgSizerColoCode + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 1st Band + 0 + + 0 + + + 0 + + 1 + m_staticTextBand1 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 2nd Band + 0 + + 0 + + + 0 + + 1 + m_staticTextBand2 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 3rd Band + 0 + + 0 + + + 0 + + 1 + m_staticTextBand3 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + 4th Band + 0 + + 0 + + + 0 + + 1 + m_staticTextBand4 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Multiplier + 0 + + 0 + + + 0 + + 1 + m_staticTextBand5 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Tolerance + 0 + + 0 + + + 0 + + 1 + m_staticTextBand6 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_Band1bitmap + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_Band2bitmap + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_Band3bitmap + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_Band4bitmap + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_Band_mult_bitmap + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_Band_tol_bitmap + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + + + + + diff --git a/pcb_calculator/dialogs/panel_color_code_base.h b/pcb_calculator/dialogs/panel_color_code_base.h new file mode 100644 index 0000000000..abef7e465a --- /dev/null +++ b/pcb_calculator/dialogs/panel_color_code_base.h @@ -0,0 +1,62 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 26 2018) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class PANEL_COLOR_CODE_BASE +/////////////////////////////////////////////////////////////////////////////// +class PANEL_COLOR_CODE_BASE : public wxPanel +{ + private: + + protected: + wxRadioBox* m_rbToleranceSelection; + wxStaticText* m_staticTextBand1; + wxStaticText* m_staticTextBand2; + wxStaticText* m_staticTextBand3; + wxStaticText* m_staticTextBand4; + wxStaticText* m_staticTextBand5; + wxStaticText* m_staticTextBand6; + wxStaticBitmap* m_Band1bitmap; + wxStaticBitmap* m_Band2bitmap; + wxStaticBitmap* m_Band3bitmap; + wxStaticBitmap* m_Band4bitmap; + wxStaticBitmap* m_Band_mult_bitmap; + wxStaticBitmap* m_Band_tol_bitmap; + + // Virtual event handlers, overide them in your derived class + virtual void OnToleranceSelection( wxCommandEvent& event ) { event.Skip(); } + + + public: + + PANEL_COLOR_CODE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + ~PANEL_COLOR_CODE_BASE(); + +}; + diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp index e8459f32c4..e7e695f4e3 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp @@ -213,76 +213,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_panelESeries->Layout(); bSizerESerie->Fit( m_panelESeries ); m_Notebook->AddPage( m_panelESeries, _("E-Series"), false ); - m_panelColorCode = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizerPanelColorCode; - bSizerPanelColorCode = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizer38; - bSizer38 = new wxBoxSizer( wxVERTICAL ); - - wxString m_rbToleranceSelectionChoices[] = { _("10% / 5%"), _("<= 2%") }; - int m_rbToleranceSelectionNChoices = sizeof( m_rbToleranceSelectionChoices ) / sizeof( wxString ); - m_rbToleranceSelection = new wxRadioBox( m_panelColorCode, wxID_ANY, _("Tolerance"), wxDefaultPosition, wxDefaultSize, m_rbToleranceSelectionNChoices, m_rbToleranceSelectionChoices, 1, wxRA_SPECIFY_COLS ); - m_rbToleranceSelection->SetSelection( 0 ); - bSizer38->Add( m_rbToleranceSelection, 0, wxBOTTOM|wxRIGHT, 30 ); - - - bSizerPanelColorCode->Add( bSizer38, 0, wxALL, 8 ); - - wxFlexGridSizer* fgSizerColoCode; - fgSizerColoCode = new wxFlexGridSizer( 2, 6, 0, 0 ); - fgSizerColoCode->SetFlexibleDirection( wxBOTH ); - fgSizerColoCode->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_staticText31 = new wxStaticText( m_panelColorCode, wxID_ANY, _("1st Band"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText31->Wrap( -1 ); - fgSizerColoCode->Add( m_staticText31, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_staticText34 = new wxStaticText( m_panelColorCode, wxID_ANY, _("2nd Band"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText34->Wrap( -1 ); - fgSizerColoCode->Add( m_staticText34, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_staticText35 = new wxStaticText( m_panelColorCode, wxID_ANY, _("3rd Band"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText35->Wrap( -1 ); - fgSizerColoCode->Add( m_staticText35, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_Band4Label = new wxStaticText( m_panelColorCode, wxID_ANY, _("4th Band"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Band4Label->Wrap( -1 ); - fgSizerColoCode->Add( m_Band4Label, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_staticText37 = new wxStaticText( m_panelColorCode, wxID_ANY, _("Multiplier"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText37->Wrap( -1 ); - fgSizerColoCode->Add( m_staticText37, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_staticText38 = new wxStaticText( m_panelColorCode, wxID_ANY, _("Tolerance"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText38->Wrap( -1 ); - fgSizerColoCode->Add( m_staticText38, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_Band1bitmap = new wxStaticBitmap( m_panelColorCode, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerColoCode->Add( m_Band1bitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_Band2bitmap = new wxStaticBitmap( m_panelColorCode, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerColoCode->Add( m_Band2bitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_Band3bitmap = new wxStaticBitmap( m_panelColorCode, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerColoCode->Add( m_Band3bitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT, 5 ); - - m_Band4bitmap = new wxStaticBitmap( m_panelColorCode, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerColoCode->Add( m_Band4bitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - - m_Band_mult_bitmap = new wxStaticBitmap( m_panelColorCode, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerColoCode->Add( m_Band_mult_bitmap, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - - m_Band_tol_bitmap = new wxStaticBitmap( m_panelColorCode, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerColoCode->Add( m_Band_tol_bitmap, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - - bSizerPanelColorCode->Add( fgSizerColoCode, 1, wxEXPAND|wxLEFT, 5 ); - - - m_panelColorCode->SetSizer( bSizerPanelColorCode ); - m_panelColorCode->Layout(); - bSizerPanelColorCode->Fit( m_panelColorCode ); + m_panelColorCode = new PANEL_COLOR_CODE( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_Notebook->AddPage( m_panelColorCode, _("Color Code"), false ); m_panelTransline = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizeTransline; @@ -1593,7 +1524,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_e6->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this ); m_e12->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this ); m_buttonEScalculate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateESeries ), NULL, this ); - m_rbToleranceSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnToleranceSelection ), NULL, this ); m_TranslineSelection->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSelection ), NULL, this ); m_button_EpsilonR->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineEpsilonR_Button ), NULL, this ); m_button_TanD->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineTanD_Button ), NULL, this ); @@ -1653,7 +1583,6 @@ PCB_CALCULATOR_FRAME_BASE::~PCB_CALCULATOR_FRAME_BASE() m_e6->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this ); m_e12->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnESeriesSelection ), NULL, this ); m_buttonEScalculate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnCalculateESeries ), NULL, this ); - m_rbToleranceSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnToleranceSelection ), NULL, this ); m_TranslineSelection->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSelection ), NULL, this ); m_button_EpsilonR->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineEpsilonR_Button ), NULL, this ); m_button_TanD->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineTanD_Button ), NULL, this ); diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp index 494c0560cf..c00078d53a 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp @@ -2438,11 +2438,11 @@ - + Color Code 0 - + 1 1 1 @@ -2487,828 +2487,12 @@ Resizable 1 - + PANEL_COLOR_CODE; panel_color_code.h; Not forward_declare 0 wxTAB_TRAVERSAL - - - bSizerPanelColorCode - wxHORIZONTAL - none - - 8 - wxALL - 0 - - - bSizer38 - wxVERTICAL - none - - 30 - wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "10% / 5%" "<= 2%" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Tolerance - 1 - - 0 - - - 0 - - 1 - m_rbToleranceSelection - 1 - - - protected - 1 - - Resizable - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnToleranceSelection - - - - - - 5 - wxEXPAND|wxLEFT - 1 - - 6 - wxBOTH - - - 0 - - fgSizerColoCode - wxFLEX_GROWMODE_SPECIFIED - none - 2 - 0 - - 5 - wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 1st Band - 0 - - 0 - - - 0 - - 1 - m_staticText31 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 2nd Band - 0 - - 0 - - - 0 - - 1 - m_staticText34 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 3rd Band - 0 - - 0 - - - 0 - - 1 - m_staticText35 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - 4th Band - 0 - - 0 - - - 0 - - 1 - m_Band4Label - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Multiplier - 0 - - 0 - - - 0 - - 1 - m_staticText37 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Tolerance - 0 - - 0 - - - 0 - - 1 - m_staticText38 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Band1bitmap - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Band2bitmap - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Band3bitmap - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Band4bitmap - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Band_mult_bitmap - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Band_tol_bitmap - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - - - - - - diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.h b/pcb_calculator/dialogs/pcb_calculator_frame_base.h index ef8351645a..034c7bcebc 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.h +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.h @@ -18,6 +18,7 @@ class UNIT_SELECTOR_THICKNESS; #include "panel_regulator.h" #include "panel_attenuators.h" +#include "panel_color_code.h" #include "widgets/unit_selector.h" #include "kiway_player.h" #include @@ -94,20 +95,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER wxStaticLine* m_staticline7; wxButton* m_buttonEScalculate; wxHtmlWindow* m_panelESeriesHelp; - wxPanel* m_panelColorCode; - wxRadioBox* m_rbToleranceSelection; - wxStaticText* m_staticText31; - wxStaticText* m_staticText34; - wxStaticText* m_staticText35; - wxStaticText* m_Band4Label; - wxStaticText* m_staticText37; - wxStaticText* m_staticText38; - wxStaticBitmap* m_Band1bitmap; - wxStaticBitmap* m_Band2bitmap; - wxStaticBitmap* m_Band3bitmap; - wxStaticBitmap* m_Band4bitmap; - wxStaticBitmap* m_Band_mult_bitmap; - wxStaticBitmap* m_Band_tol_bitmap; + PANEL_COLOR_CODE* m_panelColorCode; wxPanel* m_panelTransline; wxRadioBox* m_TranslineSelection; wxStaticBitmap* m_translineBitmap; @@ -329,7 +317,6 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnESeriesSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnCalculateESeries( wxCommandEvent& event ) { event.Skip(); } - virtual void OnToleranceSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnTranslineSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnTranslineEpsilonR_Button( wxCommandEvent& event ) { event.Skip(); } virtual void OnTranslineTanD_Button( wxCommandEvent& event ) { event.Skip(); } diff --git a/pcb_calculator/colorcode.cpp b/pcb_calculator/panel_color_code.cpp similarity index 57% rename from pcb_calculator/colorcode.cpp rename to pcb_calculator/panel_color_code.cpp index 90b0953526..126945f845 100644 --- a/pcb_calculator/colorcode.cpp +++ b/pcb_calculator/panel_color_code.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 2011 jean-pierre.charras - * Copyright (C) 2011-2021 Kicad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2011 jean-pierre.charras + * Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.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 @@ -18,13 +18,44 @@ * with this program. If not, see . */ -#include #include - -#include "pcb_calculator_frame.h" +#include +#include "pcb_calculator_settings.h" -void PCB_CALCULATOR_FRAME::initColorCodePanel() +PANEL_COLOR_CODE::PANEL_COLOR_CODE( wxWindow* parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) : + PANEL_COLOR_CODE_BASE( parent, id, pos, size, style, name ) +{ + initColorCodePanel(); + ToleranceSelection( m_rbToleranceSelection->GetSelection() ); +} + + +PANEL_COLOR_CODE::~PANEL_COLOR_CODE() +{ + delete m_ccValueNamesBitmap; + delete m_ccValuesBitmap; + delete m_ccMultipliersBitmap; + delete m_ccTolerancesBitmap; +} + + +void PANEL_COLOR_CODE::LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg ) +{ + m_rbToleranceSelection->SetSelection( aCfg->m_ColorCodeTolerance ); + ToleranceSelection( m_rbToleranceSelection->GetSelection() ); +} + + +void PANEL_COLOR_CODE::SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg ) +{ + aCfg->m_ColorCodeTolerance = m_rbToleranceSelection->GetSelection(); +} + + +void PANEL_COLOR_CODE::initColorCodePanel() { m_ccValueNamesBitmap = KiBitmapNew( BITMAPS::color_code_value_and_name ); m_ccValuesBitmap = KiBitmapNew( BITMAPS::color_code_value ); @@ -33,13 +64,13 @@ void PCB_CALCULATOR_FRAME::initColorCodePanel() } -void PCB_CALCULATOR_FRAME::OnToleranceSelection( wxCommandEvent& event ) +void PANEL_COLOR_CODE::OnToleranceSelection( wxCommandEvent& event ) { ToleranceSelection( event.GetSelection() ); } -void PCB_CALCULATOR_FRAME::ToleranceSelection( int aSelection ) +void PANEL_COLOR_CODE::ToleranceSelection( int aSelection ) { /* For tolerance = 5 or 10 %, there are 3 bands for the value * but for tolerance < 5 %, there are 4 bands @@ -47,11 +78,11 @@ void PCB_CALCULATOR_FRAME::ToleranceSelection( int aSelection ) bool show4thBand = aSelection != 0; m_Band4bitmap->Show(show4thBand); - m_Band4Label->Show(show4thBand); + m_staticTextBand4->Show(show4thBand); // m_Band4Label visibility has changed: // The new size must be taken in account - m_panelColorCode->GetSizer()->Layout(); + GetSizer()->Layout(); // All this shouldn't be necessary but if you want the bitmaps to show up on OSX it is. m_Band1bitmap->SetBitmap( *m_ccValueNamesBitmap ); @@ -61,5 +92,5 @@ void PCB_CALCULATOR_FRAME::ToleranceSelection( int aSelection ) m_Band_mult_bitmap->SetBitmap( *m_ccMultipliersBitmap ); m_Band_tol_bitmap->SetBitmap( *m_ccTolerancesBitmap ); - m_panelColorCode->Refresh(); + Refresh(); } diff --git a/pcb_calculator/pcb_calculator_frame.cpp b/pcb_calculator/pcb_calculator_frame.cpp index a41871a8e6..aaa8be12ba 100644 --- a/pcb_calculator/pcb_calculator_frame.cpp +++ b/pcb_calculator/pcb_calculator_frame.cpp @@ -90,12 +90,9 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_TranslineSelection->SetSelection( m_currTransLineType ); initTrackWidthPanel(); - initColorCodePanel(); initViaSizePanel(); initESeriesPanel(); - ToleranceSelection( m_rbToleranceSelection->GetSelection() ); - BoardClassesUpdateData( m_BoardClassesUnitsSelector->GetUnitScale() ); ElectricalSpacingUpdateData( m_ElectricalSpacingUnitsSelector->GetUnitScale() ); @@ -132,11 +129,6 @@ PCB_CALCULATOR_FRAME::~PCB_CALCULATOR_FRAME() for( unsigned ii = 0; ii < m_transline_list.size(); ii++ ) delete m_transline_list[ii]; - delete m_ccValueNamesBitmap; - delete m_ccValuesBitmap; - delete m_ccMultipliersBitmap; - delete m_ccTolerancesBitmap; - // This needed for OSX: avoids further OnDraw processing after this destructor and before // the native window is destroyed this->Freeze(); @@ -168,8 +160,6 @@ void PCB_CALCULATOR_FRAME::OnUpdateUI( wxUpdateUIEvent& event ) m_panelAttenuators->UpdateUI(); - ToleranceSelection( m_rbToleranceSelection->GetSelection() ); - m_viaBitmap->SetBitmap( KiBitmap( BITMAPS::viacalc ) ); m_panelViaSize->Layout(); @@ -251,7 +241,6 @@ void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) m_currTransLineType = static_cast( cfg->m_TransLine.type ); m_Notebook->ChangeSelection( cfg->m_LastPage ); - m_rbToleranceSelection->SetSelection( cfg->m_ColorCodeTolerance ); m_BoardClassesUnitsSelector->SetSelection( cfg->m_BoardClassUnits ); // Attenuators panel config: @@ -260,6 +249,9 @@ void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) // Regul panel config: m_panelRegulators->LoadSettings( cfg ); + // color panel config: + m_panelColorCode->LoadSettings( cfg ); + // Electrical panel config m_ElectricalSpacingUnitsSelector->SetSelection( cfg->m_Electrical.spacing_units ); m_ElectricalSpacingVoltage->SetValue( cfg->m_Electrical.spacing_voltage ); @@ -283,7 +275,6 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) { cfg->m_LastPage = m_Notebook->GetSelection(); cfg->m_TransLine.type = m_currTransLineType; - cfg->m_ColorCodeTolerance = m_rbToleranceSelection->GetSelection(); cfg->m_BoardClassUnits = m_BoardClassesUnitsSelector->GetSelection(); cfg->m_Electrical.spacing_units = m_ElectricalSpacingUnitsSelector->GetSelection(); @@ -291,6 +282,7 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) m_panelRegulators->Regulators_WriteConfig( cfg ); m_panelAttenuators->SaveSettings( cfg ); + m_panelColorCode->SaveSettings( cfg ); } writeTrackWidthConfig(); diff --git a/pcb_calculator/pcb_calculator_frame.h b/pcb_calculator/pcb_calculator_frame.h index c43b997af8..d223d911ef 100644 --- a/pcb_calculator/pcb_calculator_frame.h +++ b/pcb_calculator/pcb_calculator_frame.h @@ -104,7 +104,6 @@ private: */ void initTrackWidthPanel(); void initESeriesPanel(); - void initColorCodePanel(); void initViaSizePanel(); /** @@ -267,10 +266,6 @@ private: */ void TransfDlgDataToTranslineParams(); - // Color Code panel - void OnToleranceSelection( wxCommandEvent& event ) override; - void ToleranceSelection( int aSelection ); - private: enum // Which dimension is controlling the track width / current { // calculations: @@ -285,11 +280,6 @@ private: TRANSLINE* m_currTransLine; std::vector m_transline_list; - wxBitmap* m_ccValueNamesBitmap; - wxBitmap* m_ccValuesBitmap; - wxBitmap* m_ccMultipliersBitmap; - wxBitmap* m_ccTolerancesBitmap; - int m_lastNotebookPage; bool m_macHack; };