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