Add a new dropdown type that has oz/ft^2 for the pcb track width calculator.

This commit is contained in:
Jon Neal 2016-01-05 19:04:45 -05:00 committed by Wayne Stambaugh
parent 89cfef99c1
commit 89c183f041
6 changed files with 63 additions and 12 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011-2014 Jean-Pierre Charras
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 KiCad Developers, see change_log.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
@ -62,6 +62,40 @@ double UNIT_SELECTOR_LEN::GetUnitScale()
}
UNIT_SELECTOR_THICKNESS::UNIT_SELECTOR_THICKNESS( wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices, long style )
: UNIT_SELECTOR( parent, id, pos, size, choices, style )
{
Append( _( "mm" ) );
Append( _( "um" ) );
Append( _( "cm" ) );
Append( _( "mil" ) );
Append( _( "inch" ) );
Append( _( "oz/ft^2" ) );
};
/*
* Function GetUnitScale
* return the scaling factor to convert users units
* to normalized units (meter) including copper oz/ft^2
*/
double UNIT_SELECTOR_THICKNESS::GetUnitScale()
{
switch( GetCurrentSelection() )
{
case 0: return UNIT_MM; break;
case 1: return UNIT_MICRON; break;
case 2: return UNIT_CM; break;
case 3: return UNIT_MIL; break;
case 4: return UNIT_INCH; break;
case 5: return UNIT_OZSQFT; break;
}
return 1.0;
}
UNIT_SELECTOR_FREQUENCY::UNIT_SELECTOR_FREQUENCY( wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices, long style ):

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011-2014 Jean-Pierre Charras
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 KiCad Developers, see change_log.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
@ -73,6 +73,21 @@ public:
virtual double GetUnitScale();
};
class UNIT_SELECTOR_THICKNESS: public UNIT_SELECTOR
{
public:
UNIT_SELECTOR_THICKNESS( wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices, long style = 0 );
/**
* Function GetUnitScale
* @return the scaling factor to convert users units
* to normalized units (meter) including oz/ft^2
*/
virtual double GetUnitScale();
};
class UNIT_SELECTOR_FREQUENCY: public UNIT_SELECTOR
{
public:

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Aug 23 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -362,7 +362,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerTW_Results->Add( m_ExtTrackThicknessValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
wxArrayString m_ExtTrackThicknessUnitChoices;
m_ExtTrackThicknessUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ExtTrackThicknessUnitChoices, 0 );
m_ExtTrackThicknessUnit = new UNIT_SELECTOR_THICKNESS( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ExtTrackThicknessUnitChoices, 0 );
m_ExtTrackThicknessUnit->SetSelection( 0 );
fgSizerTW_Results->Add( m_ExtTrackThicknessUnit, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
@ -451,7 +451,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerTW_Results1->Add( m_IntTrackThicknessValue, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
wxArrayString m_IntTrackThicknessUnitChoices;
m_IntTrackThicknessUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_IntTrackThicknessUnitChoices, 0 );
m_IntTrackThicknessUnit = new UNIT_SELECTOR_THICKNESS( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_IntTrackThicknessUnitChoices, 0 );
m_IntTrackThicknessUnit->SetSelection( 0 );
fgSizerTW_Results1->Add( m_IntTrackThicknessUnit, 0, wxALL, 5 );

View File

@ -5032,7 +5032,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">UNIT_SELECTOR_LEN; UnitSelector.h</property>
<property name="subclass">UNIT_SELECTOR_THICKNESS; UnitSelector.h</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@ -6584,7 +6584,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">UNIT_SELECTOR_LEN; UnitSelector.h</property>
<property name="subclass">UNIT_SELECTOR_THICKNESS; UnitSelector.h</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Aug 23 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -16,6 +16,7 @@ class UNIT_SELECTOR_ANGLE;
class UNIT_SELECTOR_FREQUENCY;
class UNIT_SELECTOR_LEN;
class UNIT_SELECTOR_RESISTOR;
class UNIT_SELECTOR_THICKNESS;
#include "kiway_player.h"
#include <wx/string.h>
@ -110,7 +111,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
UNIT_SELECTOR_LEN* m_TW_ExtTrackWidth_choiceUnit;
wxStaticText* m_staticText65;
wxTextCtrl* m_ExtTrackThicknessValue;
UNIT_SELECTOR_LEN* m_ExtTrackThicknessUnit;
UNIT_SELECTOR_THICKNESS* m_ExtTrackThicknessUnit;
wxStaticText* m_staticTextArea;
wxStaticText* m_ExtTrackAreaValue;
wxStaticText* m_ExtTrackAreaUnitLabel;
@ -128,7 +129,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
UNIT_SELECTOR_LEN* m_TW_IntTrackWidth_choiceUnit;
wxStaticText* m_staticText652;
wxTextCtrl* m_IntTrackThicknessValue;
UNIT_SELECTOR_LEN* m_IntTrackThicknessUnit;
UNIT_SELECTOR_THICKNESS* m_IntTrackThicknessUnit;
wxStaticText* m_staticTextArea1;
wxStaticText* m_IntTrackAreaValue;
wxStaticText* m_IntTrackAreaUnitLabel;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011-2014 Jean-Pierre Charras
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 KiCad Developers, see change_log.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
@ -37,6 +37,7 @@
#define UNIT_MICRON 1e-6 // um to meter
#define UNIT_INCH (1e-2*2.54) // inch to meter
#define UNIT_MIL (1e-5*2.54) // mil (or thou) to meter
#define UNIT_OZSQFT (34.40*UNIT_MICRON) // 1 oz/ft^2 is 34.30 microns nominal, 30.90 minimum
#define UNIT_GHZ 1e9
#define UNIT_MHZ 1e6