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} 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)
/** /**
* @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;
} }
/** /**
* @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 @@ ...@@ -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( PCB_CALCULATOR_APP ) IMPLEMENT_APP( WinEDA_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 );
......
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