pcb calculator: fix localize GUI, native *nix string
This commit is contained in:
parent
e77af399a5
commit
58a3504c5a
|
@ -1,70 +1,72 @@
|
|||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bitmaps
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dialogs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/transline
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/attenuators
|
||||
)
|
||||
|
||||
set(PCB_CALCULATOR_SRCS
|
||||
attenuators.cpp
|
||||
board_classes_values.cpp
|
||||
colorcode.cpp
|
||||
electrical_spacing_values.cpp
|
||||
params_read_write.cpp
|
||||
pcb_calculator.cpp
|
||||
pcb_calculator_frame.cpp
|
||||
regulators_funct.cpp
|
||||
tracks_width_versus_current.cpp
|
||||
transline_ident.cpp
|
||||
UnitSelector.cpp
|
||||
transline/transline.cpp
|
||||
transline/c_microstrip.cpp
|
||||
transline/microstrip.cpp
|
||||
transline/coplanar.cpp
|
||||
transline/coax.cpp
|
||||
transline/rectwaveguide.cpp
|
||||
transline/stripline.cpp
|
||||
transline/twistedpair.cpp
|
||||
transline_dlg_funct.cpp
|
||||
attenuators/attenuator_classes.cpp
|
||||
dialogs/pcb_calculator_frame_base.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
if(MINGW)
|
||||
# PCB_CALCULATOR_RESOURCES variable is set by the macro.
|
||||
mingw_resource_compiler(pcb_calculator)
|
||||
else(MINGW)
|
||||
set(PCB_CALCULATOR_RESOURCES pcb_calculator.rc)
|
||||
endif(MINGW)
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set(PCB_CALCULATOR_RESOURCES pcb_calculator.icns)
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator.icns"
|
||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
set(MACOSX_BUNDLE_ICON_FILE pcb_calculator.icns)
|
||||
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.pcb_calculator)
|
||||
endif(APPLE)
|
||||
|
||||
|
||||
|
||||
add_executable(pcb_calculator WIN32 MACOSX_BUNDLE
|
||||
${PCB_CALCULATOR_SRCS}
|
||||
${PCB_CALCULATOR_RESOURCES})
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(pcb_calculator PROPERTIES MACOSX_BUNDLE_INFO_PLIST
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
||||
endif(APPLE)
|
||||
|
||||
target_link_libraries( pcb_calculator
|
||||
${wxWidgets_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS pcb_calculator
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT binary)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/bitmaps
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dialogs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/transline
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/attenuators
|
||||
../polygon
|
||||
${CMAKE_SOURCE_DIR}/common
|
||||
)
|
||||
|
||||
set(PCB_CALCULATOR_SRCS
|
||||
attenuators.cpp
|
||||
board_classes_values.cpp
|
||||
colorcode.cpp
|
||||
electrical_spacing_values.cpp
|
||||
params_read_write.cpp
|
||||
pcb_calculator.cpp
|
||||
pcb_calculator_frame.cpp
|
||||
regulators_funct.cpp
|
||||
tracks_width_versus_current.cpp
|
||||
transline_ident.cpp
|
||||
UnitSelector.cpp
|
||||
transline/transline.cpp
|
||||
transline/c_microstrip.cpp
|
||||
transline/microstrip.cpp
|
||||
transline/coplanar.cpp
|
||||
transline/coax.cpp
|
||||
transline/rectwaveguide.cpp
|
||||
transline/stripline.cpp
|
||||
transline/twistedpair.cpp
|
||||
transline_dlg_funct.cpp
|
||||
attenuators/attenuator_classes.cpp
|
||||
dialogs/pcb_calculator_frame_base.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
if(MINGW)
|
||||
# PCB_CALCULATOR_RESOURCES variable is set by the macro.
|
||||
mingw_resource_compiler(pcb_calculator)
|
||||
else(MINGW)
|
||||
set(PCB_CALCULATOR_RESOURCES pcb_calculator.rc)
|
||||
endif(MINGW)
|
||||
endif(WIN32)
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set(PCB_CALCULATOR_RESOURCES pcb_calculator.icns)
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator.icns"
|
||||
PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
set(MACOSX_BUNDLE_ICON_FILE pcb_calculator.icns)
|
||||
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.pcb_calculator)
|
||||
endif(APPLE)
|
||||
|
||||
|
||||
|
||||
add_executable(pcb_calculator WIN32 MACOSX_BUNDLE
|
||||
${PCB_CALCULATOR_SRCS}
|
||||
${PCB_CALCULATOR_RESOURCES})
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(pcb_calculator PROPERTIES MACOSX_BUNDLE_INFO_PLIST
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Info.plist)
|
||||
endif(APPLE)
|
||||
|
||||
target_link_libraries( pcb_calculator common polygon bitmaps
|
||||
${wxWidgets_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS pcb_calculator
|
||||
DESTINATION ${KICAD_BIN}
|
||||
COMPONENT binary)
|
||||
|
||||
|
|
|
@ -1,119 +1,119 @@
|
|||
/**
|
||||
* @file UnitSelector.cpp
|
||||
* a wxChoiceBox to select units in Pcb_Calculator
|
||||
*/
|
||||
|
||||
#include "UnitSelector.h"
|
||||
#include "units_scales.h"
|
||||
|
||||
UNIT_SELECTOR_LEN::UNIT_SELECTOR_LEN(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") );
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Function GetUnitScale
|
||||
* return the scaling factor to convert users units
|
||||
* to normalized units (meter )
|
||||
*/
|
||||
double UNIT_SELECTOR_LEN::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;
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
UNIT_SELECTOR_FREQUENCY::UNIT_SELECTOR_FREQUENCY(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
const wxArrayString& choices, long style )
|
||||
: UNIT_SELECTOR( parent, id, pos, size, choices, style )
|
||||
{
|
||||
Append( _("GHz") );
|
||||
Append( _("MHz") );
|
||||
Append( _("KHz") );
|
||||
Append( _("Hz") );
|
||||
};
|
||||
|
||||
/*
|
||||
* Function GetUnitScale
|
||||
* return the scaling factor to convert users units
|
||||
* to normalized units (herz )
|
||||
*/
|
||||
double UNIT_SELECTOR_FREQUENCY::GetUnitScale()
|
||||
{
|
||||
switch( GetCurrentSelection() )
|
||||
{
|
||||
case 0: return UNIT_GHZ; break;
|
||||
case 1: return UNIT_MHZ; break;
|
||||
case 2: return UNIT_KHZ; break;
|
||||
case 3: return 1.0; break;
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
UNIT_SELECTOR_ANGLE::UNIT_SELECTOR_ANGLE(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
const wxArrayString& choices, long style )
|
||||
: UNIT_SELECTOR( parent, id, pos, size, choices, style )
|
||||
{
|
||||
Append( _("Radian") );
|
||||
Append( _("Degree") );
|
||||
};
|
||||
|
||||
/*
|
||||
* Function GetUnitScale
|
||||
* return the scaling factor to convert users units
|
||||
* to normalized units ( radian )
|
||||
*/
|
||||
double UNIT_SELECTOR_ANGLE::GetUnitScale()
|
||||
{
|
||||
switch( GetCurrentSelection() )
|
||||
{
|
||||
case 0: return UNIT_RADIAN; break;
|
||||
case 1: return UNIT_DEGREE; break;
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
UNIT_SELECTOR_RESISTOR::UNIT_SELECTOR_RESISTOR(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
const wxArrayString& choices, long style )
|
||||
: UNIT_SELECTOR( parent, id, pos, size, choices, style )
|
||||
{
|
||||
Append( _("Ohm") );
|
||||
Append( _("KOhm") );
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Function GetUnitScale
|
||||
* return the scaling factor to convert users units
|
||||
* to normalized units ( ohm )
|
||||
*/
|
||||
double UNIT_SELECTOR_RESISTOR::GetUnitScale()
|
||||
{
|
||||
switch( GetCurrentSelection() )
|
||||
{
|
||||
case 0: return UNIT_OHM; break;
|
||||
case 1: return UNIT_KOHM; break;
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @file UnitSelector.cpp
|
||||
* a wxChoiceBox to select units in Pcb_Calculator
|
||||
*/
|
||||
|
||||
#include "UnitSelector.h"
|
||||
#include "units_scales.h"
|
||||
|
||||
UNIT_SELECTOR_LEN::UNIT_SELECTOR_LEN(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") );
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Function GetUnitScale
|
||||
* return the scaling factor to convert users units
|
||||
* to normalized units (meter )
|
||||
*/
|
||||
double UNIT_SELECTOR_LEN::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;
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
UNIT_SELECTOR_FREQUENCY::UNIT_SELECTOR_FREQUENCY(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
const wxArrayString& choices, long style )
|
||||
: UNIT_SELECTOR( parent, id, pos, size, choices, style )
|
||||
{
|
||||
Append( _("GHz") );
|
||||
Append( _("MHz") );
|
||||
Append( _("KHz") );
|
||||
Append( _("Hz") );
|
||||
};
|
||||
|
||||
/*
|
||||
* Function GetUnitScale
|
||||
* return the scaling factor to convert users units
|
||||
* to normalized units (herz )
|
||||
*/
|
||||
double UNIT_SELECTOR_FREQUENCY::GetUnitScale()
|
||||
{
|
||||
switch( GetCurrentSelection() )
|
||||
{
|
||||
case 0: return UNIT_GHZ; break;
|
||||
case 1: return UNIT_MHZ; break;
|
||||
case 2: return UNIT_KHZ; break;
|
||||
case 3: return 1.0; break;
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
UNIT_SELECTOR_ANGLE::UNIT_SELECTOR_ANGLE(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
const wxArrayString& choices, long style )
|
||||
: UNIT_SELECTOR( parent, id, pos, size, choices, style )
|
||||
{
|
||||
Append( _("Radian") );
|
||||
Append( _("Degree") );
|
||||
};
|
||||
|
||||
/*
|
||||
* Function GetUnitScale
|
||||
* return the scaling factor to convert users units
|
||||
* to normalized units ( radian )
|
||||
*/
|
||||
double UNIT_SELECTOR_ANGLE::GetUnitScale()
|
||||
{
|
||||
switch( GetCurrentSelection() )
|
||||
{
|
||||
case 0: return UNIT_RADIAN; break;
|
||||
case 1: return UNIT_DEGREE; break;
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
UNIT_SELECTOR_RESISTOR::UNIT_SELECTOR_RESISTOR(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
const wxArrayString& choices, long style )
|
||||
: UNIT_SELECTOR( parent, id, pos, size, choices, style )
|
||||
{
|
||||
Append( _("Ohm") );
|
||||
Append( _("KOhm") );
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Function GetUnitScale
|
||||
* return the scaling factor to convert users units
|
||||
* to normalized units ( ohm )
|
||||
*/
|
||||
double UNIT_SELECTOR_RESISTOR::GetUnitScale()
|
||||
{
|
||||
switch( GetCurrentSelection() )
|
||||
{
|
||||
case 0: return UNIT_OHM; break;
|
||||
case 1: return UNIT_KOHM; break;
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,97 +1,97 @@
|
|||
/**
|
||||
* @file UnitSelector.h
|
||||
* a wxChoiceBox to select units in Pcb_Calculator
|
||||
*/
|
||||
|
||||
#ifndef _UnitSelector_h_
|
||||
#define _UnitSelector_h_
|
||||
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/choice.h>
|
||||
|
||||
|
||||
class UNIT_SELECTOR: public wxChoice
|
||||
{
|
||||
public:
|
||||
UNIT_SELECTOR(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
const wxArrayString& choices, long style = 0 ):
|
||||
wxChoice( parent, id, pos, size, choices, style )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetUnitScale
|
||||
* @return the scaling factor to convert users units
|
||||
* to normalized units (meter, herz, ohm, radian )
|
||||
*/
|
||||
virtual double GetUnitScale() = 0;
|
||||
|
||||
wxString GetUnitName()
|
||||
{
|
||||
return GetStringSelection();
|
||||
}
|
||||
};
|
||||
|
||||
class UNIT_SELECTOR_LEN: public UNIT_SELECTOR
|
||||
{
|
||||
public:
|
||||
UNIT_SELECTOR_LEN(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)
|
||||
*/
|
||||
virtual double GetUnitScale();
|
||||
};
|
||||
|
||||
class UNIT_SELECTOR_FREQUENCY: public UNIT_SELECTOR
|
||||
{
|
||||
public:
|
||||
UNIT_SELECTOR_FREQUENCY(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 (Hz)
|
||||
*/
|
||||
virtual double GetUnitScale();
|
||||
};
|
||||
|
||||
class UNIT_SELECTOR_ANGLE: public UNIT_SELECTOR
|
||||
{
|
||||
public:
|
||||
UNIT_SELECTOR_ANGLE(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 (Hz)
|
||||
*/
|
||||
virtual double GetUnitScale();
|
||||
};
|
||||
|
||||
class UNIT_SELECTOR_RESISTOR: public UNIT_SELECTOR
|
||||
{
|
||||
public:
|
||||
UNIT_SELECTOR_RESISTOR(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 (Hz)
|
||||
*/
|
||||
virtual double GetUnitScale();
|
||||
};
|
||||
#endif // _UnitSelector_h_
|
||||
|
||||
/**
|
||||
* @file UnitSelector.h
|
||||
* a wxChoiceBox to select units in Pcb_Calculator
|
||||
*/
|
||||
|
||||
#ifndef _UnitSelector_h_
|
||||
#define _UnitSelector_h_
|
||||
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/choice.h>
|
||||
|
||||
|
||||
class UNIT_SELECTOR: public wxChoice
|
||||
{
|
||||
public:
|
||||
UNIT_SELECTOR(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
const wxArrayString& choices, long style = 0 ):
|
||||
wxChoice( parent, id, pos, size, choices, style )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetUnitScale
|
||||
* @return the scaling factor to convert users units
|
||||
* to normalized units (meter, herz, ohm, radian )
|
||||
*/
|
||||
virtual double GetUnitScale() = 0;
|
||||
|
||||
wxString GetUnitName()
|
||||
{
|
||||
return GetStringSelection();
|
||||
}
|
||||
};
|
||||
|
||||
class UNIT_SELECTOR_LEN: public UNIT_SELECTOR
|
||||
{
|
||||
public:
|
||||
UNIT_SELECTOR_LEN(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)
|
||||
*/
|
||||
virtual double GetUnitScale();
|
||||
};
|
||||
|
||||
class UNIT_SELECTOR_FREQUENCY: public UNIT_SELECTOR
|
||||
{
|
||||
public:
|
||||
UNIT_SELECTOR_FREQUENCY(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 (Hz)
|
||||
*/
|
||||
virtual double GetUnitScale();
|
||||
};
|
||||
|
||||
class UNIT_SELECTOR_ANGLE: public UNIT_SELECTOR
|
||||
{
|
||||
public:
|
||||
UNIT_SELECTOR_ANGLE(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 (Hz)
|
||||
*/
|
||||
virtual double GetUnitScale();
|
||||
};
|
||||
|
||||
class UNIT_SELECTOR_RESISTOR: public UNIT_SELECTOR
|
||||
{
|
||||
public:
|
||||
UNIT_SELECTOR_RESISTOR(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 (Hz)
|
||||
*/
|
||||
virtual double GetUnitScale();
|
||||
};
|
||||
#endif // _UnitSelector_h_
|
||||
|
||||
|
|
|
@ -21,31 +21,40 @@
|
|||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include "fctsys.h"
|
||||
#include "appl_wxstruct.h"
|
||||
#include "wxstruct.h"
|
||||
#include "common.h"
|
||||
#include "confirm.h"
|
||||
#include "gestfich.h"
|
||||
|
||||
#include "wx/wx.h"
|
||||
#include "wx/config.h"
|
||||
|
||||
#include "pcb_calculator_frame_base.h"
|
||||
#include "pcb_calculator.h"
|
||||
|
||||
#include "bitmaps.h"
|
||||
#include "colors_selection.h"
|
||||
#include "build_version.h"
|
||||
|
||||
// PCB_CALCULATOR_APP
|
||||
|
||||
class PCB_CALCULATOR_APP : public wxApp
|
||||
void WinEDA_App::MacOpenFile(const wxString &fileName)
|
||||
{
|
||||
public:
|
||||
virtual bool OnInit();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
IMPLEMENT_APP( PCB_CALCULATOR_APP )
|
||||
IMPLEMENT_APP( WinEDA_App )
|
||||
|
||||
///-----------------------------------------------------------------------------
|
||||
// PCB_CALCULATOR_APP
|
||||
// main program
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool PCB_CALCULATOR_APP::OnInit()
|
||||
bool WinEDA_App::OnInit()
|
||||
{
|
||||
SetVendorName( wxT( "kicad" ) );
|
||||
|
||||
InitEDA_Appl( wxT( "PCBcalc" ) );
|
||||
|
||||
wxFrame* frame = new PCB_CALCULATOR_FRAME( NULL );
|
||||
SetTopWindow( frame );
|
||||
|
|
|
@ -1,195 +1,195 @@
|
|||
/**
|
||||
* @file pcb_calculator.h
|
||||
*/
|
||||
|
||||
#ifndef PCB_CALCULATOR_H
|
||||
#define PCB_CALCULATOR_H
|
||||
|
||||
#include "pcb_calculator_frame_base.h"
|
||||
|
||||
#include "transline.h" // Included for SUBST_PRMS_ID definition.
|
||||
#include "transline_ident.h"
|
||||
#include "attenuator_classes.h"
|
||||
|
||||
/* Class PCB_CALCULATOR_FRAME_BASE
|
||||
This is the main frame for this application
|
||||
*/
|
||||
class PCB_CALCULATOR_FRAME : public PCB_CALCULATOR_FRAME_BASE
|
||||
{
|
||||
private:
|
||||
wxSize m_FrameSize;
|
||||
wxPoint m_FramePos;
|
||||
wxConfig * m_Config;
|
||||
enum transline_type_id m_currTransLineType;
|
||||
TRANSLINE * m_currTransLine; // a pointer to the active transline
|
||||
// List of translines: ordered like in dialog menu list
|
||||
std::vector <TRANSLINE_IDENT *> m_transline_list;
|
||||
ATTENUATOR * m_currAttenuator;
|
||||
// List ofattenuators: ordered like in dialog menu list
|
||||
std::vector <ATTENUATOR *> m_attenuator_list;
|
||||
|
||||
|
||||
public:
|
||||
PCB_CALCULATOR_FRAME( wxWindow * parent = NULL );
|
||||
~PCB_CALCULATOR_FRAME();
|
||||
|
||||
private:
|
||||
|
||||
// Event handlers
|
||||
// These 3 functions are called by the OnPaint event, to draw
|
||||
// icons that show the current item on the specific panels
|
||||
void OnPaintTranslinePanel( wxPaintEvent& event );
|
||||
void OnPaintAttenuatorPanel( wxPaintEvent& event );
|
||||
void OnPaintAttFormulaPanel( wxPaintEvent& event );
|
||||
|
||||
// Config read-write
|
||||
void ReadConfig();
|
||||
void WriteConfig();
|
||||
|
||||
// tracks width versus current functions:
|
||||
/**
|
||||
* Function OnTWCalculateButt
|
||||
* Called by clicking on the calculate button
|
||||
*/
|
||||
void OnTWCalculateButt( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function TW_Init
|
||||
* Read config and init dialog widgets values
|
||||
*/
|
||||
void TW_Init();
|
||||
|
||||
/**
|
||||
* Function TW_WriteConfig
|
||||
* Write Track width prameters in config
|
||||
*/
|
||||
void TW_WriteConfig();
|
||||
|
||||
/**
|
||||
* Function TWCalculate
|
||||
* Performs track caracteristics values calculations.
|
||||
*/
|
||||
double TWCalculate( double aCurrent, double aThickness, double aDeltaT_C,
|
||||
bool aUseInternalLayer );
|
||||
|
||||
// Electrical spacing panel:
|
||||
void OnElectricalSpacingUnitsSelection( wxCommandEvent& event );
|
||||
void OnElectricalSpacingRefresh( wxCommandEvent& event );
|
||||
void ElectricalSpacingUpdateData( double aUnitScale );
|
||||
|
||||
// Transline functions:
|
||||
/**
|
||||
* Function OnTranslineSelection
|
||||
* Called on new transmission line selection
|
||||
*/
|
||||
void OnTranslineSelection( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnTranslineAnalyse
|
||||
* Run a new analyse for the current transline with current parameters
|
||||
* and displays the electrical parmeters
|
||||
*/
|
||||
void OnTranslineAnalyse( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnTranslineSynthetize
|
||||
* Run a new synthezis for the current transline with current parameters
|
||||
* and displays the geometrical parmeters
|
||||
*/
|
||||
void OnTranslineSynthetize( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnTranslineEpsilonR_Button
|
||||
* Shows a list of current relative dielectric constant(Er)
|
||||
* and set the selected value in main dialog frame
|
||||
*/
|
||||
void OnTranslineEpsilonR_Button( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnTranslineTanD_Button
|
||||
* Shows a list of current dielectric loss factor (tangent delta)
|
||||
* and set the selected value in main dialog frame
|
||||
*/
|
||||
void OnTranslineTanD_Button( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnTranslineRho_Button
|
||||
* Shows a list of current Specific resistance list (rho)
|
||||
* and set the selected value in main dialog frame
|
||||
*/
|
||||
void OnTranslineRho_Button( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function TranslineTypeSelection
|
||||
* Must be called after selection of a new transline.
|
||||
* Update all values, labels and tool tips of parameters needed
|
||||
* by the new transline
|
||||
* Irrelevant parameters texts are blanked.
|
||||
* @param aType = the transline_type_id of the new selected transline
|
||||
*/
|
||||
void TranslineTypeSelection( enum transline_type_id aType );
|
||||
|
||||
/**
|
||||
* Function TransfDlgDataToTranslineParams
|
||||
* Read values entered in dialog frame, and transfert these
|
||||
* values in current transline parameters, converted in normalized units
|
||||
*/
|
||||
void TransfDlgDataToTranslineParams();
|
||||
|
||||
// Color Code panel
|
||||
void OnToleranceSelection( wxCommandEvent& event );
|
||||
void ToleranceSelection( int aSelection );
|
||||
|
||||
// Attenuators Panel
|
||||
void OnAttenuatorSelection( wxCommandEvent& event );
|
||||
void SetAttenuator( unsigned aIdx );
|
||||
void OnCalculateAttenuator( wxCommandEvent& event );
|
||||
void TransfPanelDataToAttenuator();
|
||||
void TransfAttenuatorDataToPanel();
|
||||
void TransfAttenuatorResultsToPanel();
|
||||
|
||||
// Regulators Panel
|
||||
void OnRegulatorCalcButtonClick( wxCommandEvent& event );
|
||||
void RegulatorsSolve();
|
||||
|
||||
public:
|
||||
// Read/write params values and results
|
||||
|
||||
/**
|
||||
* Function SetPrmValue
|
||||
* Read/write params values and results
|
||||
* @param aPrmId = param id to write
|
||||
* @param aValue = valmue to write
|
||||
*/
|
||||
void SetPrmValue( enum PRMS_ID aPrmId, double aValue );
|
||||
|
||||
/**
|
||||
* Function SetResult
|
||||
* Puts the text into the given result line.
|
||||
* @param aLineNumber = the line (0 to 5) wher to display the text
|
||||
* @param aText = the text to display
|
||||
*/
|
||||
void SetResult( int aLineNumber, const wxString & aText );
|
||||
|
||||
/**
|
||||
* Function GetPrmValue
|
||||
* Returns a param value.
|
||||
* @param aPrmId = param id to write
|
||||
* @return the value always in normalized unit (meter, Hz, Ohm, radian)
|
||||
*/
|
||||
double GetPrmValue( enum PRMS_ID aPrmId );
|
||||
|
||||
/**
|
||||
* Function IsPrmSelected
|
||||
* @return true if the param aPrmId is selected
|
||||
* Has meaning only for params that have a radio button
|
||||
*/
|
||||
bool IsPrmSelected( enum PRMS_ID aPrmId );
|
||||
|
||||
// Board classes panel:
|
||||
void OnBoardClassesUnitsSelection( wxCommandEvent& event );
|
||||
void BoardClassesUpdateData( double aUnitScale );
|
||||
|
||||
};
|
||||
|
||||
#endif // PCB_CALCULATOR_H
|
||||
/**
|
||||
* @file pcb_calculator.h
|
||||
*/
|
||||
|
||||
#ifndef PCB_CALCULATOR_H
|
||||
#define PCB_CALCULATOR_H
|
||||
|
||||
#include "pcb_calculator_frame_base.h"
|
||||
|
||||
#include "transline.h" // Included for SUBST_PRMS_ID definition.
|
||||
#include "transline_ident.h"
|
||||
#include "attenuator_classes.h"
|
||||
|
||||
/* Class PCB_CALCULATOR_FRAME_BASE
|
||||
This is the main frame for this application
|
||||
*/
|
||||
class PCB_CALCULATOR_FRAME : public PCB_CALCULATOR_FRAME_BASE
|
||||
{
|
||||
private:
|
||||
wxSize m_FrameSize;
|
||||
wxPoint m_FramePos;
|
||||
wxConfig * m_Config;
|
||||
enum transline_type_id m_currTransLineType;
|
||||
TRANSLINE * m_currTransLine; // a pointer to the active transline
|
||||
// List of translines: ordered like in dialog menu list
|
||||
std::vector <TRANSLINE_IDENT *> m_transline_list;
|
||||
ATTENUATOR * m_currAttenuator;
|
||||
// List ofattenuators: ordered like in dialog menu list
|
||||
std::vector <ATTENUATOR *> m_attenuator_list;
|
||||
|
||||
|
||||
public:
|
||||
PCB_CALCULATOR_FRAME( wxWindow * parent = NULL );
|
||||
~PCB_CALCULATOR_FRAME();
|
||||
|
||||
private:
|
||||
|
||||
// Event handlers
|
||||
// These 3 functions are called by the OnPaint event, to draw
|
||||
// icons that show the current item on the specific panels
|
||||
void OnPaintTranslinePanel( wxPaintEvent& event );
|
||||
void OnPaintAttenuatorPanel( wxPaintEvent& event );
|
||||
void OnPaintAttFormulaPanel( wxPaintEvent& event );
|
||||
|
||||
// Config read-write
|
||||
void ReadConfig();
|
||||
void WriteConfig();
|
||||
|
||||
// tracks width versus current functions:
|
||||
/**
|
||||
* Function OnTWCalculateButt
|
||||
* Called by clicking on the calculate button
|
||||
*/
|
||||
void OnTWCalculateButt( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function TW_Init
|
||||
* Read config and init dialog widgets values
|
||||
*/
|
||||
void TW_Init();
|
||||
|
||||
/**
|
||||
* Function TW_WriteConfig
|
||||
* Write Track width prameters in config
|
||||
*/
|
||||
void TW_WriteConfig();
|
||||
|
||||
/**
|
||||
* Function TWCalculate
|
||||
* Performs track caracteristics values calculations.
|
||||
*/
|
||||
double TWCalculate( double aCurrent, double aThickness, double aDeltaT_C,
|
||||
bool aUseInternalLayer );
|
||||
|
||||
// Electrical spacing panel:
|
||||
void OnElectricalSpacingUnitsSelection( wxCommandEvent& event );
|
||||
void OnElectricalSpacingRefresh( wxCommandEvent& event );
|
||||
void ElectricalSpacingUpdateData( double aUnitScale );
|
||||
|
||||
// Transline functions:
|
||||
/**
|
||||
* Function OnTranslineSelection
|
||||
* Called on new transmission line selection
|
||||
*/
|
||||
void OnTranslineSelection( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnTranslineAnalyse
|
||||
* Run a new analyse for the current transline with current parameters
|
||||
* and displays the electrical parmeters
|
||||
*/
|
||||
void OnTranslineAnalyse( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnTranslineSynthetize
|
||||
* Run a new synthezis for the current transline with current parameters
|
||||
* and displays the geometrical parmeters
|
||||
*/
|
||||
void OnTranslineSynthetize( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnTranslineEpsilonR_Button
|
||||
* Shows a list of current relative dielectric constant(Er)
|
||||
* and set the selected value in main dialog frame
|
||||
*/
|
||||
void OnTranslineEpsilonR_Button( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnTranslineTanD_Button
|
||||
* Shows a list of current dielectric loss factor (tangent delta)
|
||||
* and set the selected value in main dialog frame
|
||||
*/
|
||||
void OnTranslineTanD_Button( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnTranslineRho_Button
|
||||
* Shows a list of current Specific resistance list (rho)
|
||||
* and set the selected value in main dialog frame
|
||||
*/
|
||||
void OnTranslineRho_Button( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function TranslineTypeSelection
|
||||
* Must be called after selection of a new transline.
|
||||
* Update all values, labels and tool tips of parameters needed
|
||||
* by the new transline
|
||||
* Irrelevant parameters texts are blanked.
|
||||
* @param aType = the transline_type_id of the new selected transline
|
||||
*/
|
||||
void TranslineTypeSelection( enum transline_type_id aType );
|
||||
|
||||
/**
|
||||
* Function TransfDlgDataToTranslineParams
|
||||
* Read values entered in dialog frame, and transfert these
|
||||
* values in current transline parameters, converted in normalized units
|
||||
*/
|
||||
void TransfDlgDataToTranslineParams();
|
||||
|
||||
// Color Code panel
|
||||
void OnToleranceSelection( wxCommandEvent& event );
|
||||
void ToleranceSelection( int aSelection );
|
||||
|
||||
// Attenuators Panel
|
||||
void OnAttenuatorSelection( wxCommandEvent& event );
|
||||
void SetAttenuator( unsigned aIdx );
|
||||
void OnCalculateAttenuator( wxCommandEvent& event );
|
||||
void TransfPanelDataToAttenuator();
|
||||
void TransfAttenuatorDataToPanel();
|
||||
void TransfAttenuatorResultsToPanel();
|
||||
|
||||
// Regulators Panel
|
||||
void OnRegulatorCalcButtonClick( wxCommandEvent& event );
|
||||
void RegulatorsSolve();
|
||||
|
||||
public:
|
||||
// Read/write params values and results
|
||||
|
||||
/**
|
||||
* Function SetPrmValue
|
||||
* Read/write params values and results
|
||||
* @param aPrmId = param id to write
|
||||
* @param aValue = valmue to write
|
||||
*/
|
||||
void SetPrmValue( enum PRMS_ID aPrmId, double aValue );
|
||||
|
||||
/**
|
||||
* Function SetResult
|
||||
* Puts the text into the given result line.
|
||||
* @param aLineNumber = the line (0 to 5) wher to display the text
|
||||
* @param aText = the text to display
|
||||
*/
|
||||
void SetResult( int aLineNumber, const wxString & aText );
|
||||
|
||||
/**
|
||||
* Function GetPrmValue
|
||||
* Returns a param value.
|
||||
* @param aPrmId = param id to write
|
||||
* @return the value always in normalized unit (meter, Hz, Ohm, radian)
|
||||
*/
|
||||
double GetPrmValue( enum PRMS_ID aPrmId );
|
||||
|
||||
/**
|
||||
* Function IsPrmSelected
|
||||
* @return true if the param aPrmId is selected
|
||||
* Has meaning only for params that have a radio button
|
||||
*/
|
||||
bool IsPrmSelected( enum PRMS_ID aPrmId );
|
||||
|
||||
// Board classes panel:
|
||||
void OnBoardClassesUnitsSelection( wxCommandEvent& event );
|
||||
void BoardClassesUpdateData( double aUnitScale );
|
||||
|
||||
};
|
||||
|
||||
#endif // PCB_CALCULATOR_H
|
||||
|
|
Loading…
Reference in New Issue