diff --git a/pcb_calculator/CMakeLists.txt b/pcb_calculator/CMakeLists.txt index 971e7e2ea1..262b8e30dc 100644 --- a/pcb_calculator/CMakeLists.txt +++ b/pcb_calculator/CMakeLists.txt @@ -9,13 +9,13 @@ include_directories( set( PCB_CALCULATOR_SRCS eserie.cpp - board_classes_values.cpp common_data.cpp params_read_write.cpp pcb_calculator_frame.cpp pcb_calculator_settings.cpp datafile_read_write.cpp panel_attenuators.cpp + panel_board_class.cpp panel_color_code.cpp panel_electrical_spacing.cpp panel_regulator.cpp @@ -37,6 +37,7 @@ set( PCB_CALCULATOR_SRCS dialogs/dialog_regulator_form_base.cpp dialogs/dialog_regulator_form.cpp dialogs/panel_attenuators_base.cpp + dialogs/panel_board_class_base.cpp dialogs/panel_regulator_base.cpp dialogs/panel_color_code_base.cpp dialogs/panel_via_size_base.cpp diff --git a/pcb_calculator/dialogs/panel_board_class.h b/pcb_calculator/dialogs/panel_board_class.h new file mode 100644 index 0000000000..2f10ff0692 --- /dev/null +++ b/pcb_calculator/dialogs/panel_board_class.h @@ -0,0 +1,44 @@ +/* + * 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_BOARD_CLASS_H +#define PANEL_BOARD_CLASS_H + +#include "panel_board_class_base.h" + +class PCB_CALCULATOR_SETTINGS; + + +class PANEL_BOARD_CLASS : public PANEL_BOARD_CLASS_BASE +{ +public: + PANEL_BOARD_CLASS( wxWindow* parent, wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + ~PANEL_BOARD_CLASS(); + + void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg ); + void SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg ); + + void OnBoardClassesUnitsSelection( wxCommandEvent& event ) override; + void BoardClassesUpdateData( double aUnitScale ); +}; + +#endif \ No newline at end of file diff --git a/pcb_calculator/dialogs/panel_board_class_base.cpp b/pcb_calculator/dialogs/panel_board_class_base.cpp new file mode 100644 index 0000000000..d36644a1ca --- /dev/null +++ b/pcb_calculator/dialogs/panel_board_class_base.cpp @@ -0,0 +1,106 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 26 2018) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "widgets/unit_selector.h" + +#include "panel_board_class_base.h" + +/////////////////////////////////////////////////////////////////////////// + +PANEL_BOARD_CLASS_BASE::PANEL_BOARD_CLASS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ + wxBoxSizer* bSizerBoardClass; + bSizerBoardClass = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerUnitsMargins; + bSizerUnitsMargins = new wxBoxSizer( wxVERTICAL ); + + wxArrayString m_BoardClassesUnitsSelectorChoices; + m_BoardClassesUnitsSelector = new UNIT_SELECTOR_LEN( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_BoardClassesUnitsSelectorChoices, 0 ); + m_BoardClassesUnitsSelector->SetSelection( 0 ); + bSizerUnitsMargins->Add( m_BoardClassesUnitsSelector, 0, wxTOP|wxBOTTOM|wxRIGHT, 32 ); + + + bSizerBoardClass->Add( bSizerUnitsMargins, 0, wxLEFT, 10 ); + + wxBoxSizer* brdclsSizerRight; + brdclsSizerRight = new wxBoxSizer( wxVERTICAL ); + + m_staticTextBrdClass = new wxStaticText( this, wxID_ANY, _("Note: Values are minimal values"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextBrdClass->Wrap( -1 ); + m_staticTextBrdClass->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); + + brdclsSizerRight->Add( m_staticTextBrdClass, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + + m_gridClassesValuesDisplay = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_gridClassesValuesDisplay->CreateGrid( 5, 6 ); + m_gridClassesValuesDisplay->EnableEditing( false ); + m_gridClassesValuesDisplay->EnableGridLines( true ); + m_gridClassesValuesDisplay->EnableDragGridSize( false ); + m_gridClassesValuesDisplay->SetMargins( 0, 0 ); + + // Columns + m_gridClassesValuesDisplay->SetColSize( 0, 100 ); + m_gridClassesValuesDisplay->SetColSize( 1, 100 ); + m_gridClassesValuesDisplay->SetColSize( 2, 100 ); + m_gridClassesValuesDisplay->SetColSize( 3, 100 ); + m_gridClassesValuesDisplay->SetColSize( 4, 100 ); + m_gridClassesValuesDisplay->SetColSize( 5, 100 ); + m_gridClassesValuesDisplay->EnableDragColMove( false ); + m_gridClassesValuesDisplay->EnableDragColSize( true ); + m_gridClassesValuesDisplay->SetColLabelSize( 30 ); + m_gridClassesValuesDisplay->SetColLabelValue( 0, _("Class 1") ); + m_gridClassesValuesDisplay->SetColLabelValue( 1, _("Class 2") ); + m_gridClassesValuesDisplay->SetColLabelValue( 2, _("Class 3") ); + m_gridClassesValuesDisplay->SetColLabelValue( 3, _("Class 4") ); + m_gridClassesValuesDisplay->SetColLabelValue( 4, _("Class 5") ); + m_gridClassesValuesDisplay->SetColLabelValue( 5, _("Class 6") ); + m_gridClassesValuesDisplay->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); + + // Rows + m_gridClassesValuesDisplay->SetRowSize( 0, 24 ); + m_gridClassesValuesDisplay->SetRowSize( 1, 24 ); + m_gridClassesValuesDisplay->SetRowSize( 2, 24 ); + m_gridClassesValuesDisplay->SetRowSize( 3, 24 ); + m_gridClassesValuesDisplay->SetRowSize( 4, 24 ); + m_gridClassesValuesDisplay->EnableDragRowSize( false ); + m_gridClassesValuesDisplay->SetRowLabelSize( 160 ); + m_gridClassesValuesDisplay->SetRowLabelValue( 0, _("Lines width") ); + m_gridClassesValuesDisplay->SetRowLabelValue( 1, _("Min clearance") ); + m_gridClassesValuesDisplay->SetRowLabelValue( 2, _("Via: (diam - drill)") ); + m_gridClassesValuesDisplay->SetRowLabelValue( 3, _("Plated Pad: (diam - drill)") ); + m_gridClassesValuesDisplay->SetRowLabelValue( 4, _("NP Pad: (diam - drill)") ); + m_gridClassesValuesDisplay->SetRowLabelAlignment( wxALIGN_RIGHT, wxALIGN_CENTER ); + + // Label Appearance + + // Cell Defaults + m_gridClassesValuesDisplay->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_TOP ); + brdclsSizerRight->Add( m_gridClassesValuesDisplay, 0, wxALL|wxEXPAND, 5 ); + + m_panelShowClassPrms = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + brdclsSizerRight->Add( m_panelShowClassPrms, 1, wxALL|wxEXPAND, 5 ); + + + bSizerBoardClass->Add( brdclsSizerRight, 1, wxEXPAND, 5 ); + + + this->SetSizer( bSizerBoardClass ); + this->Layout(); + + // Connect Events + m_BoardClassesUnitsSelector->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_BOARD_CLASS_BASE::OnBoardClassesUnitsSelection ), NULL, this ); +} + +PANEL_BOARD_CLASS_BASE::~PANEL_BOARD_CLASS_BASE() +{ + // Disconnect Events + m_BoardClassesUnitsSelector->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_BOARD_CLASS_BASE::OnBoardClassesUnitsSelection ), NULL, this ); + +} diff --git a/pcb_calculator/dialogs/panel_board_class_base.fbp b/pcb_calculator/dialogs/panel_board_class_base.fbp new file mode 100644 index 0000000000..2e3a034764 --- /dev/null +++ b/pcb_calculator/dialogs/panel_board_class_base.fbp @@ -0,0 +1,353 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + panel_board_class_base + 1000 + none + + 1 + panel_board_class_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_BOARD_CLASS_BASE + + 701,347 + ; ; forward_declare + + + + wxTAB_TRAVERSAL + + + bSizerBoardClass + wxHORIZONTAL + none + + 10 + wxLEFT + 0 + + + bSizerUnitsMargins + wxVERTICAL + none + + 32 + wxTOP|wxBOTTOM|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_BoardClassesUnitsSelector + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + UNIT_SELECTOR_LEN; widgets/unit_selector.h + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnBoardClassesUnitsSelection + + + + + + 5 + wxEXPAND + 1 + + + brdclsSizerRight + wxVERTICAL + none + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + ,93,92,-1,70,0 + 0 + 0 + wxID_ANY + Note: Values are minimal values + 0 + + 0 + + + 0 + + 1 + m_staticTextBrdClass + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + 0 + + + + 1 + + + wxALIGN_CENTER + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTER + 30 + "Class 1" "Class 2" "Class 3" "Class 4" "Class 5" "Class 6" + wxALIGN_CENTER + 6 + 100,100,100,100,100,100 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 0 + 0 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_gridClassesValuesDisplay + 1 + + + protected + 1 + + Resizable + wxALIGN_RIGHT + 160 + "Lines width" "Min clearance" "Via: (diam - drill)" "Plated Pad: (diam - drill)" "NP Pad: (diam - drill)" + wxALIGN_CENTER + 24,24,24,24,24 + 5 + 1 + + + 0 + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_panelShowClassPrms + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + diff --git a/pcb_calculator/dialogs/panel_board_class_base.h b/pcb_calculator/dialogs/panel_board_class_base.h new file mode 100644 index 0000000000..5c7793a743 --- /dev/null +++ b/pcb_calculator/dialogs/panel_board_class_base.h @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 26 2018) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +class UNIT_SELECTOR_LEN; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class PANEL_BOARD_CLASS_BASE +/////////////////////////////////////////////////////////////////////////////// +class PANEL_BOARD_CLASS_BASE : public wxPanel +{ + private: + + protected: + UNIT_SELECTOR_LEN* m_BoardClassesUnitsSelector; + wxStaticText* m_staticTextBrdClass; + wxGrid* m_gridClassesValuesDisplay; + wxPanel* m_panelShowClassPrms; + + // Virtual event handlers, overide them in your derived class + virtual void OnBoardClassesUnitsSelection( wxCommandEvent& event ) { event.Skip(); } + + + public: + + PANEL_BOARD_CLASS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 701,347 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + ~PANEL_BOARD_CLASS_BASE(); + +}; + diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp index f302f5e5c9..91e6c4643e 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp @@ -680,88 +680,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_Notebook->AddPage( m_panelTrackWidth, _("Track Width"), false ); m_panelElectricalSpacing = new PANEL_ELECTRICAL_SPACING( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_Notebook->AddPage( m_panelElectricalSpacing, _("Electrical Spacing"), false ); - m_panelBoardClass = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizerBoardClass; - bSizerBoardClass = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bSizerUnitsMargins; - bSizerUnitsMargins = new wxBoxSizer( wxVERTICAL ); - - wxArrayString m_BoardClassesUnitsSelectorChoices; - m_BoardClassesUnitsSelector = new UNIT_SELECTOR_LEN( m_panelBoardClass, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_BoardClassesUnitsSelectorChoices, 0 ); - m_BoardClassesUnitsSelector->SetSelection( 0 ); - bSizerUnitsMargins->Add( m_BoardClassesUnitsSelector, 0, wxTOP|wxBOTTOM|wxRIGHT, 32 ); - - - bSizerBoardClass->Add( bSizerUnitsMargins, 0, wxLEFT, 10 ); - - wxBoxSizer* brdclsSizerRight; - brdclsSizerRight = new wxBoxSizer( wxVERTICAL ); - - m_staticTextBrdClass = new wxStaticText( m_panelBoardClass, wxID_ANY, _("Note: Values are minimal values"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextBrdClass->Wrap( -1 ); - m_staticTextBrdClass->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_ITALIC, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); - - brdclsSizerRight->Add( m_staticTextBrdClass, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); - - m_gridClassesValuesDisplay = new wxGrid( m_panelBoardClass, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - - // Grid - m_gridClassesValuesDisplay->CreateGrid( 5, 6 ); - m_gridClassesValuesDisplay->EnableEditing( false ); - m_gridClassesValuesDisplay->EnableGridLines( true ); - m_gridClassesValuesDisplay->EnableDragGridSize( false ); - m_gridClassesValuesDisplay->SetMargins( 0, 0 ); - - // Columns - m_gridClassesValuesDisplay->SetColSize( 0, 100 ); - m_gridClassesValuesDisplay->SetColSize( 1, 100 ); - m_gridClassesValuesDisplay->SetColSize( 2, 100 ); - m_gridClassesValuesDisplay->SetColSize( 3, 100 ); - m_gridClassesValuesDisplay->SetColSize( 4, 100 ); - m_gridClassesValuesDisplay->SetColSize( 5, 100 ); - m_gridClassesValuesDisplay->EnableDragColMove( false ); - m_gridClassesValuesDisplay->EnableDragColSize( true ); - m_gridClassesValuesDisplay->SetColLabelSize( 30 ); - m_gridClassesValuesDisplay->SetColLabelValue( 0, _("Class 1") ); - m_gridClassesValuesDisplay->SetColLabelValue( 1, _("Class 2") ); - m_gridClassesValuesDisplay->SetColLabelValue( 2, _("Class 3") ); - m_gridClassesValuesDisplay->SetColLabelValue( 3, _("Class 4") ); - m_gridClassesValuesDisplay->SetColLabelValue( 4, _("Class 5") ); - m_gridClassesValuesDisplay->SetColLabelValue( 5, _("Class 6") ); - m_gridClassesValuesDisplay->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); - - // Rows - m_gridClassesValuesDisplay->SetRowSize( 0, 24 ); - m_gridClassesValuesDisplay->SetRowSize( 1, 24 ); - m_gridClassesValuesDisplay->SetRowSize( 2, 24 ); - m_gridClassesValuesDisplay->SetRowSize( 3, 24 ); - m_gridClassesValuesDisplay->SetRowSize( 4, 24 ); - m_gridClassesValuesDisplay->EnableDragRowSize( false ); - m_gridClassesValuesDisplay->SetRowLabelSize( 160 ); - m_gridClassesValuesDisplay->SetRowLabelValue( 0, _("Lines width") ); - m_gridClassesValuesDisplay->SetRowLabelValue( 1, _("Min clearance") ); - m_gridClassesValuesDisplay->SetRowLabelValue( 2, _("Via: (diam - drill)") ); - m_gridClassesValuesDisplay->SetRowLabelValue( 3, _("Plated Pad: (diam - drill)") ); - m_gridClassesValuesDisplay->SetRowLabelValue( 4, _("NP Pad: (diam - drill)") ); - m_gridClassesValuesDisplay->SetRowLabelAlignment( wxALIGN_RIGHT, wxALIGN_CENTER ); - - // Label Appearance - - // Cell Defaults - m_gridClassesValuesDisplay->SetDefaultCellAlignment( wxALIGN_CENTER, wxALIGN_TOP ); - brdclsSizerRight->Add( m_gridClassesValuesDisplay, 0, wxALL|wxEXPAND, 5 ); - - m_panelShowClassPrms = new wxPanel( m_panelBoardClass, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - brdclsSizerRight->Add( m_panelShowClassPrms, 1, wxALL|wxEXPAND, 5 ); - - - bSizerBoardClass->Add( brdclsSizerRight, 1, wxEXPAND, 5 ); - - - m_panelBoardClass->SetSizer( bSizerBoardClass ); - m_panelBoardClass->Layout(); - bSizerBoardClass->Fit( m_panelBoardClass ); + m_panelBoardClass = new PANEL_BOARD_CLASS( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_Notebook->AddPage( m_panelBoardClass, _("Board Classes"), false ); bmainFrameSizer->Add( m_Notebook, 1, wxEXPAND, 5 ); @@ -790,7 +709,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_SynthetizeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this ); m_bpButtonSynthetize->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this ); m_buttonTransLineReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTransLineResetButtonClick ), NULL, this ); - m_BoardClassesUnitsSelector->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnBoardClassesUnitsSelection ), NULL, this ); } PCB_CALCULATOR_FRAME_BASE::~PCB_CALCULATOR_FRAME_BASE() @@ -812,6 +730,5 @@ PCB_CALCULATOR_FRAME_BASE::~PCB_CALCULATOR_FRAME_BASE() m_SynthetizeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this ); m_bpButtonSynthetize->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTranslineSynthetize ), NULL, this ); m_buttonTransLineReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnTransLineResetButtonClick ), NULL, this ); - m_BoardClassesUnitsSelector->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PCB_CALCULATOR_FRAME_BASE::OnBoardClassesUnitsSelection ), NULL, this ); } diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp index df468b6738..b39087f4c0 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp @@ -7881,11 +7881,11 @@ wxTAB_TRAVERSAL - + Board Classes 0 - + 1 1 1 @@ -7901,7 +7901,7 @@ 0 1 - 1 + 0 0 Dock 0 @@ -7930,311 +7930,12 @@ Resizable 1 - + PANEL_BOARD_CLASS; panel_board_class.h; Not forward_declare 0 wxTAB_TRAVERSAL - - - bSizerBoardClass - wxHORIZONTAL - none - - 10 - wxLEFT - 0 - - - bSizerUnitsMargins - wxVERTICAL - none - - 32 - wxTOP|wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_BoardClassesUnitsSelector - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - UNIT_SELECTOR_LEN; widgets/unit_selector.h - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnBoardClassesUnitsSelection - - - - - - 5 - wxEXPAND - 1 - - - brdclsSizerRight - wxVERTICAL - none - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - ,93,92,-1,70,0 - 0 - 0 - wxID_ANY - Note: Values are minimal values - 0 - - 0 - - - 0 - - 1 - m_staticTextBrdClass - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - 0 - - - - 1 - - - wxALIGN_CENTER - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTER - 30 - "Class 1" "Class 2" "Class 3" "Class 4" "Class 5" "Class 6" - wxALIGN_CENTER - 6 - 100,100,100,100,100,100 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - 0 - 0 - 0 - 1 - - 1 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - - 1 - m_gridClassesValuesDisplay - 1 - - - protected - 1 - - Resizable - wxALIGN_RIGHT - 160 - "Lines width" "Min clearance" "Via: (diam - drill)" "Plated Pad: (diam - drill)" "NP Pad: (diam - drill)" - wxALIGN_CENTER - 24,24,24,24,24 - 5 - 1 - - - 0 - - - - - - - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_panelShowClassPrms - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.h b/pcb_calculator/dialogs/pcb_calculator_frame_base.h index e7caff747a..002bfd5104 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.h +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.h @@ -21,6 +21,7 @@ class UNIT_SELECTOR_RESISTOR; #include "panel_via_size.h" #include "panel_track_width.h" #include "panel_electrical_spacing.h" +#include "panel_board_class.h" #include "kiway_player.h" #include #include @@ -44,7 +45,6 @@ class UNIT_SELECTOR_RESISTOR; #include #include #include -#include #include #include @@ -178,11 +178,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER PANEL_VIA_SIZE* m_panelViaSize; PANEL_TRACK_WIDTH* m_panelTrackWidth; PANEL_ELECTRICAL_SPACING* m_panelElectricalSpacing; - wxPanel* m_panelBoardClass; - UNIT_SELECTOR_LEN* m_BoardClassesUnitsSelector; - wxStaticText* m_staticTextBrdClass; - wxGrid* m_gridClassesValuesDisplay; - wxPanel* m_panelShowClassPrms; + PANEL_BOARD_CLASS* m_panelBoardClass; // Virtual event handlers, overide them in your derived class virtual void OnClosePcbCalc( wxCloseEvent& event ) { event.Skip(); } @@ -196,7 +192,6 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER virtual void OnTranslineAnalyse( wxCommandEvent& event ) { event.Skip(); } virtual void OnTranslineSynthetize( wxCommandEvent& event ) { event.Skip(); } virtual void OnTransLineResetButtonClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnBoardClassesUnitsSelection( wxCommandEvent& event ) { event.Skip(); } public: diff --git a/pcb_calculator/board_classes_values.cpp b/pcb_calculator/panel_board_class.cpp similarity index 74% rename from pcb_calculator/board_classes_values.cpp rename to pcb_calculator/panel_board_class.cpp index 92c84d2803..fee0aca1b3 100644 --- a/pcb_calculator/board_classes_values.cpp +++ b/pcb_calculator/panel_board_class.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 2015 jean-pierre.charras - * Copyright (C) 2015 Kicad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 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,12 +18,40 @@ * with this program. If not, see . */ -#include -#include - -#include "pcb_calculator_frame.h" +//#include +#include "pcb_calculator_settings.h" +#include +#include #include "units_scales.h" +PANEL_BOARD_CLASS::PANEL_BOARD_CLASS( wxWindow* parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + long style, const wxString& name ) : + PANEL_BOARD_CLASS_BASE( parent, id, pos, size, style, name ) +{ + // Autosize the row label column to be sure label are not truncated + m_gridClassesValuesDisplay->SetRowLabelSize( wxGRID_AUTOSIZE ); +} + + +PANEL_BOARD_CLASS::~PANEL_BOARD_CLASS() +{ +} + + +void PANEL_BOARD_CLASS::SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg ) +{ + aCfg->m_BoardClassUnits = m_BoardClassesUnitsSelector->GetSelection(); +} + + +void PANEL_BOARD_CLASS::LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg ) +{ + m_BoardClassesUnitsSelector->SetSelection( aCfg->m_BoardClassUnits ); + BoardClassesUpdateData( m_BoardClassesUnitsSelector->GetUnitScale() ); +} + + // A helper class to handle min values // Values are in meters. // Note : use -1.0 when a value is irrelevant in a class @@ -83,52 +111,52 @@ static BOARD_MIN_SIZE_VALUES clist[BRDCLASS_COUNT] = }; -void PCB_CALCULATOR_FRAME::OnBoardClassesUnitsSelection( wxCommandEvent& event ) +void PANEL_BOARD_CLASS::OnBoardClassesUnitsSelection( wxCommandEvent& event ) { BoardClassesUpdateData( m_BoardClassesUnitsSelector->GetUnitScale() ); } -void PCB_CALCULATOR_FRAME::BoardClassesUpdateData( double aUnitScale ) + +void PANEL_BOARD_CLASS::BoardClassesUpdateData( double aUnitScale ) { wxString txt; #define FMT wxT("%g") - #define NOVAL wxT("--") + #define NO_VALUE wxT("--") for( int ii = 0; ii < BRDCLASS_COUNT; ii ++ ) { // Display min tracks width if( clist[ii].m_Lines > -1.0 ) txt.Printf( FMT, clist[ii].m_Lines / aUnitScale); else - txt = NOVAL; + txt = NO_VALUE; m_gridClassesValuesDisplay->SetCellValue(0, ii, txt ); // Display min clearance if( clist[ii].m_Clearance > -1.0 ) txt.Printf( FMT, clist[ii].m_Clearance / aUnitScale); else - txt = NOVAL; + txt = NO_VALUE; m_gridClassesValuesDisplay->SetCellValue(1, ii, txt ); // Display min Via diam diff if( clist[ii].m_ViaDiamDiff > -1.0 ) txt.Printf( FMT, clist[ii].m_ViaDiamDiff / aUnitScale); else - txt = NOVAL; + txt = NO_VALUE; m_gridClassesValuesDisplay->SetCellValue(2, ii, txt ); // Display min Pad diam diff (plated) if( clist[ii].m_PadDiamDiffPlated > -1.0 ) txt.Printf( FMT, clist[ii].m_PadDiamDiffPlated / aUnitScale); else - txt = NOVAL; + txt = NO_VALUE; m_gridClassesValuesDisplay->SetCellValue(3, ii, txt ); // Display min Pad diam diff (non plated) if( clist[ii].m_PadDiamDiffNotPlated > -1.0 ) txt.Printf( FMT, clist[ii].m_PadDiamDiffNotPlated / aUnitScale); else - txt = NOVAL; + txt = NO_VALUE; m_gridClassesValuesDisplay->SetCellValue(4, ii, txt ); } -} - +} \ No newline at end of file diff --git a/pcb_calculator/pcb_calculator_frame.cpp b/pcb_calculator/pcb_calculator_frame.cpp index 9a48144752..fa44a5a345 100644 --- a/pcb_calculator/pcb_calculator_frame.cpp +++ b/pcb_calculator/pcb_calculator_frame.cpp @@ -76,8 +76,6 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : initESeriesPanel(); - BoardClassesUpdateData( m_BoardClassesUnitsSelector->GetUnitScale() ); - // Give an icon wxIcon icon; wxIconBundle icon_bundle; @@ -91,9 +89,6 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : SetIcons( icon_bundle ); - // Autosize the row label column to be sure label are not truncated - m_gridClassesValuesDisplay->SetRowLabelSize( wxGRID_AUTOSIZE ); - GetSizer()->SetSizeHints( this ); // Set previous size and position @@ -220,7 +215,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_BoardClassesUnitsSelector->SetSelection( cfg->m_BoardClassUnits ); // Attenuators panel config: m_panelAttenuators->LoadSettings( cfg ); @@ -237,6 +231,7 @@ void PCB_CALCULATOR_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) m_panelViaSize->LoadSettings( cfg ); m_panelTrackWidth->LoadSettings( cfg ); m_panelElectricalSpacing->LoadSettings( cfg ); + m_panelBoardClass->LoadSettings( cfg ); } @@ -254,7 +249,6 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) { cfg->m_LastPage = m_Notebook->GetSelection(); cfg->m_TransLine.type = m_currTransLineType; - cfg->m_BoardClassUnits = m_BoardClassesUnitsSelector->GetSelection(); m_panelRegulators->Regulators_WriteConfig( cfg ); m_panelAttenuators->SaveSettings( cfg ); @@ -262,6 +256,7 @@ void PCB_CALCULATOR_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) m_panelViaSize->SaveSettings( cfg ); m_panelTrackWidth->SaveSettings( cfg ); m_panelElectricalSpacing->SaveSettings( cfg ); + m_panelBoardClass->SaveSettings( cfg ); } diff --git a/pcb_calculator/pcb_calculator_frame.h b/pcb_calculator/pcb_calculator_frame.h index ec14c3fd6d..c3d2f453ee 100644 --- a/pcb_calculator/pcb_calculator_frame.h +++ b/pcb_calculator/pcb_calculator_frame.h @@ -79,10 +79,6 @@ public: */ bool IsPrmSelected( enum PRMS_ID aPrmId ) const; - // Board classes panel: - void OnBoardClassesUnitsSelection( wxCommandEvent& event ) override; - void BoardClassesUpdateData( double aUnitScale ); - // Calculator doesn't host a tool framework wxWindow* GetToolCanvas() const override {