Commit 58a3504c authored by Andrey Fedorushkov's avatar Andrey Fedorushkov

pcb calculator: fix localize GUI, native *nix string

parent e77af399
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)
/**
* @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;
}
/**
* @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 );
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment