Commit aef92a34 authored by Miguel Angel Ajo's avatar Miguel Angel Ajo

Merged to testing, needs some fixes

parents 42fad8a7 a9d1f478
...@@ -362,9 +362,9 @@ void EDA_3D_FRAME::Set3DBgColor() ...@@ -362,9 +362,9 @@ void EDA_3D_FRAME::Set3DBgColor()
S3D_Color color; S3D_Color color;
wxColour newcolor, oldcolor; wxColour newcolor, oldcolor;
oldcolor.Set( wxRound( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ), oldcolor.Set( KiROUND( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),
wxRound( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ), KiROUND( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ),
wxRound( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) ); KiROUND( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) );
newcolor = wxGetColourFromUser( this, oldcolor ); newcolor = wxGetColourFromUser( this, oldcolor );
......
...@@ -23,8 +23,6 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) ...@@ -23,8 +23,6 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
option(USE_PCBNEW_SEXPR_FILE_FORMAT option(USE_PCBNEW_SEXPR_FILE_FORMAT
"Use s-expression Pcbnew file format support (default OFF)." ) "Use s-expression Pcbnew file format support (default OFF)." )
option(USE_NEW_PCBNEW_LOAD "use new plugin support for legacy file format" ON)
option(USE_NEW_PCBNEW_SAVE "use new plugin support for legacy file format" ON)
option(USE_PCBNEW_NANOMETRES option(USE_PCBNEW_NANOMETRES
"Use nanometers for Pcbnew internal units instead of deci-mils (default OFF).") "Use nanometers for Pcbnew internal units instead of deci-mils (default OFF).")
......
...@@ -55,8 +55,6 @@ ...@@ -55,8 +55,6 @@
#cmakedefine USE_IMAGES_IN_MENUS 1 #cmakedefine USE_IMAGES_IN_MENUS 1
#cmakedefine USE_NEW_PCBNEW_LOAD
#cmakedefine USE_NEW_PCBNEW_SAVE
#cmakedefine USE_PCBNEW_NANOMETRES #cmakedefine USE_PCBNEW_NANOMETRES
#cmakedefine USE_PCBNEW_SEXPR_FILE_FORMAT #cmakedefine USE_PCBNEW_SEXPR_FILE_FORMAT
......
...@@ -62,16 +62,11 @@ Dick's Peronal TODO Items (Last Update: 5-April-2012) ...@@ -62,16 +62,11 @@ Dick's Peronal TODO Items (Last Update: 5-April-2012)
*) a BOARD is a fully self contained document description. *) a BOARD is a fully self contained document description.
*) plugin developers do not have to access globals, since a plugin could *) plugin developers do not have to access globals, since a plugin could
very well be a dynamically loaded DLL/DSO. very well be a dynamically loaded DLL/DSO.
A problem remain with BASE_SCREEN One final problem remains with BASE_SCREEN's grid origin, easy solution is to
move just that one field into the BOARD.
2) Extend PLUGIN API to facillitate loading and saving of modules. 2) Do an EAGLE XML import PCBNEW PLUGIN, and possibly add export support to it.
3) Switch to PLUGIN, kill off ioascii.cpp and item_io.cpp, deleting them.
4) Check back with Vladimir about finishing the nanometer work.
5) Do an EAGLE XML import PCBNEW PLUGIN, and possibly add export support to it.
This is PLUGIN::Load() and maybe PLUGIN::Save(). This is PLUGIN::Load() and maybe PLUGIN::Save().
6) Get back to the SWEET work. 3) Get back to the SWEET work.
...@@ -116,21 +116,13 @@ set(PCB_COMMON_SRCS ...@@ -116,21 +116,13 @@ set(PCB_COMMON_SRCS
../pcbnew/collectors.cpp ../pcbnew/collectors.cpp
../pcbnew/sel_layer.cpp ../pcbnew/sel_layer.cpp
../pcbnew/pcb_plot_params.cpp ../pcbnew/pcb_plot_params.cpp
../pcbnew/io_mgr.cpp
../pcbnew/legacy_plugin.cpp
../pcbnew/kicad_plugin.cpp
pcb_plot_params_keywords.cpp pcb_plot_params_keywords.cpp
dialogs/dialog_page_settings.cpp dialogs/dialog_page_settings.cpp
) )
if( USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE )
set( PCB_COMMON_SRCS
${PCB_COMMON_SRCS}
../pcbnew/item_io.cpp
../pcbnew/io_mgr.cpp
../pcbnew/legacy_plugin.cpp
../pcbnew/kicad_plugin.cpp
)
else()
set( PCB_COMMON_SRCS ${PCB_COMMON_SRCS} ../pcbnew/item_io.cpp )
endif()
# add -DPCBNEW to compilation of these PCBNEW sources # add -DPCBNEW to compilation of these PCBNEW sources
set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <base_struct.h> #include <base_struct.h>
#include <class_base_screen.h> #include <class_base_screen.h>
#include <id.h> #include <id.h>
#include <base_units.h>
#define CURSOR_SIZE 12 /// size of the cross cursor. #define CURSOR_SIZE 12 /// size of the cross cursor.
...@@ -86,12 +87,6 @@ void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeIU ) ...@@ -86,12 +87,6 @@ void BASE_SCREEN::InitDataPoints( const wxSize& aPageSizeIU )
} }
int BASE_SCREEN::GetInternalUnits( void )
{
return EESCHEMA_INTERNAL_UNIT;
}
double BASE_SCREEN::GetScalingFactor() const double BASE_SCREEN::GetScalingFactor() const
{ {
double scale = 1.0 / GetZoom(); double scale = 1.0 / GetZoom();
...@@ -99,7 +94,7 @@ double BASE_SCREEN::GetScalingFactor() const ...@@ -99,7 +94,7 @@ double BASE_SCREEN::GetScalingFactor() const
} }
void BASE_SCREEN::SetScalingFactor(double aScale ) void BASE_SCREEN::SetScalingFactor( double aScale )
{ {
double zoom = aScale; double zoom = aScale;
...@@ -116,15 +111,6 @@ void BASE_SCREEN::SetScalingFactor(double aScale ) ...@@ -116,15 +111,6 @@ void BASE_SCREEN::SetScalingFactor(double aScale )
} }
void BASE_SCREEN::SetZoomList( const wxArrayDouble& zoomlist )
{
if( !m_ZoomList.IsEmpty() )
m_ZoomList.Empty();
m_ZoomList = zoomlist;
}
bool BASE_SCREEN::SetFirstZoom() bool BASE_SCREEN::SetFirstZoom()
{ {
if( m_ZoomList.IsEmpty() ) if( m_ZoomList.IsEmpty() )
...@@ -164,12 +150,10 @@ bool BASE_SCREEN::SetZoom( double coeff ) ...@@ -164,12 +150,10 @@ bool BASE_SCREEN::SetZoom( double coeff )
bool BASE_SCREEN::SetNextZoom() bool BASE_SCREEN::SetNextZoom()
{ {
size_t i;
if( m_ZoomList.IsEmpty() || m_Zoom >= m_ZoomList.Last() ) if( m_ZoomList.IsEmpty() || m_Zoom >= m_ZoomList.Last() )
return false; return false;
for( i = 0; i < m_ZoomList.GetCount(); i++ ) for( unsigned i = 0; i < m_ZoomList.GetCount(); i++ )
{ {
if( m_Zoom < m_ZoomList[i] ) if( m_Zoom < m_ZoomList[i] )
{ {
...@@ -320,30 +304,14 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id ) ...@@ -320,30 +304,14 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id )
void BASE_SCREEN::AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id )
{ {
double x, y;
wxRealPoint new_size; wxRealPoint new_size;
GRID_TYPE new_grid; GRID_TYPE new_grid;
switch( aUnit ) new_size.x = From_User_Unit( aUnit, size.x );
{ new_size.y = From_User_Unit( aUnit, size.y );
case MILLIMETRES:
x = size.x / 25.4;
y = size.y / 25.4;
break;
default:
case INCHES:
case UNSCALED_UNITS:
x = size.x;
y = size.y;
break;
}
new_size.x = x * GetInternalUnits();
new_size.y = y * GetInternalUnits();
new_grid.m_Id = id; new_grid.m_Id = id;
new_grid.m_Size = new_size; new_grid.m_Size = new_size;
AddGrid( new_grid ); AddGrid( new_grid );
} }
...@@ -394,12 +362,12 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoi ...@@ -394,12 +362,12 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoi
wxPoint gridOrigin = m_GridOrigin; wxPoint gridOrigin = m_GridOrigin;
double offset = fmod( gridOrigin.x, gridSize.x ); double offset = fmod( gridOrigin.x, gridSize.x );
int x = wxRound( (aPosition.x - offset) / gridSize.x ); int x = KiROUND( (aPosition.x - offset) / gridSize.x );
pt.x = wxRound( x * gridSize.x + offset ); pt.x = KiROUND( x * gridSize.x + offset );
offset = fmod( gridOrigin.y, gridSize.y ); offset = fmod( gridOrigin.y, gridSize.y );
int y = wxRound( (aPosition.y - offset) / gridSize.y ); int y = KiROUND( (aPosition.y - offset) / gridSize.y );
pt.y = wxRound ( y * gridSize.y + offset ); pt.y = KiROUND ( y * gridSize.y + offset );
return pt; return pt;
} }
...@@ -419,8 +387,8 @@ wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const ...@@ -419,8 +387,8 @@ wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const
wxPoint pos = m_crossHairPosition - m_DrawOrg; wxPoint pos = m_crossHairPosition - m_DrawOrg;
double scalar = GetScalingFactor(); double scalar = GetScalingFactor();
pos.x = wxRound( (double) pos.x * scalar ); pos.x = KiROUND( (double) pos.x * scalar );
pos.y = wxRound( (double) pos.y * scalar ); pos.y = KiROUND( (double) pos.y * scalar );
return pos; return pos;
} }
......
...@@ -344,11 +344,11 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const ...@@ -344,11 +344,11 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
// calculate the left common area coordinate: // calculate the left common area coordinate:
int left = MAX( me.m_Pos.x, rect.m_Pos.x ); int left = MAX( me.m_Pos.x, rect.m_Pos.x );
// calculate the right common area coordinate: // calculate the right common area coordinate:
int right = MIN( me.m_Pos.x + m_Size.x, rect.m_Pos.x + rect.m_Size.x ); int right = MIN( me.m_Pos.x + me.m_Size.x, rect.m_Pos.x + rect.m_Size.x );
// calculate the upper common area coordinate: // calculate the upper common area coordinate:
int top = MAX( me.m_Pos.y, aRect.m_Pos.y ); int top = MAX( me.m_Pos.y, aRect.m_Pos.y );
// calculate the lower common area coordinate: // calculate the lower common area coordinate:
int bottom = MIN( me.m_Pos.y + m_Size.y, rect.m_Pos.y + rect.m_Size.y ); int bottom = MIN( me.m_Pos.y + me.m_Size.y, rect.m_Pos.y + rect.m_Size.y );
// if a common area exists, it must have a positive (null accepted) size // if a common area exists, it must have a positive (null accepted) size
if( left <= right && top <= bottom ) if( left <= right && top <= bottom )
......
...@@ -44,13 +44,19 @@ ...@@ -44,13 +44,19 @@
#if defined( USE_PCBNEW_NANOMETRES ) #if defined( USE_PCBNEW_NANOMETRES )
#define IU_TO_MM( x ) ( x * 1e-6 ) #define IU_TO_MM( x ) ( x * 1e-6 )
#define IU_TO_IN( x ) ( ( x * 1e-6 ) / 25.4 ) #define IU_TO_IN( x ) ( ( x * 1e-6 ) / 25.4 )
#define MM_TO_IU( x ) ( x * 1e6 )
#define IN_TO_IU( x ) ( ( x * 25.4 ) * 1e6 )
#else #else
#define IU_TO_MM( x ) ( ( x * 0.0001 ) * 25.4 ) #define IU_TO_MM( x ) ( ( x * 0.0001 ) * 25.4 )
#define IU_TO_IN( x ) ( x * 0.0001 ) #define IU_TO_IN( x ) ( x * 0.0001 )
#define MM_TO_IU( x ) ( ( x / 25.4 ) * 10000.0 )
#define IN_TO_IU( x ) ( x * 10000.0 )
#endif #endif
#elif defined( EESCHEMA ) #elif defined( EESCHEMA )
#define IU_TO_MM( x ) ( ( x * 0.001 ) * 25.4 ) #define IU_TO_MM( x ) ( ( x * 0.001 ) * 25.4 )
#define IU_TO_IN( x ) ( x * 0.001 ) #define IU_TO_IN( x ) ( x * 0.001 )
#define MM_TO_IU( x ) ( ( x / 25.4 ) * 1000.0 )
#define IN_TO_IU( x ) ( x * 1000.0 )
#else #else
#error "Cannot resolve internal units due to no definition of EESCHEMA or PCBNEW." #error "Cannot resolve internal units due to no definition of EESCHEMA or PCBNEW."
#endif #endif
...@@ -159,3 +165,99 @@ void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue ) ...@@ -159,3 +165,99 @@ void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue )
aTextCtr.SetValue( msg ); aTextCtr.SetValue( msg );
} }
double From_User_Unit( EDA_UNITS_T aUnit, double aValue )
{
double value;
switch( aUnit )
{
case MILLIMETRES:
value = MM_TO_IU( aValue );
break;
case INCHES:
value = IN_TO_IU( aValue );
break;
default:
case UNSCALED_UNITS:
value = aValue;
}
return value;
}
int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue )
{
int Value;
double dtmp = 0;
// Acquire the 'right' decimal point separator
const struct lconv* lc = localeconv();
wxChar decimal_point = lc->decimal_point[0];
wxString buf( aTextValue.Strip( wxString::both ) );
// Convert the period in decimal point
buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) );
// An ugly fix needed by WxWidgets 2.9.1 that sometimes
// back to a point as separator, although the separator is the comma
// TODO: remove this line if WxWidgets 2.9.2 fixes this issue
buf.Replace( wxT( "," ), wxString( decimal_point, 1 ) );
// Find the end of the numeric part
unsigned brk_point = 0;
while( brk_point < buf.Len() )
{
wxChar ch = buf[brk_point];
if( !( (ch >= '0' && ch <='9') || (ch == decimal_point) || (ch == '-') || (ch == '+') ) )
{
break;
}
++brk_point;
}
// Extract the numeric part
buf.Left( brk_point ).ToDouble( &dtmp );
// Check the optional unit designator (2 ch significant)
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
{
aUnits = INCHES;
}
else if( unit == wxT( "mm" ) )
{
aUnits = MILLIMETRES;
}
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // Mils or thous
{
aUnits = INCHES;
dtmp /= 1000;
}
Value = From_User_Unit( aUnits, dtmp );
return Value;
}
int ReturnValueFromTextCtrl( const wxTextCtrl& aTextCtr )
{
int value;
wxString msg = aTextCtr.GetValue();
value = ReturnValueFromString( g_UserUnit, msg );
return value;
}
...@@ -197,8 +197,8 @@ void BITMAP_BASE::DrawBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -197,8 +197,8 @@ void BITMAP_BASE::DrawBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
aDC->SetLogicalOrigin( logicalOriginX / GetScalingFactor(), aDC->SetLogicalOrigin( logicalOriginX / GetScalingFactor(),
logicalOriginY / GetScalingFactor() ); logicalOriginY / GetScalingFactor() );
aDC->DrawBitmap( *m_bitmap, aDC->DrawBitmap( *m_bitmap,
wxRound( pos.x / GetScalingFactor() ), KiROUND( pos.x / GetScalingFactor() ),
wxRound( pos.y / GetScalingFactor() ), KiROUND( pos.y / GetScalingFactor() ),
true ); true );
aDC->SetUserScale( scale, scale ); aDC->SetUserScale( scale, scale );
aDC->SetLogicalOrigin( logicalOriginX, logicalOriginY ); aDC->SetLogicalOrigin( logicalOriginX, logicalOriginY );
...@@ -217,8 +217,8 @@ wxSize BITMAP_BASE::GetSize() const ...@@ -217,8 +217,8 @@ wxSize BITMAP_BASE::GetSize() const
size.x = m_bitmap->GetWidth(); size.x = m_bitmap->GetWidth();
size.y = m_bitmap->GetHeight(); size.y = m_bitmap->GetHeight();
size.x = wxRound( size.x * GetScalingFactor() ); size.x = KiROUND( size.x * GetScalingFactor() );
size.y = wxRound( size.y * GetScalingFactor() ); size.y = KiROUND( size.y * GetScalingFactor() );
} }
return size; return size;
......
...@@ -98,7 +98,7 @@ double PLOTTER::user_to_device_size( double size ) ...@@ -98,7 +98,7 @@ double PLOTTER::user_to_device_size( double size )
void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill ) void PLOTTER::center_square( const wxPoint& position, int diametre, FILL_T fill )
{ {
int radius = wxRound( diametre / 2.8284 ); int radius = KiROUND( diametre / 2.8284 );
static std::vector< wxPoint > corner_list; static std::vector< wxPoint > corner_list;
corner_list.clear(); corner_list.clear();
wxPoint corner; wxPoint corner;
......
...@@ -120,15 +120,17 @@ StructColors ColorRefs[NBCOLOR] = ...@@ -120,15 +120,17 @@ StructColors ColorRefs[NBCOLOR] =
bool g_DisableFloatingPointLocalNotation = false; bool g_DisableFloatingPointLocalNotation = false;
void SetLocaleTo_C_standard( void ) int LOCALE_IO::C_count;
void SetLocaleTo_C_standard()
{ {
setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C
} }
void SetLocaleTo_Default()
void SetLocaleTo_Default( void )
{ {
if( ! g_DisableFloatingPointLocalNotation ) if( !g_DisableFloatingPointLocalNotation )
setlocale( LC_NUMERIC, "" ); // revert to the current locale setlocale( LC_NUMERIC, "" ); // revert to the current locale
} }
...@@ -253,76 +255,6 @@ void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit ) ...@@ -253,76 +255,6 @@ void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit )
} }
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit )
{
int value;
wxString msg = TextCtr.GetValue();
value = ReturnValueFromString( g_UserUnit, msg, Internal_Unit );
return value;
}
int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue, int Internal_Unit )
{
int Value;
double dtmp = 0;
// Acquire the 'right' decimal point separator
const struct lconv* lc = localeconv();
wxChar decimal_point = lc->decimal_point[0];
wxString buf( TextValue.Strip( wxString::both ) );
// Convert the period in decimal point
buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) );
// An ugly fix needed by WxWidgets 2.9.1 that sometimes
// back to a point as separator, although the separator is the comma
// TODO: remove this line if WxWidgets 2.9.2 fixes this issue
buf.Replace( wxT( "," ), wxString( decimal_point, 1 ) );
// Find the end of the numeric part
unsigned brk_point = 0;
while( brk_point < buf.Len() )
{
wxChar ch = buf[brk_point];
if( !( (ch >= '0' && ch <='9') || (ch == decimal_point) || (ch == '-') || (ch == '+') ) )
{
break;
}
++brk_point;
}
// Extract the numeric part
buf.Left( brk_point ).ToDouble( &dtmp );
// Check the optional unit designator (2 ch significant)
wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() );
if( unit == wxT( "in" ) || unit == wxT( "\"" ) )
{
aUnit = INCHES;
}
else if( unit == wxT( "mm" ) )
{
aUnit = MILLIMETRES;
}
else if( unit == wxT( "mi" ) || unit == wxT( "th" ) ) // Mils or thous
{
aUnit = INCHES;
dtmp /= 1000;
}
Value = From_User_Unit( aUnit, dtmp, Internal_Unit );
return Value;
}
wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter ) wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter )
{ {
wxArrayString* list = new wxArrayString(); wxArrayString* list = new wxArrayString();
...@@ -349,33 +281,6 @@ wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter ) ...@@ -349,33 +281,6 @@ wxArrayString* wxStringSplit( wxString aString, wxChar aSplitter )
} }
/*
* Return in internal units the value "val" given in inch or mm
*/
int From_User_Unit( EDA_UNITS_T aUnit, double val, int internal_unit_value )
{
double value;
switch( aUnit )
{
case MILLIMETRES:
value = val * internal_unit_value / 25.4;
break;
case INCHES:
value = val * internal_unit_value;
break;
default:
case UNSCALED_UNITS:
value = val;
}
return wxRound( value );
}
/* /*
* Return the string date "day month year" like "23 jun 2005" * Return the string date "day month year" like "23 jun 2005"
*/ */
...@@ -466,7 +371,7 @@ double RoundTo0( double x, double precision ) ...@@ -466,7 +371,7 @@ double RoundTo0( double x, double precision )
{ {
assert( precision != 0 ); assert( precision != 0 );
long long ix = wxRound( x * precision ); long long ix = KiROUND( x * precision );
if ( x < 0.0 ) if ( x < 0.0 )
NEGATE( ix ); NEGATE( ix );
......
...@@ -155,8 +155,8 @@ void DXF_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFactor ...@@ -155,8 +155,8 @@ void DXF_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFactor
size.x = aImage.GetWidth(); size.x = aImage.GetWidth();
size.y = aImage.GetHeight(); size.y = aImage.GetHeight();
size.x = wxRound( size.x * aScaleFactor ); size.x = KiROUND( size.x * aScaleFactor );
size.y = wxRound( size.y * aScaleFactor ); size.y = KiROUND( size.y * aScaleFactor );
wxPoint start = aPos; wxPoint start = aPos;
start.x -= size.x / 2; start.x -= size.x / 2;
...@@ -241,7 +241,7 @@ void DXF_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius, ...@@ -241,7 +241,7 @@ void DXF_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius,
return; return;
user_to_device_coordinates( centre ); user_to_device_coordinates( centre );
radius = wxRound( user_to_device_size( radius ) ); radius = KiROUND( user_to_device_size( radius ) );
/* DXF ARC */ /* DXF ARC */
wxString cname = ColorRefs[current_color].m_Name; wxString cname = ColorRefs[current_color].m_Name;
......
...@@ -284,7 +284,7 @@ void GERBER_PLOTTER::circle( wxPoint aCentre, int aDiameter, FILL_T aFill, int a ...@@ -284,7 +284,7 @@ void GERBER_PLOTTER::circle( wxPoint aCentre, int aDiameter, FILL_T aFill, int a
double radius = aDiameter / 2; double radius = aDiameter / 2;
const int delta = 3600 / 32; /* increment (in 0.1 degrees) to draw circles */ const int delta = 3600 / 32; /* increment (in 0.1 degrees) to draw circles */
start.x = aCentre.x + wxRound( radius ); start.x = aCentre.x + KiROUND( radius );
start.y = aCentre.y; start.y = aCentre.y;
set_current_line_width( aWidth ); set_current_line_width( aWidth );
move_to( start ); move_to( start );
...@@ -351,8 +351,8 @@ void GERBER_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFac ...@@ -351,8 +351,8 @@ void GERBER_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFac
size.x = aImage.GetWidth(); size.x = aImage.GetWidth();
size.y = aImage.GetHeight(); size.y = aImage.GetHeight();
size.x = wxRound( size.x * aScaleFactor ); size.x = KiROUND( size.x * aScaleFactor );
size.y = wxRound( size.y * aScaleFactor ); size.y = KiROUND( size.y * aScaleFactor );
wxPoint start = aPos; wxPoint start = aPos;
start.x -= size.x / 2; start.x -= size.x / 2;
......
...@@ -112,8 +112,8 @@ void HPGL_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFacto ...@@ -112,8 +112,8 @@ void HPGL_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFacto
size.x = aImage.GetWidth(); size.x = aImage.GetWidth();
size.y = aImage.GetHeight(); size.y = aImage.GetHeight();
size.x = wxRound( size.x * aScaleFactor ); size.x = KiROUND( size.x * aScaleFactor );
size.y = wxRound( size.y * aScaleFactor ); size.y = KiROUND( size.y * aScaleFactor );
wxPoint start = aPos; wxPoint start = aPos;
start.x -= size.x / 2; start.x -= size.x / 2;
...@@ -285,7 +285,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient, ...@@ -285,7 +285,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
if( trace_mode == FILLED ) if( trace_mode == FILLED )
{ {
flash_pad_rect( pos, wxSize( size.x, deltaxy + wxRound( pen_diameter ) ), flash_pad_rect( pos, wxSize( size.x, deltaxy + KiROUND( pen_diameter ) ),
orient, trace_mode ); orient, trace_mode );
cx = 0; cy = deltaxy / 2; cx = 0; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient ); RotatePoint( &cx, &cy, orient );
...@@ -298,7 +298,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient, ...@@ -298,7 +298,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
} }
else // Plot in SKETCH mode. else // Plot in SKETCH mode.
{ {
sketch_oval( pos, size, orient, wxRound( pen_diameter ) ); sketch_oval( pos, size, orient, KiROUND( pen_diameter ) );
} }
} }
...@@ -313,12 +313,12 @@ void HPGL_PLOTTER::flash_pad_circle( wxPoint pos, int diametre, ...@@ -313,12 +313,12 @@ void HPGL_PLOTTER::flash_pad_circle( wxPoint pos, int diametre,
user_to_device_coordinates( pos ); user_to_device_coordinates( pos );
delta = wxRound( pen_diameter - pen_overlap ); delta = KiROUND( pen_diameter - pen_overlap );
rayon = diametre / 2; rayon = diametre / 2;
if( trace_mode != LINE ) if( trace_mode != LINE )
{ {
rayon = ( diametre - wxRound( pen_diameter ) ) / 2; rayon = ( diametre - KiROUND( pen_diameter ) ) / 2;
} }
if( rayon < 0 ) if( rayon < 0 )
...@@ -483,7 +483,7 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], ...@@ -483,7 +483,7 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
wxPoint coord[4]; // absolute coordinates of corners (coordinates in plotter space) wxPoint coord[4]; // absolute coordinates of corners (coordinates in plotter space)
int move; int move;
move = wxRound( pen_diameter ); move = KiROUND( pen_diameter );
for( int ii = 0; ii < 4; ii++ ) for( int ii = 0; ii < 4; ii++ )
polygone[ii] = aCorners[ii]; polygone[ii] = aCorners[ii];
...@@ -512,7 +512,7 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4], ...@@ -512,7 +512,7 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
// TODO: replace this par the HPGL plot polygon. // TODO: replace this par the HPGL plot polygon.
int jj; int jj;
// Fill the shape // Fill the shape
move = wxRound( pen_diameter - pen_overlap ); move = KiROUND( pen_diameter - pen_overlap );
// Calculate fill height. // Calculate fill height.
if( polygone[0].y == polygone[3].y ) // Horizontal if( polygone[0].y == polygone[3].y ) // Horizontal
......
...@@ -160,7 +160,7 @@ void PS_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius, ...@@ -160,7 +160,7 @@ void PS_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius,
// Calculate start point. // Calculate start point.
user_to_device_coordinates( centre ); user_to_device_coordinates( centre );
radius = wxRound( user_to_device_size( radius ) ); radius = KiROUND( user_to_device_size( radius ) );
if( plotMirror ) if( plotMirror )
fprintf( output_file, "%d %d %d %g %g arc%d\n", centre.x, centre.y, fprintf( output_file, "%d %d %d %g %g arc%d\n", centre.x, centre.y,
radius, (double) -EndAngle / 10, (double) -StAngle / 10, radius, (double) -EndAngle / 10, (double) -StAngle / 10,
...@@ -216,8 +216,8 @@ void PS_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFactor ...@@ -216,8 +216,8 @@ void PS_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFactor
pix_size.x = aImage.GetWidth(); pix_size.x = aImage.GetWidth();
pix_size.y = aImage.GetHeight(); pix_size.y = aImage.GetHeight();
wxSize drawsize; // requested size of image wxSize drawsize; // requested size of image
drawsize.x = wxRound( aScaleFactor * pix_size.x ); drawsize.x = KiROUND( aScaleFactor * pix_size.x );
drawsize.y = wxRound( aScaleFactor * pix_size.y ); drawsize.y = KiROUND( aScaleFactor * pix_size.y );
// calculate the bottom left corner position of bitmap // calculate the bottom left corner position of bitmap
wxPoint start = aPos; wxPoint start = aPos;
...@@ -405,14 +405,14 @@ bool PS_PLOTTER::start_plot( FILE* fout ) ...@@ -405,14 +405,14 @@ bool PS_PLOTTER::start_plot( FILE* fout )
if( pageInfo.IsCustom() ) if( pageInfo.IsCustom() )
fprintf( output_file, "%%%%DocumentMedia: Custom %d %d 0 () ()\n", fprintf( output_file, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
wxRound( psPageSize.x * 10 * CONV_SCALE ), KiROUND( psPageSize.x * 10 * CONV_SCALE ),
wxRound( psPageSize.y * 10 * CONV_SCALE ) ); KiROUND( psPageSize.y * 10 * CONV_SCALE ) );
else // a standard paper size else // a standard paper size
fprintf( output_file, "%%%%DocumentMedia: %s %d %d 0 () ()\n", fprintf( output_file, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
TO_UTF8( pageInfo.GetType() ), TO_UTF8( pageInfo.GetType() ),
wxRound( psPageSize.x * 10 * CONV_SCALE ), KiROUND( psPageSize.x * 10 * CONV_SCALE ),
wxRound( psPageSize.y * 10 * CONV_SCALE ) ); KiROUND( psPageSize.y * 10 * CONV_SCALE ) );
if( pageInfo.IsPortrait() ) if( pageInfo.IsPortrait() )
fprintf( output_file, "%%%%Orientation: Portrait\n" ); fprintf( output_file, "%%%%Orientation: Portrait\n" );
......
...@@ -30,9 +30,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen ) ...@@ -30,9 +30,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
wxPoint pos, ref; wxPoint pos, ref;
EDA_COLOR_T color; EDA_COLOR_T color;
// paper is sized in mils. Here is a conversion factor to // Paper is sized in mils. Here is a conversion factor to scale mils to internal units.
// scale mils to internal units. int conv_unit = screen->MilsToIuScalar();
int conv_unit = screen->GetInternalUnits() / 1000;
wxString msg; wxString msg;
wxSize text_size; wxSize text_size;
......
...@@ -72,7 +72,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) ...@@ -72,7 +72,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
BASE_SCREEN* screen = aFrame->GetCanvas()->GetScreen(); BASE_SCREEN* screen = aFrame->GetCanvas()->GetScreen();
/* scale is the ratio resolution/internal units */ /* scale is the ratio resolution/internal units */
float scale = 82.0 / aFrame->GetInternalUnits(); float scale = 82.0 / 1000.0 / (double) screen->MilsToIuScalar();
if( screen->IsBlockActive() ) if( screen->IsBlockActive() )
{ {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/image.h> #include <wx/image.h>
#include <macros.h> #include <macros.h>
#include <common.h>
#if wxCHECK_VERSION( 2, 9, 0 ) #if wxCHECK_VERSION( 2, 9, 0 )
...@@ -186,15 +187,15 @@ KicadSVGFileDCImpl::~KicadSVGFileDCImpl() ...@@ -186,15 +187,15 @@ KicadSVGFileDCImpl::~KicadSVGFileDCImpl()
void KicadSVGFileDCImpl::DoGetSizeMM( int *width, int *height ) const void KicadSVGFileDCImpl::DoGetSizeMM( int *width, int *height ) const
{ {
if (width) if (width)
*width = wxRound( (double)m_width / m_mm_to_pix_x ); *width = KiROUND( (double)m_width / m_mm_to_pix_x );
if (height) if (height)
*height = wxRound( (double)m_height / m_mm_to_pix_y ); *height = KiROUND( (double)m_height / m_mm_to_pix_y );
} }
wxSize KicadSVGFileDCImpl::GetPPI() const wxSize KicadSVGFileDCImpl::GetPPI() const
{ {
return wxSize( wxRound(m_dpi), wxRound(m_dpi) ); return wxSize( KiROUND(m_dpi), KiROUND(m_dpi) );
} }
void KicadSVGFileDCImpl::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) void KicadSVGFileDCImpl::DoDrawLine (wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <macros.h> // DIM() #include <macros.h> // DIM()
#include <common.h> #include <common.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <base_struct.h> #include <base_struct.h>
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <class_title_block.h> #include <class_title_block.h>
#include <wxstruct.h> #include <wxstruct.h>
#include <class_base_screen.h> #include <class_base_screen.h>
#include <base_units.h> // MILS_TO_IU_SCALAR
#include <wx/valgen.h> #include <wx/valgen.h>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
...@@ -118,10 +119,12 @@ void DIALOG_PAGES_SETTINGS::initDialog() ...@@ -118,10 +119,12 @@ void DIALOG_PAGES_SETTINGS::initDialog()
// initalize page format choice box and page format list. // initalize page format choice box and page format list.
// The first shows translated strings, the second contains not tralated strings // The first shows translated strings, the second contains not tralated strings
m_paperSizeComboBox->Clear(); m_paperSizeComboBox->Clear();
for( unsigned ii = 0; ; ii++ ) for( unsigned ii = 0; ; ii++ )
{ {
if( pageFmts[ii].IsEmpty() ) if( pageFmts[ii].IsEmpty() )
break; break;
m_pageFmt.Add( pageFmts[ii] ); m_pageFmt.Add( pageFmts[ii] );
m_paperSizeComboBox->Append( wxGetTranslation( pageFmts[ii] ) ); m_paperSizeComboBox->Append( wxGetTranslation( pageFmts[ii] ) );
} }
...@@ -137,8 +140,8 @@ void DIALOG_PAGES_SETTINGS::initDialog() ...@@ -137,8 +140,8 @@ void DIALOG_PAGES_SETTINGS::initDialog()
msg.Printf( format, m_Screen->m_ScreenNumber ); msg.Printf( format, m_Screen->m_ScreenNumber );
m_TextSheetNumber->SetLabel( msg ); m_TextSheetNumber->SetLabel( msg );
#else #else
m_TextSheetCount->Show(false); m_TextSheetCount->Show( false );
m_TextSheetNumber->Show(false); m_TextSheetNumber->Show( false );
#endif #endif
m_pageInfo = m_Parent->GetPageSettings(); m_pageInfo = m_Parent->GetPageSettings();
...@@ -251,10 +254,11 @@ void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event ) ...@@ -251,10 +254,11 @@ void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
{ {
m_save_flag = false; m_save_flag = false;
SavePageSettings( event ); SavePageSettings( event );
if( m_save_flag ) if( m_save_flag )
{ {
m_modified = true; m_modified = true;
Close( true ); Close( true );
} }
} }
...@@ -268,9 +272,12 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event ) ...@@ -268,9 +272,12 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event ) void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
{ {
int idx = m_paperSizeComboBox->GetSelection(); int idx = m_paperSizeComboBox->GetSelection();
if( idx < 0 ) if( idx < 0 )
idx = 0; idx = 0;
const wxString paperType = m_pageFmt[idx]; const wxString paperType = m_pageFmt[idx];
if( paperType.Contains( PAGE_INFO::Custom ) ) if( paperType.Contains( PAGE_INFO::Custom ) )
{ {
m_orientationComboBox->Enable( false ); m_orientationComboBox->Enable( false );
...@@ -280,14 +287,17 @@ void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event ) ...@@ -280,14 +287,17 @@ void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
else else
{ {
m_orientationComboBox->Enable( true ); m_orientationComboBox->Enable( true );
if( paperType.Contains( wxT( "A4" ) ) && IsGOST() ) if( paperType.Contains( wxT( "A4" ) ) && IsGOST() )
{ {
m_orientationComboBox->SetStringSelection( _( "Portrait" ) ); m_orientationComboBox->SetStringSelection( _( "Portrait" ) );
m_orientationComboBox->Enable( false ); m_orientationComboBox->Enable( false );
} }
m_TextUserSizeX->Enable( false ); m_TextUserSizeX->Enable( false );
m_TextUserSizeY->Enable( false ); m_TextUserSizeY->Enable( false );
} }
GetPageLayoutInfoFromDialog(); GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample(); UpdatePageLayoutExample();
} }
...@@ -407,8 +417,10 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event ) ...@@ -407,8 +417,10 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
m_save_flag = true; m_save_flag = true;
int idx = m_paperSizeComboBox->GetSelection(); int idx = m_paperSizeComboBox->GetSelection();
if( idx < 0 ) if( idx < 0 )
idx = 0; idx = 0;
const wxString paperType = m_pageFmt[idx]; const wxString paperType = m_pageFmt[idx];
if( paperType.Contains( PAGE_INFO::Custom ) ) if( paperType.Contains( PAGE_INFO::Custom ) )
...@@ -416,6 +428,7 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event ) ...@@ -416,6 +428,7 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
GetCustomSizeMilsFromDialog(); GetCustomSizeMilsFromDialog();
retSuccess = m_pageInfo.SetType( PAGE_INFO::Custom ); retSuccess = m_pageInfo.SetType( PAGE_INFO::Custom );
if( retSuccess ) if( retSuccess )
{ {
if( m_layout_size.x < MIN_PAGE_SIZE || m_layout_size.y < MIN_PAGE_SIZE || if( m_layout_size.x < MIN_PAGE_SIZE || m_layout_size.y < MIN_PAGE_SIZE ||
...@@ -432,6 +445,7 @@ limits\n%.1f - %.1f %s!\nSelect another custom paper size?" ), ...@@ -432,6 +445,7 @@ limits\n%.1f - %.1f %s!\nSelect another custom paper size?" ),
m_save_flag = false; m_save_flag = false;
return; return;
} }
m_layout_size.x = Clamp( MIN_PAGE_SIZE, m_layout_size.x, MAX_PAGE_SIZE ); m_layout_size.x = Clamp( MIN_PAGE_SIZE, m_layout_size.x, MAX_PAGE_SIZE );
m_layout_size.y = Clamp( MIN_PAGE_SIZE, m_layout_size.y, MAX_PAGE_SIZE ); m_layout_size.y = Clamp( MIN_PAGE_SIZE, m_layout_size.y, MAX_PAGE_SIZE );
} }
...@@ -580,12 +594,12 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample() ...@@ -580,12 +594,12 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
if( clamped_layout_size.x < clamped_layout_size.y ) if( clamped_layout_size.x < clamped_layout_size.y )
{ {
lyHeight = MAX_PAGE_EXAMPLE_SIZE; lyHeight = MAX_PAGE_EXAMPLE_SIZE;
lyWidth = wxRound( (double) lyHeight / lyRatio ); lyWidth = KiROUND( (double) lyHeight / lyRatio );
} }
else else
{ {
lyWidth = MAX_PAGE_EXAMPLE_SIZE; lyWidth = MAX_PAGE_EXAMPLE_SIZE;
lyHeight = wxRound( (double) lyWidth / lyRatio ); lyHeight = KiROUND( (double) lyWidth / lyRatio );
} }
if( m_page_bitmap ) if( m_page_bitmap )
...@@ -595,6 +609,7 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample() ...@@ -595,6 +609,7 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
} }
m_page_bitmap = new wxBitmap( lyWidth + 1, lyHeight + 1 ); m_page_bitmap = new wxBitmap( lyWidth + 1, lyHeight + 1 );
if( m_page_bitmap->IsOk() ) if( m_page_bitmap->IsOk() )
{ {
// Save current clip box and temporary expand it. // Save current clip box and temporary expand it.
...@@ -602,7 +617,8 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample() ...@@ -602,7 +617,8 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
m_Parent->GetCanvas()->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), m_Parent->GetCanvas()->SetClipBox( EDA_RECT( wxPoint( 0, 0 ),
wxSize( INT_MAX / 2, INT_MAX / 2 ) ) ); wxSize( INT_MAX / 2, INT_MAX / 2 ) ) );
// Calculate layout preview scale. // Calculate layout preview scale.
int appScale = m_Parent->GetInternalUnits() / 1000; int appScale = MILS_TO_IU_SCALAR;
double scaleW = (double) lyWidth / clamped_layout_size.x / appScale; double scaleW = (double) lyWidth / clamped_layout_size.x / appScale;
double scaleH = (double) lyHeight / clamped_layout_size.y / appScale; double scaleH = (double) lyHeight / clamped_layout_size.y / appScale;
...@@ -630,7 +646,7 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample() ...@@ -630,7 +646,7 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
m_Parent->TraceWorkSheet( (wxDC*) &memDC, dummySize, pointLeftTop, pointRightBottom, m_Parent->TraceWorkSheet( (wxDC*) &memDC, dummySize, pointLeftTop, pointRightBottom,
emptyString, emptyString, m_tb, m_Screen->m_NumberOfScreen, emptyString, emptyString, m_tb, m_Screen->m_NumberOfScreen,
m_Screen->m_ScreenNumber, 1, LIGHTGRAY, RED ); m_Screen->m_ScreenNumber, 1, appScale, LIGHTGRAY, RED );
memDC.SelectObject( wxNullBitmap ); memDC.SelectObject( wxNullBitmap );
m_PageLayoutExampleBitmap->SetBitmap( *m_page_bitmap ); m_PageLayoutExampleBitmap->SetBitmap( *m_page_bitmap );
...@@ -648,14 +664,17 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample() ...@@ -648,14 +664,17 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog() void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
{ {
int idx = m_paperSizeComboBox->GetSelection(); int idx = m_paperSizeComboBox->GetSelection();
if( idx < 0 ) if( idx < 0 )
idx = 0; idx = 0;
const wxString paperType = m_pageFmt[idx]; const wxString paperType = m_pageFmt[idx];
// here we assume translators will keep original paper size spellings // here we assume translators will keep original paper size spellings
if( paperType.Contains( PAGE_INFO::Custom ) ) if( paperType.Contains( PAGE_INFO::Custom ) )
{ {
GetCustomSizeMilsFromDialog(); GetCustomSizeMilsFromDialog();
if( m_layout_size.x && m_layout_size.y ) if( m_layout_size.x && m_layout_size.y )
{ {
if( m_layout_size.x < m_layout_size.y ) if( m_layout_size.x < m_layout_size.y )
...@@ -687,6 +706,7 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog() ...@@ -687,6 +706,7 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
}; };
unsigned i; unsigned i;
for( i=0; i < DIM( papers ); ++i ) for( i=0; i < DIM( papers ); ++i )
{ {
if( paperType.Contains( *papers[i] ) ) if( paperType.Contains( *papers[i] ) )
...@@ -740,5 +760,5 @@ void DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog() ...@@ -740,5 +760,5 @@ void DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog()
// Prepare to painless double -> int conversion. // Prepare to painless double -> int conversion.
customSizeX = Clamp( double( INT_MIN ), customSizeX, double( INT_MAX ) ); customSizeX = Clamp( double( INT_MIN ), customSizeX, double( INT_MAX ) );
customSizeY = Clamp( double( INT_MIN ), customSizeY, double( INT_MAX ) ); customSizeY = Clamp( double( INT_MIN ), customSizeY, double( INT_MAX ) );
m_layout_size = wxSize( wxRound( customSizeX ), wxRound( customSizeY ) ); m_layout_size = wxSize( KiROUND( customSizeX ), KiROUND( customSizeY ) );
} }
...@@ -110,7 +110,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti ...@@ -110,7 +110,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
m_snapToGrid = true; m_snapToGrid = true;
// Internal units per inch: = 1000 for schema, = 10000 for PCB // Internal units per inch: = 1000 for schema, = 10000 for PCB
m_internalUnits = EESCHEMA_INTERNAL_UNIT;
minsize.x = 470; minsize.x = 470;
minsize.y = 350 + m_MsgFrameHeight; minsize.y = 350 + m_MsgFrameHeight;
...@@ -369,7 +368,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event ) ...@@ -369,7 +368,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
else else
{ {
id--; id--;
int selectedZoom = GetScreen()->m_ZoomList[id]; double selectedZoom = GetScreen()->m_ZoomList[id];
if( GetScreen()->GetZoom() == selectedZoom ) if( GetScreen()->GetZoom() == selectedZoom )
return; return;
...@@ -516,8 +515,8 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition ) ...@@ -516,8 +515,8 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
clientSize = m_canvas->GetClientSize(); clientSize = m_canvas->GetClientSize();
// The logical size of the client window. // The logical size of the client window.
logicalClientSize.x = wxRound( (double) clientSize.x / scalar ); logicalClientSize.x = KiROUND( (double) clientSize.x / scalar );
logicalClientSize.y = wxRound( (double) clientSize.y / scalar ); logicalClientSize.y = KiROUND( (double) clientSize.y / scalar );
// A corner of the drawing in internal units. // A corner of the drawing in internal units.
wxSize corner = GetPageSizeIU(); wxSize corner = GetPageSizeIU();
...@@ -532,14 +531,14 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition ) ...@@ -532,14 +531,14 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
drawingRect.GetTop(), drawingRect.GetBottom() ); drawingRect.GetTop(), drawingRect.GetBottom() );
// The size of the client rectangle in logical units. // The size of the client rectangle in logical units.
int x = wxRound( (double) aCenterPosition.x - ( (double) logicalClientSize.x / 2.0 ) ); int x = KiROUND( (double) aCenterPosition.x - ( (double) logicalClientSize.x / 2.0 ) );
int y = wxRound( (double) aCenterPosition.y - ( (double) logicalClientSize.y / 2.0 ) ); int y = KiROUND( (double) aCenterPosition.y - ( (double) logicalClientSize.y / 2.0 ) );
// If drawn around the center, adjust the client rectangle accordingly. // If drawn around the center, adjust the client rectangle accordingly.
if( screen->m_Center ) if( screen->m_Center )
{ {
x += wxRound( (double) drawingRect.width / 2.0 ); x += KiROUND( (double) drawingRect.width / 2.0 );
y += wxRound( (double) drawingRect.height / 2.0 ); y += KiROUND( (double) drawingRect.height / 2.0 );
} }
wxRect logicalClientRect( wxPoint( x, y ), logicalClientSize ); wxRect logicalClientRect( wxPoint( x, y ), logicalClientSize );
...@@ -575,7 +574,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition ) ...@@ -575,7 +574,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
else else
virtualSize.x = logicalClientRect.width; virtualSize.x = logicalClientRect.width;
} }
else if( logicalClientRect.width < drawingRect.width ) else
{ {
if( drawingCenterX > clientCenterX ) if( drawingCenterX > clientCenterX )
virtualSize.x = drawingRect.width + virtualSize.x = drawingRect.width +
...@@ -586,10 +585,6 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition ) ...@@ -586,10 +585,6 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
else else
virtualSize.x = drawingRect.width; virtualSize.x = drawingRect.width;
} }
else
{
virtualSize.x = drawingRect.width;
}
} }
if( drawingRect.GetTop() < logicalClientRect.GetTop() && drawingRect.GetBottom() > logicalClientRect.GetBottom() ) if( drawingRect.GetTop() < logicalClientRect.GetTop() && drawingRect.GetBottom() > logicalClientRect.GetBottom() )
...@@ -610,7 +605,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition ) ...@@ -610,7 +605,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
else else
virtualSize.y = logicalClientRect.height; virtualSize.y = logicalClientRect.height;
} }
else if( logicalClientRect.height < drawingRect.height ) else
{ {
if( drawingCenterY > clientCenterY ) if( drawingCenterY > clientCenterY )
virtualSize.y = drawingRect.height + virtualSize.y = drawingRect.height +
...@@ -621,23 +616,19 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition ) ...@@ -621,23 +616,19 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
else else
virtualSize.y = drawingRect.height; virtualSize.y = drawingRect.height;
} }
else
{
virtualSize.y = drawingRect.height;
}
} }
} }
if( screen->m_Center ) if( screen->m_Center )
{ {
screen->m_DrawOrg.x = -( wxRound( (double) virtualSize.x / 2.0 ) ); screen->m_DrawOrg.x = -( KiROUND( (double) virtualSize.x / 2.0 ) );
screen->m_DrawOrg.y = -( wxRound( (double) virtualSize.y / 2.0 ) ); screen->m_DrawOrg.y = -( KiROUND( (double) virtualSize.y / 2.0 ) );
} }
else else
{ {
screen->m_DrawOrg.x = -( wxRound( (double) (virtualSize.x - drawingRect.width) / 2.0 ) ); screen->m_DrawOrg.x = -( KiROUND( (double) (virtualSize.x - drawingRect.width) / 2.0 ) );
screen->m_DrawOrg.y = -( wxRound( (double) (virtualSize.y - drawingRect.height) / 2.0 ) ); screen->m_DrawOrg.y = -( KiROUND( (double) (virtualSize.y - drawingRect.height) / 2.0 ) );
} }
/* Always set scrollbar pixels per unit to 1 unless you want the zoom /* Always set scrollbar pixels per unit to 1 unless you want the zoom
...@@ -649,20 +640,20 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition ) ...@@ -649,20 +640,20 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1; screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
// Calculate the number of scroll bar units for the given zoom level in device units. // Calculate the number of scroll bar units for the given zoom level in device units.
unitsX = wxRound( (double) virtualSize.x * scalar ); unitsX = KiROUND( (double) virtualSize.x * scalar );
unitsY = wxRound( (double) virtualSize.y * scalar ); unitsY = KiROUND( (double) virtualSize.y * scalar );
// Calculate the scroll bar position in logical units to place the center position at // Calculate the scroll bar position in logical units to place the center position at
// the center of client rectangle. // the center of client rectangle.
screen->SetScrollCenterPosition( aCenterPosition ); screen->SetScrollCenterPosition( aCenterPosition );
posX = aCenterPosition.x - wxRound( (double) logicalClientRect.width / 2.0 ) - posX = aCenterPosition.x - KiROUND( (double) logicalClientRect.width / 2.0 ) -
screen->m_DrawOrg.x; screen->m_DrawOrg.x;
posY = aCenterPosition.y - wxRound( (double) logicalClientRect.height / 2.0 ) - posY = aCenterPosition.y - KiROUND( (double) logicalClientRect.height / 2.0 ) -
screen->m_DrawOrg.y; screen->m_DrawOrg.y;
// Convert scroll bar position to device units. // Convert scroll bar position to device units.
posX = wxRound( (double) posX * scalar ); posX = KiROUND( (double) posX * scalar );
posY = wxRound( (double) posY * scalar ); posY = KiROUND( (double) posY * scalar );
if( posX < 0 ) if( posX < 0 )
{ {
......
...@@ -405,8 +405,8 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event ) ...@@ -405,8 +405,8 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
double scale = GetParent()->GetScreen()->GetScalingFactor(); double scale = GetParent()->GetScreen()->GetScalingFactor();
wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition(); wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition();
center.x += wxRound( (double) ( x - tmpX ) / scale ); center.x += KiROUND( (double) ( x - tmpX ) / scale );
center.y += wxRound( (double) ( y - tmpY ) / scale ); center.y += KiROUND( (double) ( y - tmpY ) / scale );
GetParent()->GetScreen()->SetScrollCenterPosition( center ); GetParent()->GetScreen()->SetScrollCenterPosition( center );
Scroll( x, y ); Scroll( x, y );
...@@ -432,8 +432,8 @@ void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect ) ...@@ -432,8 +432,8 @@ void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect )
int scrollX, scrollY; int scrollX, scrollY;
double scalar = Screen->GetScalingFactor(); double scalar = Screen->GetScalingFactor();
scrollX = wxRound( Screen->GetGridSize().x * scalar ); scrollX = KiROUND( Screen->GetGridSize().x * scalar );
scrollY = wxRound( Screen->GetGridSize().y * scalar ); scrollY = KiROUND( Screen->GetGridSize().y * scalar );
m_scrollIncrementX = MAX( GetClientSize().x / 8, scrollX ); m_scrollIncrementX = MAX( GetClientSize().x / 8, scrollX );
m_scrollIncrementY = MAX( GetClientSize().y / 8, scrollY ); m_scrollIncrementY = MAX( GetClientSize().y / 8, scrollY );
...@@ -599,8 +599,8 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC ) ...@@ -599,8 +599,8 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
screen->m_StartVisu = CalcUnscrolledPosition( wxPoint( 0, 0 ) ); screen->m_StartVisu = CalcUnscrolledPosition( wxPoint( 0, 0 ) );
screenSize = GetClientSize(); screenSize = GetClientSize();
screenGridSize.x = aDC->LogicalToDeviceXRel( wxRound( gridSize.x ) ); screenGridSize.x = aDC->LogicalToDeviceXRel( KiROUND( gridSize.x ) );
screenGridSize.y = aDC->LogicalToDeviceYRel( wxRound( gridSize.y ) ); screenGridSize.y = aDC->LogicalToDeviceYRel( KiROUND( gridSize.y ) );
org = m_ClipBox.GetPosition(); org = m_ClipBox.GetPosition();
...@@ -621,10 +621,10 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC ) ...@@ -621,10 +621,10 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
// Incrementing the start point by one grid step should prevent drawing grid points // Incrementing the start point by one grid step should prevent drawing grid points
// outside the clip box. // outside the clip box.
if( org.x < m_ClipBox.GetX() ) if( org.x < m_ClipBox.GetX() )
org.x += wxRound( gridSize.x ); org.x += KiROUND( gridSize.x );
if( org.y < m_ClipBox.GetY() ) if( org.y < m_ClipBox.GetY() )
org.y += wxRound( gridSize.y ); org.y += KiROUND( gridSize.y );
#if ( defined( __WXMAC__ ) || 1 ) #if ( defined( __WXMAC__ ) || 1 )
// Use a pixel based draw to display grid. There are a lot of calls, so the cost is // Use a pixel based draw to display grid. There are a lot of calls, so the cost is
...@@ -643,11 +643,11 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC ) ...@@ -643,11 +643,11 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
for( double x = (double) org.x; x <= right; x += gridSize.x ) for( double x = (double) org.x; x <= right; x += gridSize.x )
{ {
xpos = wxRound( x ); xpos = KiROUND( x );
for( double y = (double) org.y; y <= bottom; y += gridSize.y ) for( double y = (double) org.y; y <= bottom; y += gridSize.y )
{ {
aDC->DrawPoint( xpos, wxRound( y ) ); aDC->DrawPoint( xpos, KiROUND( y ) );
} }
} }
#else #else
...@@ -684,7 +684,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC ) ...@@ -684,7 +684,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
// Draw a column of grid points. // Draw a column of grid points.
for( double y = (double) org.y; y <= bottom; y += gridSize.y ) for( double y = (double) org.y; y <= bottom; y += gridSize.y )
{ {
tmpDC.DrawPoint( 0, scaleDC.LogicalToDeviceY( wxRound( y ) ) ); tmpDC.DrawPoint( 0, scaleDC.LogicalToDeviceY( KiROUND( y ) ) );
} }
// Reset the device context scale and origin and restore on exit. // Reset the device context scale and origin and restore on exit.
...@@ -700,7 +700,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC ) ...@@ -700,7 +700,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
// Blit the column for each row of the damaged region. // Blit the column for each row of the damaged region.
for( double x = (double) org.x; x <= right; x += gridSize.x ) for( double x = (double) org.x; x <= right; x += gridSize.x )
{ {
aDC->Blit( scaleDC.LogicalToDeviceX( wxRound( x ) ), aDC->Blit( scaleDC.LogicalToDeviceX( KiROUND( x ) ),
scaleDC.LogicalToDeviceY( m_ClipBox.GetY() ), scaleDC.LogicalToDeviceY( m_ClipBox.GetY() ),
1, tmpBM.GetHeight(), &tmpDC, 0, 0, wxCOPY, true ); 1, tmpBM.GetHeight(), &tmpDC, 0, 0, wxCOPY, true );
} }
...@@ -1072,8 +1072,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1072,8 +1072,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
double scale = GetParent()->GetScreen()->GetScalingFactor(); double scale = GetParent()->GetScreen()->GetScalingFactor();
wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition(); wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition();
center.x += wxRound( (double) ( x - tmpX ) / scale ) / ppux; center.x += KiROUND( (double) ( x - tmpX ) / scale ) / ppux;
center.y += wxRound( (double) ( y - tmpY ) / scale ) / ppuy; center.y += KiROUND( (double) ( y - tmpY ) / scale ) / ppuy;
GetParent()->GetScreen()->SetScrollCenterPosition( center ); GetParent()->GetScreen()->SetScrollCenterPosition( center );
Refresh(); Refresh();
...@@ -1083,9 +1083,9 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1083,9 +1083,9 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{ {
double scale = GetParent()->GetScreen()->GetScalingFactor(); double scale = GetParent()->GetScreen()->GetScalingFactor();
int x = m_PanStartCenter.x + int x = m_PanStartCenter.x +
wxRound( (double) ( m_PanStartEventPosition.x - currentPosition.x ) / scale ); KiROUND( (double) ( m_PanStartEventPosition.x - currentPosition.x ) / scale );
int y = m_PanStartCenter.y + int y = m_PanStartCenter.y +
wxRound( (double) ( m_PanStartEventPosition.y - currentPosition.y ) / scale ); KiROUND( (double) ( m_PanStartEventPosition.y - currentPosition.y ) / scale );
GetParent()->RedrawScreen( wxPoint( x, y ), false ); GetParent()->RedrawScreen( wxPoint( x, y ), false );
} }
......
...@@ -35,7 +35,7 @@ double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR; ...@@ -35,7 +35,7 @@ double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR;
*/ */
int GetPenSizeForBold( int aTextSize ) int GetPenSizeForBold( int aTextSize )
{ {
return wxRound( aTextSize / 5.0 ); return KiROUND( aTextSize / 5.0 );
} }
...@@ -55,7 +55,7 @@ int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold ) ...@@ -55,7 +55,7 @@ int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold )
{ {
int penSize = aPenSize; int penSize = aPenSize;
double scale = aBold ? 4.0 : 6.0; double scale = aBold ? 4.0 : 6.0;
int maxWidth = wxRound( ABS( aSize ) / scale ); int maxWidth = KiROUND( ABS( aSize ) / scale );
if( penSize > maxWidth ) if( penSize > maxWidth )
penSize = maxWidth; penSize = maxWidth;
...@@ -138,13 +138,13 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo ...@@ -138,13 +138,13 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo
/* Get metrics */ /* Get metrics */
int xsta = *ptcar++ - 'R'; int xsta = *ptcar++ - 'R';
int xsto = *ptcar++ - 'R'; int xsto = *ptcar++ - 'R';
tally += wxRound( aXSize * (xsto - xsta) * s_HerscheyScaleFactor ); tally += KiROUND( aXSize * (xsto - xsta) * s_HerscheyScaleFactor );
} }
/* Italic correction, 1/8em */ /* Italic correction, 1/8em */
if( aItalic ) if( aItalic )
{ {
tally += wxRound( aXSize * 0.125 ); tally += KiROUND( aXSize * 0.125 );
} }
return tally; return tally;
} }
...@@ -196,7 +196,7 @@ static void DrawGraphicTextPline( ...@@ -196,7 +196,7 @@ static void DrawGraphicTextPline(
*/ */
static int overbar_position( int size_v, int thickness ) static int overbar_position( int size_v, int thickness )
{ {
return wxRound( ( (double) size_v * 26 * s_HerscheyScaleFactor ) + ( (double) thickness * 1.5 ) ); return KiROUND( ( (double) size_v * 26 * s_HerscheyScaleFactor ) + ( (double) thickness * 1.5 ) );
} }
...@@ -460,12 +460,12 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -460,12 +460,12 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
{ {
wxPoint currpoint; wxPoint currpoint;
hc1 -= xsta; hc2 -= 11; /* Align the midpoint */ hc1 -= xsta; hc2 -= 11; /* Align the midpoint */
hc1 = wxRound( hc1 * size_h * s_HerscheyScaleFactor ); hc1 = KiROUND( hc1 * size_h * s_HerscheyScaleFactor );
hc2 = wxRound( hc2 * size_v * s_HerscheyScaleFactor ); hc2 = KiROUND( hc2 * size_v * s_HerscheyScaleFactor );
// To simulate an italic font, add a x offset depending on the y offset // To simulate an italic font, add a x offset depending on the y offset
if( aItalic ) if( aItalic )
hc1 -= wxRound( italic_reverse ? -hc2 / 8.0 : hc2 / 8.0 ); hc1 -= KiROUND( italic_reverse ? -hc2 / 8.0 : hc2 / 8.0 );
currpoint.x = hc1 + current_char_pos.x; currpoint.x = hc1 + current_char_pos.x;
currpoint.y = hc2 + current_char_pos.y; currpoint.y = hc2 + current_char_pos.y;
...@@ -481,7 +481,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -481,7 +481,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
ptr++; ptr++;
// Apply the advance width // Apply the advance width
current_char_pos.x += wxRound( size_h * (xsto - xsta) * s_HerscheyScaleFactor ); current_char_pos.x += KiROUND( size_h * (xsto - xsta) * s_HerscheyScaleFactor );
} }
if( overbars % 2 ) if( overbars % 2 )
......
...@@ -16,9 +16,8 @@ ...@@ -16,9 +16,8 @@
#include <pcbcommon.h> #include <pcbcommon.h>
#include <pcbstruct.h> #include <pcbstruct.h>
#include <richio.h>
#include <filter_reader.h>
#include <footprint_info.h> #include <footprint_info.h>
#include <io_mgr.h>
#include <class_pad.h> #include <class_pad.h>
#include <class_module.h> #include <class_module.h>
...@@ -39,109 +38,68 @@ ...@@ -39,109 +38,68 @@
* ...... other data (pads, outlines ..) * ...... other data (pads, outlines ..)
* $Endmodule * $Endmodule
*/ */
bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames ) bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
{ {
FILE* file;
wxFileName filename;
wxString libname;
// Clear data before reading files // Clear data before reading files
m_filesNotFound.Empty(); m_filesNotFound.Empty();
m_filesInvalid.Empty(); m_filesInvalid.Empty();
m_List.clear(); m_List.clear();
/* Parse Libraries Listed */ // try
for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ )
{ {
filename = aFootprintsLibNames[ii]; PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
filename.SetExt( FootprintLibFileExtension );
libname = wxGetApp().FindLibraryPath( filename );
if( libname.IsEmpty() )
{
m_filesNotFound << filename.GetFullName() << wxT("\n");
continue;
}
/* Open library file */
file = wxFopen( libname, wxT( "rt" ) );
if( file == NULL ) // Parse Libraries Listed
for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ )
{ {
m_filesInvalid << libname << _(" (file cannot be opened)") << wxT("\n"); wxFileName filename = aFootprintsLibNames[ii];
continue;
}
FILE_LINE_READER fileReader( file, libname );
FILTER_READER reader( fileReader );
/* Read header. */ filename.SetExt( FootprintLibFileExtension );
reader.ReadLine();
char * line = reader.Line();
StrPurge( line );
if( strnicmp( line, FOOTPRINT_LIBRARY_HEADER, FOOTPRINT_LIBRARY_HEADER_CNT ) != 0 ) wxString libPath = wxGetApp().FindLibraryPath( filename );
{
wxString msg;
msg.Printf( _( "<%s> is not a valid KiCad PCB footprint library." ),
GetChars( libname ) );
m_filesInvalid << msg << wxT("\n");
continue;
}
// Read library if( !libPath )
bool end = false;
while( !end && reader.ReadLine() )
{
line = reader.Line();
StrPurge( line );
if( strnicmp( line, "$EndLIBRARY", 11 ) == 0 )
{ {
end = true; m_filesNotFound << filename.GetFullName() << wxT("\n");
break; continue;
} }
if( strnicmp( line, "$MODULE", 7 ) == 0 )
{
line += 7; try
FOOTPRINT_INFO* ItemLib = new FOOTPRINT_INFO(); {
ItemLib->m_Module = FROM_UTF8( StrPurge( line ) ); wxArrayString fpnames = pi->FootprintEnumerate( libPath );
ItemLib->m_LibName = libname;
AddItem( ItemLib );
while( reader.ReadLine() ) for( unsigned i=0; i<fpnames.GetCount(); ++i )
{ {
line = reader.Line(); auto_ptr<MODULE> m( pi->FootprintLoad( libPath, fpnames[i] ) );
StrPurge( line );
if( strnicmp( line, "$EndMODULE", 10 ) == 0 ) // we're loading what we enumerated, all must be there.
break; wxASSERT( m.get() );
if( strnicmp( line, "$PAD", 4 ) == 0 ) FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO();
ItemLib->m_padCount++;
fpinfo->m_Module = fpnames[i];
int id = ((line[0] & 0xFF) << 8) + (line[1] & 0xFF); fpinfo->m_LibName = libPath;
switch( id ) fpinfo->m_padCount = m->GetPadCount();
{ fpinfo->m_KeyWord = m->GetKeywords();
/* KeyWords */ fpinfo->m_Doc = m->GetDescription();
case (('K'<<8) + 'w'):
ItemLib->m_KeyWord = FROM_UTF8( StrPurge( line + 3 ) ); AddItem( fpinfo );
break;
/* Doc */
case (('C'<<8) + 'd'):
ItemLib->m_Doc = FROM_UTF8( StrPurge( line + 3 ) );
break;
}
} }
} }
catch( IO_ERROR ioe )
{
m_filesInvalid << ioe.errorText << wxT("\n");
}
} }
}
if( !end ) /* caller should catch this, UI seems not wanted here.
{ catch( IO_ERROR ioe )
m_filesInvalid << libname << _(" (Unexpected end of file)") << wxT("\n"); {
} DisplayError( NULL, ioe.errorText );
return false;
} }
*/
m_List.sort(); m_List.sort();
......
...@@ -1410,7 +1410,7 @@ void ClipAndDrawFilledPoly( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPoints[], in ...@@ -1410,7 +1410,7 @@ void ClipAndDrawFilledPoly( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPoints[], in
for( cpointIterator cit = outputPolygon.begin(); cit != outputPolygon.end(); ++cit ) for( cpointIterator cit = outputPolygon.begin(); cit != outputPolygon.end(); ++cit )
{ {
clippedPolygon.push_back( wxPoint( wxRound( cit->X ), wxRound( cit->Y ) ) ); clippedPolygon.push_back( wxPoint( KiROUND( cit->X ), KiROUND( cit->Y ) ) );
} }
if( clippedPolygon.size() ) if( clippedPolygon.size() )
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <macros.h> #include <macros.h>
#include <trigo.h> #include <trigo.h>
#include <common.h>
bool TestSegmentHit( wxPoint aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist ) bool TestSegmentHit( wxPoint aRefPoint, wxPoint aStart, wxPoint aEnd, int aDist )
{ {
...@@ -140,7 +140,7 @@ bool DistanceTest( int seuil, int dx, int dy, int spot_cX, int spot_cY ) ...@@ -140,7 +140,7 @@ bool DistanceTest( int seuil, int dx, int dy, int spot_cX, int spot_cY )
*/ */
int angle; int angle;
angle = wxRound( ( atan2( (double) segY, (double) segX ) * 1800.0 / M_PI ) ); angle = KiROUND( ( atan2( (double) segY, (double) segX ) * 1800.0 / M_PI ) );
cXrot = pointX; cXrot = pointX;
cYrot = pointY; cYrot = pointY;
...@@ -211,7 +211,7 @@ int ArcTangente( int dy, int dx ) ...@@ -211,7 +211,7 @@ int ArcTangente( int dy, int dx )
} }
fangle = atan2( (double) dy, (double) dx ) / M_PI * 1800; fangle = atan2( (double) dy, (double) dx ) / M_PI * 1800;
return wxRound( fangle ); return KiROUND( fangle );
} }
...@@ -253,8 +253,8 @@ void RotatePoint( int* pX, int* pY, double angle ) ...@@ -253,8 +253,8 @@ void RotatePoint( int* pX, int* pY, double angle )
double cosinus = cos( fangle ); double cosinus = cos( fangle );
double fpx = (*pY * sinus ) + (*pX * cosinus ); double fpx = (*pY * sinus ) + (*pX * cosinus );
double fpy = (*pY * cosinus ) - (*pX * sinus ); double fpy = (*pY * cosinus ) - (*pX * sinus );
*pX = wxRound( fpx ); *pX = KiROUND( fpx );
*pY = wxRound( fpy ); *pY = KiROUND( fpy );
} }
} }
......
This diff is collapsed.
...@@ -41,17 +41,14 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent, ...@@ -41,17 +41,14 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent,
int textsize, int textsize,
EDA_UNITS_T user_unit, EDA_UNITS_T user_unit,
wxBoxSizer* BoxSizer, wxBoxSizer* BoxSizer,
int framelen, int framelen )
int internal_unit )
{ {
m_UserUnit = user_unit; m_UserUnit = user_unit;
m_Internal_Unit = internal_unit;
m_Title = NULL; m_Title = NULL;
m_Title = new wxStaticText( parent, -1, Title ); m_Title = new wxStaticText( parent, -1, Title );
BoxSizer->Add( m_Title, 0, BoxSizer->Add( m_Title, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
m_FrameText = new wxTextCtrl( parent, -1, TextToEdit ); m_FrameText = new wxTextCtrl( parent, -1, TextToEdit );
...@@ -62,14 +59,12 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent, ...@@ -62,14 +59,12 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent,
wxString msg = _( "Size" ) + ReturnUnitSymbol( m_UserUnit ); wxString msg = _( "Size" ) + ReturnUnitSymbol( m_UserUnit );
wxStaticText* text = new wxStaticText( parent, -1, msg ); wxStaticText* text = new wxStaticText( parent, -1, msg );
BoxSizer->Add( text, 0, BoxSizer->Add( text, 0, wxGROW | wxLEFT | wxRIGHT, 5 );
wxGROW | wxLEFT | wxRIGHT, 5 );
} }
wxString value = FormatSize( m_Internal_Unit, m_UserUnit, textsize ); wxString value = FormatSize( m_UserUnit, textsize );
m_FrameSize = new wxTextCtrl( parent, -1, value, wxDefaultPosition, m_FrameSize = new wxTextCtrl( parent, -1, value, wxDefaultPosition, wxSize( 70, -1 ) );
wxSize( 70, -1 ) );
BoxSizer->Add( m_FrameSize, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); BoxSizer->Add( m_FrameSize, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
} }
...@@ -84,11 +79,8 @@ EDA_GRAPHIC_TEXT_CTRL::~EDA_GRAPHIC_TEXT_CTRL() ...@@ -84,11 +79,8 @@ EDA_GRAPHIC_TEXT_CTRL::~EDA_GRAPHIC_TEXT_CTRL()
} }
wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( int internalUnit, EDA_UNITS_T aUnit, wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( EDA_UNITS_T aUnit, int textSize )
int textSize )
{ {
wxString value;
// Limiting the size of the text of reasonable values. // Limiting the size of the text of reasonable values.
if( textSize < 10 ) if( textSize < 10 )
textSize = 10; textSize = 10;
...@@ -96,10 +88,7 @@ wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( int internalUnit, EDA_UNITS_T aUnit, ...@@ -96,10 +88,7 @@ wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( int internalUnit, EDA_UNITS_T aUnit,
if( textSize > 3000 ) if( textSize > 3000 )
textSize = 3000; textSize = 3000;
value.Printf( ( internalUnit > 1000 ) ? wxT( "%.4f" ) : wxT( "%.3f" ), return ReturnStringFromValue( aUnit, textSize );
To_User_Unit( aUnit, textSize ) );
return value;
} }
...@@ -117,7 +106,7 @@ void EDA_GRAPHIC_TEXT_CTRL::SetValue( const wxString& value ) ...@@ -117,7 +106,7 @@ void EDA_GRAPHIC_TEXT_CTRL::SetValue( const wxString& value )
void EDA_GRAPHIC_TEXT_CTRL::SetValue( int textSize ) void EDA_GRAPHIC_TEXT_CTRL::SetValue( int textSize )
{ {
wxString value = FormatSize( m_Internal_Unit, m_UserUnit, textSize ); wxString value = FormatSize( m_UserUnit, textSize );
m_FrameSize->SetValue( value ); m_FrameSize->SetValue( value );
} }
...@@ -129,12 +118,11 @@ const wxString EDA_GRAPHIC_TEXT_CTRL::GetText() const ...@@ -129,12 +118,11 @@ const wxString EDA_GRAPHIC_TEXT_CTRL::GetText() const
} }
int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText, int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText, EDA_UNITS_T aUnit )
int internalUnit, EDA_UNITS_T aUnit )
{ {
int textsize; int textsize;
textsize = ReturnValueFromString( aUnit, sizeText, internalUnit ); textsize = ReturnValueFromString( aUnit, sizeText );
// Limit to reasonable size // Limit to reasonable size
if( textsize < 10 ) if( textsize < 10 )
...@@ -149,7 +137,7 @@ int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText, ...@@ -149,7 +137,7 @@ int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText,
int EDA_GRAPHIC_TEXT_CTRL::GetTextSize() int EDA_GRAPHIC_TEXT_CTRL::GetTextSize()
{ {
return ParseSize( m_FrameSize->GetValue(), m_Internal_Unit, m_UserUnit ); return ParseSize( m_FrameSize->GetValue(), m_UserUnit );
} }
...@@ -166,13 +154,11 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent, ...@@ -166,13 +154,11 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent,
const wxString& title, const wxString& title,
const wxPoint& pos_to_edit, const wxPoint& pos_to_edit,
EDA_UNITS_T user_unit, EDA_UNITS_T user_unit,
wxBoxSizer* BoxSizer, wxBoxSizer* BoxSizer )
int internal_unit )
{ {
wxString text; wxString text;
m_UserUnit = user_unit; m_UserUnit = user_unit;
m_Internal_Unit = internal_unit;
if( title.IsEmpty() ) if( title.IsEmpty() )
text = _( "Pos " ); text = _( "Pos " );
...@@ -182,10 +168,8 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent, ...@@ -182,10 +168,8 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent,
text += _( "X" ) + ReturnUnitSymbol( m_UserUnit ); text += _( "X" ) + ReturnUnitSymbol( m_UserUnit );
m_TextX = new wxStaticText( parent, -1, text ); m_TextX = new wxStaticText( parent, -1, text );
BoxSizer->Add( m_TextX, 0, BoxSizer->Add( m_TextX, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 ); m_FramePosX = new wxTextCtrl( parent, -1, wxEmptyString, wxDefaultPosition );
m_FramePosX = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition );
BoxSizer->Add( m_FramePosX, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); BoxSizer->Add( m_FramePosX, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
...@@ -198,8 +182,7 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent, ...@@ -198,8 +182,7 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent,
m_TextY = new wxStaticText( parent, -1, text ); m_TextY = new wxStaticText( parent, -1, text );
BoxSizer->Add( m_TextY, 0, BoxSizer->Add( m_TextY, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
m_FramePosY = new wxTextCtrl( parent, -1, wxEmptyString ); m_FramePosY = new wxTextCtrl( parent, -1, wxEmptyString );
...@@ -224,8 +207,8 @@ wxPoint EDA_POSITION_CTRL::GetValue() ...@@ -224,8 +207,8 @@ wxPoint EDA_POSITION_CTRL::GetValue()
{ {
wxPoint coord; wxPoint coord;
coord.x = ReturnValueFromString( m_UserUnit, m_FramePosX->GetValue(), m_Internal_Unit ); coord.x = ReturnValueFromString( m_UserUnit, m_FramePosX->GetValue() );
coord.y = ReturnValueFromString( m_UserUnit, m_FramePosY->GetValue(), m_Internal_Unit ); coord.y = ReturnValueFromString( m_UserUnit, m_FramePosY->GetValue() );
return coord; return coord;
} }
...@@ -259,12 +242,10 @@ void EDA_POSITION_CTRL::SetValue( int x_value, int y_value ) ...@@ -259,12 +242,10 @@ void EDA_POSITION_CTRL::SetValue( int x_value, int y_value )
/* EDA_SIZE_CTRL */ /* EDA_SIZE_CTRL */
/*******************/ /*******************/
EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit, const wxSize& size_to_edit, EDA_UNITS_T aUnit,
EDA_UNITS_T aUnit, wxBoxSizer* aBoxSizer, wxBoxSizer* aBoxSizer ) :
int internal_unit ) : EDA_POSITION_CTRL( parent, title, wxPoint( size_to_edit.x, size_to_edit.y ),
EDA_POSITION_CTRL( parent, title, aUnit, aBoxSizer )
wxPoint( size_to_edit.x, size_to_edit.y ),
aUnit, aBoxSizer, internal_unit )
{ {
} }
...@@ -284,23 +265,20 @@ wxSize EDA_SIZE_CTRL::GetValue() ...@@ -284,23 +265,20 @@ wxSize EDA_SIZE_CTRL::GetValue()
/* Class to display and edit a dimension INCHES, MM, or other */ /* Class to display and edit a dimension INCHES, MM, or other */
/**************************************************************/ /**************************************************************/
EDA_VALUE_CTRL::EDA_VALUE_CTRL( wxWindow* parent, const wxString& title, EDA_VALUE_CTRL::EDA_VALUE_CTRL( wxWindow* parent, const wxString& title,
int value, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer, int value, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer )
int internal_unit )
{ {
wxString label = title; wxString label = title;
m_UserUnit = user_unit; m_UserUnit = user_unit;
m_Internal_Unit = internal_unit;
m_Value = value; m_Value = value;
label += ReturnUnitSymbol( m_UserUnit ); label += ReturnUnitSymbol( m_UserUnit );
m_Text = new wxStaticText( parent, -1, label ); m_Text = new wxStaticText( parent, -1, label );
BoxSizer->Add( m_Text, 0, BoxSizer->Add( m_Text, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
wxString stringvalue = ReturnStringFromValue( m_UserUnit, m_Value ); wxString stringvalue = ReturnStringFromValue( m_UserUnit, m_Value );
m_ValueCtrl = new wxTextCtrl( parent, -1, stringvalue ); m_ValueCtrl = new wxTextCtrl( parent, -1, stringvalue );
BoxSizer->Add( m_ValueCtrl, BoxSizer->Add( m_ValueCtrl,
0, 0,
...@@ -321,7 +299,7 @@ int EDA_VALUE_CTRL::GetValue() ...@@ -321,7 +299,7 @@ int EDA_VALUE_CTRL::GetValue()
int coord; int coord;
wxString txtvalue = m_ValueCtrl->GetValue(); wxString txtvalue = m_ValueCtrl->GetValue();
coord = ReturnValueFromString( m_UserUnit, txtvalue, m_Internal_Unit ); coord = ReturnValueFromString( m_UserUnit, txtvalue );
return coord; return coord;
} }
......
...@@ -380,25 +380,25 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi ...@@ -380,25 +380,25 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
case WXK_NUMPAD8: /* cursor moved up */ case WXK_NUMPAD8: /* cursor moved up */
case WXK_UP: case WXK_UP:
pos.y -= wxRound( gridSize.y ); pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD2: /* cursor moved down */ case WXK_NUMPAD2: /* cursor moved down */
case WXK_DOWN: case WXK_DOWN:
pos.y += wxRound( gridSize.y ); pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD4: /* cursor moved left */ case WXK_NUMPAD4: /* cursor moved left */
case WXK_LEFT: case WXK_LEFT:
pos.x -= wxRound( gridSize.x ); pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD6: /* cursor moved right */ case WXK_NUMPAD6: /* cursor moved right */
case WXK_RIGHT: case WXK_RIGHT:
pos.x += wxRound( gridSize.x ); pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
} }
......
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
#include <cvpcb.h> #include <cvpcb.h>
#include <cvpcb_mainframe.h> #include <cvpcb_mainframe.h>
#include <class_DisplayFootprintsFrame.h> #include <class_DisplayFootprintsFrame.h>
#include <richio.h> #include <io_mgr.h>
#include <filter_reader.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
...@@ -29,122 +28,50 @@ ...@@ -29,122 +28,50 @@
* @param CmpName - Module name * @param CmpName - Module name
* @return - a pointer to the loaded module or NULL. * @return - a pointer to the loaded module or NULL.
*/ */
MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& CmpName ) MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
{ {
int Found = 0;
unsigned ii;
char* Line;
char Name[255];
wxString tmp, msg;
wxFileName fn;
MODULE* Module = NULL;
CVPCB_MAINFRAME* parent = ( CVPCB_MAINFRAME* ) GetParent(); CVPCB_MAINFRAME* parent = ( CVPCB_MAINFRAME* ) GetParent();
for( ii = 0; ii < parent->m_ModuleLibNames.GetCount(); ii++ ) try
{ {
fn = parent->m_ModuleLibNames[ii]; PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
fn.SetExt( FootprintLibFileExtension );
tmp = wxGetApp().FindLibraryPath( fn ); for( unsigned i = 0; i < parent->m_ModuleLibNames.GetCount(); ++i )
if( !tmp )
{
msg.Printf( _( "PCB foot print library file <%s> could not be \
found in the default search paths." ),
GetChars( fn.GetFullName() ) );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
continue;
}
FILE* file = wxFopen( tmp, wxT( "rt" ) );
if( file == NULL )
{ {
msg.Printf( _( "Could not open PCB foot print library file <%s>." ), wxFileName fn = parent->m_ModuleLibNames[i];
GetChars( tmp ) );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
continue;
}
FILE_LINE_READER fileReader( file, tmp ); fn.SetExt( FootprintLibFileExtension );
FILTER_READER reader( fileReader ); wxString libPath = wxGetApp().FindLibraryPath( fn );
/* Read header. */ if( !libPath )
reader.ReadLine();
Line = reader.Line();
StrPurge( Line );
if( strnicmp( Line, FOOTPRINT_LIBRARY_HEADER, FOOTPRINT_LIBRARY_HEADER_CNT ) != 0 )
{
msg.Printf( _( "<%s> is not a valid KiCad PCB foot print library." ),
GetChars( tmp ) );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
fclose( file );
return NULL;
}
Found = 0;
while( !Found && reader.ReadLine() )
{
Line = reader.Line();
if( strncmp( Line, "$MODULE", 6 ) == 0 )
break;
if( strnicmp( Line, "$INDEX", 6 ) == 0 )
{ {
while( reader.ReadLine() ) wxString msg = wxString::Format(
{ _("PCB foot print library file <%s> could not be found in the default search paths." ),
Line = reader.Line(); fn.GetFullName().GetData() );
if( strnicmp( Line, "$EndINDEX", 9 ) == 0 )
break;
StrPurge( Line );
if( stricmp( Line, TO_UTF8( CmpName ) ) == 0 ) // @todo we should not be using wxMessageBox directly.
{ wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
Found = 1;
break;
}
}
}
}
while( Found && reader.ReadLine() )
{
Line = reader.Line();
if( Line[0] != '$' )
continue;
if( Line[1] != 'M' )
continue;
if( strnicmp( Line, "$MODULE", 7 ) != 0 )
continue; continue;
}
/* Read component name. */ MODULE* footprint = pi->FootprintLoad( libPath, aFootprintName );
sscanf( Line + 7, " %s", Name );
if( stricmp( Name, TO_UTF8( CmpName ) ) == 0 ) if( footprint )
{ {
Module = new MODULE( GetBoard() ); footprint->SetPosition( wxPoint( 0, 0 ) );
return footprint;
// Switch the locale to standard C (needed to print floating
// point numbers like 1.3)
SetLocaleTo_C_standard();
Module->ReadDescr( &reader );
SetLocaleTo_Default(); // revert to the current locale
Module->SetPosition( wxPoint( 0, 0 ) );
return Module;
} }
} }
}
file = NULL; catch( IO_ERROR ioe )
{
DisplayError( this, ioe.errorText );
return NULL;
} }
msg.Printf( _( "Module %s not found" ), CmpName.GetData() ); wxString msg = wxString::Format( _( "Footprint '%s' not found" ), aFootprintName.GetData() );
DisplayError( this, msg ); DisplayError( this, msg );
return NULL; return NULL;
} }
...@@ -208,25 +208,25 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -208,25 +208,25 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
case WXK_NUMPAD8: case WXK_NUMPAD8:
case WXK_UP: case WXK_UP:
pos.y -= wxRound( gridSize.y ); pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD2: case WXK_NUMPAD2:
case WXK_DOWN: case WXK_DOWN:
pos.y += wxRound( gridSize.y ); pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD4: case WXK_NUMPAD4:
case WXK_LEFT: case WXK_LEFT:
pos.x -= wxRound( gridSize.x ); pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD6: case WXK_NUMPAD6:
case WXK_RIGHT: case WXK_RIGHT:
pos.x += wxRound( gridSize.x ); pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
...@@ -293,25 +293,25 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -293,25 +293,25 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
case WXK_NUMPAD8: case WXK_NUMPAD8:
case WXK_UP: case WXK_UP:
pos.y -= wxRound( gridSize.y ); pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD2: case WXK_NUMPAD2:
case WXK_DOWN: case WXK_DOWN:
pos.y += wxRound( gridSize.y ); pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD4: case WXK_NUMPAD4:
case WXK_LEFT: case WXK_LEFT:
pos.x -= wxRound( gridSize.x ); pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD6: case WXK_NUMPAD6:
case WXK_RIGHT: case WXK_RIGHT:
pos.x += wxRound( gridSize.x ); pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
...@@ -375,25 +375,25 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -375,25 +375,25 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
case WXK_NUMPAD8: case WXK_NUMPAD8:
case WXK_UP: case WXK_UP:
pos.y -= wxRound( gridSize.y ); pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD2: case WXK_NUMPAD2:
case WXK_DOWN: case WXK_DOWN:
pos.y += wxRound( gridSize.y ); pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD4: case WXK_NUMPAD4:
case WXK_LEFT: case WXK_LEFT:
pos.x -= wxRound( gridSize.x ); pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD6: case WXK_NUMPAD6:
case WXK_RIGHT: case WXK_RIGHT:
pos.x += wxRound( gridSize.x ); pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
......
...@@ -92,8 +92,7 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event ) ...@@ -92,8 +92,7 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
void DIALOG_SVG_PRINT::SetPenWidth() void DIALOG_SVG_PRINT::SetPenWidth()
{ {
g_DrawDefaultLineThickness = g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth );
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() );
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE ) if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
{ {
...@@ -118,7 +117,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref ) ...@@ -118,7 +117,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
SetPenWidth(); SetPenWidth();
g_DrawDefaultLineThickness = g_DrawDefaultLineThickness =
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() ); ReturnValueFromTextCtrl( *m_DialogPenWidth );
SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen();
...@@ -216,7 +215,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, ...@@ -216,7 +215,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
LOCALE_IO toggle; LOCALE_IO toggle;
float dpi = (float) frame->GetInternalUnits(); float dpi = 1000.0;
KicadSVGFileDC dc( FullFileName, sheetSize.x, sheetSize.y, dpi ); KicadSVGFileDC dc( FullFileName, sheetSize.x, sheetSize.y, dpi );
EDA_RECT tmp = *panel->GetClipBox(); EDA_RECT tmp = *panel->GetClipBox();
...@@ -228,6 +227,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, ...@@ -228,6 +227,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) ); wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) );
screen->m_IsPrinting = true; screen->m_IsPrinting = true;
if( frame->IsType( SCHEMATIC_FRAME ) ) if( frame->IsType( SCHEMATIC_FRAME ) )
screen->Draw( panel, &dc, GR_COPY ); screen->Draw( panel, &dc, GR_COPY );
...@@ -237,7 +237,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, ...@@ -237,7 +237,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
sheetSize.y/2) ); sheetSize.y/2) );
if( aPrint_Sheet_Ref ) if( aPrint_Sheet_Ref )
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness ); frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->SetClipBox( tmp ); panel->SetClipBox( tmp );
......
...@@ -39,7 +39,6 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY() ...@@ -39,7 +39,6 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY()
*/ */
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg() void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg()
{ {
SetFocus();
m_AliasLocation = -1; m_AliasLocation = -1;
LIB_COMPONENT* component = m_Parent->GetComponent(); LIB_COMPONENT* component = m_Parent->GetComponent();
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
...@@ -50,6 +50,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -50,6 +50,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_OptionsBoxSizer->Add( m_PinsNameInsideButt, 0, wxALL, 5 ); m_OptionsBoxSizer->Add( m_PinsNameInsideButt, 0, wxALL, 5 );
bSizerBasicPanel->Add( m_OptionsBoxSizer, 0, 0, 5 ); bSizerBasicPanel->Add( m_OptionsBoxSizer, 0, 0, 5 );
m_staticline3 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline3 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
...@@ -70,6 +71,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -70,6 +71,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 26, 1 ); m_SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 26, 1 );
bSizernbunits->Add( m_SelNumberOfUnits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bSizernbunits->Add( m_SelNumberOfUnits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizerMidBasicPanel->Add( bSizernbunits, 1, wxEXPAND, 5 ); bSizerMidBasicPanel->Add( bSizernbunits, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer17; wxBoxSizer* bSizer17;
...@@ -84,8 +86,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -84,8 +86,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_SetSkew = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 ); m_SetSkew = new wxSpinCtrl( m_PanelBasic, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 0 );
bSizer17->Add( m_SetSkew, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizer17->Add( m_SetSkew, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMidBasicPanel->Add( bSizer17, 1, wxEXPAND, 5 ); bSizerMidBasicPanel->Add( bSizer17, 1, wxEXPAND, 5 );
bSizerBasicPanel->Add( bSizerMidBasicPanel, 0, wxEXPAND, 5 ); bSizerBasicPanel->Add( bSizerMidBasicPanel, 0, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline1 = new wxStaticLine( m_PanelBasic, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
...@@ -101,6 +105,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -101,6 +105,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
bSizerBasicPanel->Add( m_OptionPartsLocked, 0, wxALL, 5 ); bSizerBasicPanel->Add( m_OptionPartsLocked, 0, wxALL, 5 );
m_PanelBasic->SetSizer( bSizerBasicPanel ); m_PanelBasic->SetSizer( bSizerBasicPanel );
m_PanelBasic->Layout(); m_PanelBasic->Layout();
bSizerBasicPanel->Fit( m_PanelBasic ); bSizerBasicPanel->Fit( m_PanelBasic );
...@@ -145,8 +150,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -145,8 +150,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_buttonBrowseDocFiles = new wxButton( m_PanelDoc, ID_BROWSE_DOC_FILES, _("Browse DocFiles"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonBrowseDocFiles = new wxButton( m_PanelDoc, ID_BROWSE_DOC_FILES, _("Browse DocFiles"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPaneldocbutts->Add( m_buttonBrowseDocFiles, 0, wxALL, 5 ); bSizerPaneldocbutts->Add( m_buttonBrowseDocFiles, 0, wxALL, 5 );
m_PanelDocBoxSizer->Add( bSizerPaneldocbutts, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); m_PanelDocBoxSizer->Add( bSizerPaneldocbutts, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
m_PanelDoc->SetSizer( m_PanelDocBoxSizer ); m_PanelDoc->SetSizer( m_PanelDocBoxSizer );
m_PanelDoc->Layout(); m_PanelDoc->Layout();
m_PanelDocBoxSizer->Fit( m_PanelDoc ); m_PanelDocBoxSizer->Fit( m_PanelDoc );
...@@ -167,6 +174,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -167,6 +174,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_PartAliasListCtrl = new wxListBox( m_PanelAlias, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_PartAliasListCtrl = new wxListBox( m_PanelAlias, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bLeftBoxSizerPanelAlias->Add( m_PartAliasListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bLeftBoxSizerPanelAlias->Add( m_PartAliasListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMainPanelAlias->Add( bLeftBoxSizerPanelAlias, 1, wxEXPAND, 5 ); bSizerMainPanelAlias->Add( bLeftBoxSizerPanelAlias, 1, wxEXPAND, 5 );
wxBoxSizer* bRightBoxSizerPanelAlias; wxBoxSizer* bRightBoxSizerPanelAlias;
...@@ -181,8 +189,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -181,8 +189,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_ButtonDeleteAllAlias = new wxButton( m_PanelAlias, ID_DELETE_ALL_ALIAS, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 ); m_ButtonDeleteAllAlias = new wxButton( m_PanelAlias, ID_DELETE_ALL_ALIAS, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 );
bRightBoxSizerPanelAlias->Add( m_ButtonDeleteAllAlias, 0, wxALL, 5 ); bRightBoxSizerPanelAlias->Add( m_ButtonDeleteAllAlias, 0, wxALL, 5 );
bSizerMainPanelAlias->Add( bRightBoxSizerPanelAlias, 0, wxALIGN_CENTER_VERTICAL, 5 ); bSizerMainPanelAlias->Add( bRightBoxSizerPanelAlias, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_PanelAlias->SetSizer( bSizerMainPanelAlias ); m_PanelAlias->SetSizer( bSizerMainPanelAlias );
m_PanelAlias->Layout(); m_PanelAlias->Layout();
bSizerMainPanelAlias->Fit( m_PanelAlias ); bSizerMainPanelAlias->Fit( m_PanelAlias );
...@@ -203,6 +213,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -203,6 +213,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_FootprintFilterListBox = new wxListBox( m_PanelFootprintFilter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_FootprintFilterListBox = new wxListBox( m_PanelFootprintFilter, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bFpFilterLeftBoxSizer->Add( m_FootprintFilterListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bFpFilterLeftBoxSizer->Add( m_FootprintFilterListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bPanelFpFilterBoxSizer->Add( bFpFilterLeftBoxSizer, 1, wxEXPAND, 5 ); bPanelFpFilterBoxSizer->Add( bFpFilterLeftBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bFpFilterRightBoxSizer; wxBoxSizer* bFpFilterRightBoxSizer;
...@@ -217,8 +228,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -217,8 +228,10 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_ButtonDeleteAllFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ALL_FOOTPRINT_FILTER, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 ); m_ButtonDeleteAllFootprintFilter = new wxButton( m_PanelFootprintFilter, ID_DELETE_ALL_FOOTPRINT_FILTER, _("Delete All"), wxDefaultPosition, wxDefaultSize, 0 );
bFpFilterRightBoxSizer->Add( m_ButtonDeleteAllFootprintFilter, 0, wxALL|wxEXPAND, 5 ); bFpFilterRightBoxSizer->Add( m_ButtonDeleteAllFootprintFilter, 0, wxALL|wxEXPAND, 5 );
bPanelFpFilterBoxSizer->Add( bFpFilterRightBoxSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); bPanelFpFilterBoxSizer->Add( bFpFilterRightBoxSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_PanelFootprintFilter->SetSizer( bPanelFpFilterBoxSizer ); m_PanelFootprintFilter->SetSizer( bPanelFpFilterBoxSizer );
m_PanelFootprintFilter->Layout(); m_PanelFootprintFilter->Layout();
bPanelFpFilterBoxSizer->Fit( m_PanelFootprintFilter ); bPanelFpFilterBoxSizer->Fit( m_PanelFootprintFilter );
...@@ -226,6 +239,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -226,6 +239,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
bUpperSizer->Add( m_NoteBook, 1, wxEXPAND, 5 ); bUpperSizer->Add( m_NoteBook, 1, wxEXPAND, 5 );
bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 ); bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_stdSizerButton = new wxStdDialogButtonSizer(); m_stdSizerButton = new wxStdDialogButtonSizer();
...@@ -234,10 +248,13 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -234,10 +248,13 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_stdSizerButtonCancel = new wxButton( this, wxID_CANCEL ); m_stdSizerButtonCancel = new wxButton( this, wxID_CANCEL );
m_stdSizerButton->AddButton( m_stdSizerButtonCancel ); m_stdSizerButton->AddButton( m_stdSizerButtonCancel );
m_stdSizerButton->Realize(); m_stdSizerButton->Realize();
bMainSizer->Add( m_stdSizerButton, 0, wxEXPAND|wxALL, 5 ); bMainSizer->Add( m_stdSizerButton, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this );
// Connect Events // Connect Events
m_ButtonCopyDoc->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocToAlias ), NULL, this ); m_ButtonCopyDoc->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocToAlias ), NULL, this );
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011) // C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -47,7 +48,7 @@ ...@@ -47,7 +48,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE /// Class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public wxDialog class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public DIALOG_SHIM
{ {
private: private:
...@@ -106,7 +107,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public wxDialog ...@@ -106,7 +107,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public wxDialog
public: public:
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wxWindow* parent, wxWindowID id = ID_LIBEDIT_NOTEBOOK, const wxString& title = _("Lib Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 465,384 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wxWindow* parent, wxWindowID id = ID_LIBEDIT_NOTEBOOK, const wxString& title = _("Lib Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE(); ~DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE();
}; };
......
...@@ -631,8 +631,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel() ...@@ -631,8 +631,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
else else
fieldValueTextCtrl->Enable( true ); fieldValueTextCtrl->Enable( true );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( EESCHEMA_INTERNAL_UNIT, textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.m_Size.x ) );
g_UserUnit, field.m_Size.x ) );
wxPoint coord = field.m_Pos; wxPoint coord = field.m_Pos;
wxPoint zero = -m_Cmp->m_Pos; // relative zero wxPoint zero = -m_Cmp->m_Pos; // relative zero
...@@ -711,11 +710,11 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() ...@@ -711,11 +710,11 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), g_UserUnit );
EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.y = field.m_Size.x; field.m_Size.y = field.m_Size.x;
int style = m_StyleRadioBox->GetSelection(); int style = m_StyleRadioBox->GetSelection();
if( (style & 1 ) != 0 ) if( (style & 1 ) != 0 )
field.m_Italic = true; field.m_Italic = true;
else else
...@@ -726,10 +725,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() ...@@ -726,10 +725,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
else else
field.m_Bold = false; field.m_Bold = false;
field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue(), field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
EESCHEMA_INTERNAL_UNIT ); field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT );
return true; return true;
} }
......
...@@ -261,7 +261,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent ) ...@@ -261,7 +261,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
m_CurrentText->SetOrientation( m_TextOrient->GetSelection() ); m_CurrentText->SetOrientation( m_TextOrient->GetSelection() );
text = m_TextSize->GetValue(); text = m_TextSize->GetValue();
value = ReturnValueFromString( g_UserUnit, text, m_Parent->GetInternalUnits() ); value = ReturnValueFromString( g_UserUnit, text );
m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value; m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value;
if( m_TextShape ) if( m_TextShape )
......
...@@ -658,8 +658,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() ...@@ -658,8 +658,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
fieldValueTextCtrl->SetValue( field.m_Text ); fieldValueTextCtrl->SetValue( field.m_Text );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( EESCHEMA_INTERNAL_UNIT, textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.m_Size.x ) );
g_UserUnit, field.m_Size.x ) );
wxPoint coord = field.m_Pos; wxPoint coord = field.m_Pos;
wxPoint zero; wxPoint zero;
...@@ -745,8 +744,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField() ...@@ -745,8 +744,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), g_UserUnit );
EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.y = field.m_Size.x; field.m_Size.y = field.m_Size.x;
...@@ -761,10 +759,8 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField() ...@@ -761,10 +759,8 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
else else
field.m_Bold = false; field.m_Bold = false;
field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue(), field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
EESCHEMA_INTERNAL_UNIT ); field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT );
// Note: the Y axis for components in lib is from bottom to top // Note: the Y axis for components in lib is from bottom to top
// and the screen axis is top to bottom: we must change the y coord sign for editing // and the screen axis is top to bottom: we must change the y coord sign for editing
......
...@@ -133,7 +133,7 @@ void DIALOG_EDIT_ONE_FIELD::TransfertDataToField() ...@@ -133,7 +133,7 @@ void DIALOG_EDIT_ONE_FIELD::TransfertDataToField()
{ {
m_textorient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ; m_textorient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
wxString msg = m_TextSize->GetValue(); wxString msg = m_TextSize->GetValue();
m_textsize = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); m_textsize = ReturnValueFromString( g_UserUnit, msg );
switch( m_TextHJustificationOpt->GetSelection() ) switch( m_TextHJustificationOpt->GetSelection() )
{ {
......
...@@ -145,9 +145,13 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx ...@@ -145,9 +145,13 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
bSizer2->Add( m_checkShowHiddenPins, 0, wxALL|wxEXPAND, 3 ); bSizer2->Add( m_checkShowHiddenPins, 0, wxALL|wxEXPAND, 3 );
m_checkEnableMiddleButtonPan = new wxCheckBox( m_panel1, xwID_ANY, _("Enable middle mouse button panning"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkEnableMiddleButtonPan = new wxCheckBox( m_panel1, xwID_ANY, _("Enable middle mouse button panning"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkEnableMiddleButtonPan->SetToolTip( _("Use middle mouse button dragging to pan") );
bSizer2->Add( m_checkEnableMiddleButtonPan, 0, wxALL, 3 ); bSizer2->Add( m_checkEnableMiddleButtonPan, 0, wxALL, 3 );
m_checkMiddleButtonPanLimited = new wxCheckBox( m_panel1, wxID_ANY, _("Middle mouse button panning limited by current toolbar panning"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkMiddleButtonPanLimited = new wxCheckBox( m_panel1, wxID_ANY, _("Middle mouse button panning limited"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkMiddleButtonPanLimited->SetToolTip( _("Middle mouse button panning limited by current scrollbar size") );
bSizer2->Add( m_checkMiddleButtonPanLimited, 0, wxALL, 3 ); bSizer2->Add( m_checkMiddleButtonPanLimited, 0, wxALL, 3 );
m_checkAutoPan = new wxCheckBox( m_panel1, wxID_ANY, _("Enable automatic &panning"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkAutoPan = new wxCheckBox( m_panel1, wxID_ANY, _("Enable automatic &panning"), wxDefaultPosition, wxDefaultSize, 0 );
......
...@@ -2533,7 +2533,7 @@ ...@@ -2533,7 +2533,7 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip">Use middle mouse button dragging to pan</property>
<property name="validator_data_type"></property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property> <property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
...@@ -2600,7 +2600,7 @@ ...@@ -2600,7 +2600,7 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Middle mouse button panning limited by current toolbar panning</property> <property name="label">Middle mouse button panning limited</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
...@@ -2621,7 +2621,7 @@ ...@@ -2621,7 +2621,7 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip">Middle mouse button panning limited by current scrollbar size</property>
<property name="validator_data_type"></property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property> <property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
......
#include <fctsys.h> #include <fctsys.h>
#include <macros.h> #include <macros.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <base_units.h>
#include <libeditframe.h> #include <libeditframe.h>
#include <class_libentry.h> #include <class_libentry.h>
#include <lib_pin.h> #include <lib_pin.h>
...@@ -91,11 +93,11 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) ...@@ -91,11 +93,11 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event )
{ {
if( ! IsShown() ) // do nothing at init time if( ! IsShown() ) // do nothing at init time
return; return;
int units = ((LIB_EDIT_FRAME*)GetParent())->GetInternalUnits();
int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize(), units ); int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize() );
int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize(), units); int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize());
int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() ); int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() );
int pinLength = ReturnValueFromString( g_UserUnit, GetLength(), units ); int pinLength = ReturnValueFromString( g_UserUnit, GetLength() );
int pinShape = LIB_PIN::GetStyleCode( GetStyle() ); int pinShape = LIB_PIN::GetStyleCode( GetStyle() );
int pinType = GetElectricalType(); int pinType = GetElectricalType();
......
...@@ -148,7 +148,7 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event ) ...@@ -148,7 +148,7 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
Line = m_TextValue->GetValue(); Line = m_TextValue->GetValue();
m_parent->m_textOrientation = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ; m_parent->m_textOrientation = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
wxString msg = m_TextSize->GetValue(); wxString msg = m_TextSize->GetValue();
m_parent->m_textSize = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); m_parent->m_textSize = ReturnValueFromString( g_UserUnit, msg );
m_parent->m_drawSpecificConvert = m_CommonConvert->GetValue() ? false : true; m_parent->m_drawSpecificConvert = m_CommonConvert->GetValue() ? false : true;
m_parent->m_drawSpecificUnit = m_CommonUnit->GetValue() ? false : true; m_parent->m_drawSpecificUnit = m_CommonUnit->GetValue() ? false : true;
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008) // C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_lib_new_component_base__ #ifndef __DIALOG_LIB_NEW_COMPONENT_BASE_H__
#define __dialog_lib_new_component_base__ #define __DIALOG_LIB_NEW_COMPONENT_BASE_H__
#include <wx/intl.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/string.h> #include <wx/intl.h>
#include <wx/stattext.h> #include "dialog_shim.h"
#include <wx/gdicmn.h> #include <wx/string.h>
#include <wx/font.h> #include <wx/stattext.h>
#include <wx/colour.h> #include <wx/gdicmn.h>
#include <wx/settings.h> #include <wx/font.h>
#include <wx/textctrl.h> #include <wx/colour.h>
#include <wx/sizer.h> #include <wx/settings.h>
#include <wx/spinctrl.h> #include <wx/textctrl.h>
#include <wx/checkbox.h> #include <wx/sizer.h>
#include <wx/button.h> #include <wx/spinctrl.h>
#include <wx/dialog.h> #include <wx/checkbox.h>
#include <wx/button.h>
/////////////////////////////////////////////////////////////////////////// #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LIB_NEW_COMPONENT_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIB_NEW_COMPONENT_BASE : public wxDialog /// Class DIALOG_LIB_NEW_COMPONENT_BASE
{ ///////////////////////////////////////////////////////////////////////////////
private: class DIALOG_LIB_NEW_COMPONENT_BASE : public DIALOG_SHIM
{
protected: private:
wxStaticText* m_staticText6;
protected:
wxStaticText* m_staticText2; wxStaticText* m_staticText6;
wxStaticText* m_staticText2;
wxTextCtrl* m_textName; wxTextCtrl* m_textName;
wxStaticText* m_staticText3;
wxTextCtrl* m_textReference;
wxStaticText* m_staticText3; wxStaticText* m_staticText4;
wxSpinCtrl* m_spinPartCount;
wxTextCtrl* m_textReference; wxCheckBox* m_checkHasConversion;
wxCheckBox* m_checkIsPowerSymbol;
wxCheckBox* m_checkLockItems;
wxStaticText* m_staticText4; wxStaticText* m_staticText7;
wxStaticText* m_staticText41;
wxSpinCtrl* m_spinPartCount; wxSpinCtrl* m_spinPinTextPosition;
wxStaticText* m_staticText5;
wxCheckBox* m_checkShowPinNumber;
wxCheckBox* m_checkHasConversion; wxCheckBox* m_checkShowPinName;
wxCheckBox* m_checkShowPinNameInside;
wxCheckBox* m_checkIsPowerSymbol; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxCheckBox* m_checkLockItems; wxButton* m_sdbSizerCancel;
wxStaticText* m_staticText7; public:
wxStaticText* m_staticText41; DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_NEW_COMPONENT_BASE();
wxSpinCtrl* m_spinPinTextPosition;
wxStaticText* m_staticText5; };
wxCheckBox* m_checkShowPinNumber; #endif //__DIALOG_LIB_NEW_COMPONENT_BASE_H__
wxCheckBox* m_checkShowPinName;
wxCheckBox* m_checkShowPinNameInside;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
public:
DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_NEW_COMPONENT_BASE();
};
#endif //__dialog_lib_new_component_base__
...@@ -207,19 +207,19 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event ) ...@@ -207,19 +207,19 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event )
{ {
wxString msg = m_PlotOrgPosition_X->GetValue(); wxString msg = m_PlotOrgPosition_X->GetValue();
s_Offset.x = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT ); s_Offset.x = ReturnValueFromString( g_UserUnit, msg );
msg = m_PlotOrgPosition_Y->GetValue(); msg = m_PlotOrgPosition_Y->GetValue();
s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT ); s_Offset.y = ReturnValueFromString( g_UserUnit, msg );
} }
} }
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenWidth( ) void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenWidth( )
{ {
g_HPGL_Pen_Descr.m_Pen_Diam = ReturnValueFromTextCtrl( *m_penWidthCtrl, g_HPGL_Pen_Descr.m_Pen_Diam = ReturnValueFromTextCtrl( *m_penWidthCtrl );
EESCHEMA_INTERNAL_UNIT);
if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 ) if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 )
g_HPGL_Pen_Descr.m_Pen_Diam = 100; g_HPGL_Pen_Descr.m_Pen_Diam = 100;
...@@ -262,11 +262,11 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll ) ...@@ -262,11 +262,11 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll )
{ {
wxString msg = m_PlotOrgPosition_X->GetValue(); wxString msg = m_PlotOrgPosition_X->GetValue();
s_Offset.x = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT ); s_Offset.x = ReturnValueFromString( g_UserUnit, msg );
msg = m_PlotOrgPosition_Y->GetValue(); msg = m_PlotOrgPosition_Y->GetValue();
s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT ); s_Offset.y = ReturnValueFromString( g_UserUnit, msg );
} }
Plot_Schematic_HPGL( aPlotAll ); Plot_Schematic_HPGL( aPlotAll );
......
...@@ -164,8 +164,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars() ...@@ -164,8 +164,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars()
m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue(); m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue();
m_plotColorOpt = m_PlotPSColorOption->GetSelection(); m_plotColorOpt = m_PlotPSColorOption->GetSelection();
m_pageSizeSelect = m_SizeOption->GetSelection(); m_pageSizeSelect = m_SizeOption->GetSelection();
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl, g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl );
EESCHEMA_INTERNAL_UNIT );
if( g_DrawDefaultLineThickness < 1 ) if( g_DrawDefaultLineThickness < 1 )
g_DrawDefaultLineThickness = 1; g_DrawDefaultLineThickness = 1;
} }
......
...@@ -378,7 +378,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen ) ...@@ -378,7 +378,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE ); aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
if( printReference ) if( printReference )
parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness ); parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
g_DrawBgColor = bg_color; g_DrawBgColor = bg_color;
aScreen->m_IsPrinting = false; aScreen->m_IsPrinting = false;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <gr_basic.h> #include <gr_basic.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <base_units.h>
#include <general.h> #include <general.h>
#include <class_library.h> #include <class_library.h>
...@@ -70,7 +71,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -70,7 +71,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->Draw( m_canvas, DC, GR_DEFAULT_DRAWMODE ); GetScreen()->Draw( m_canvas, DC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness ); TraceWorkSheet( DC, GetScreen(), g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY
if( IsShown() ) if( IsShown() )
......
...@@ -188,7 +188,7 @@ bool LIB_ARC::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTran ...@@ -188,7 +188,7 @@ bool LIB_ARC::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTran
NEGATE( relativePosition.y ); // reverse Y axis NEGATE( relativePosition.y ); // reverse Y axis
int distance = wxRound( EuclideanNorm( TwoPointVector( m_Pos, relativePosition ) ) ); int distance = KiROUND( EuclideanNorm( TwoPointVector( m_Pos, relativePosition ) ) );
if( abs( distance - m_Radius ) > aThreshold ) if( abs( distance - m_Radius ) > aThreshold )
return false; return false;
...@@ -738,7 +738,7 @@ void LIB_ARC::calcRadiusAngles() ...@@ -738,7 +738,7 @@ void LIB_ARC::calcRadiusAngles()
wxPoint centerStartVector = TwoPointVector( m_Pos, m_ArcStart ); wxPoint centerStartVector = TwoPointVector( m_Pos, m_ArcStart );
wxPoint centerEndVector = TwoPointVector( m_Pos, m_ArcEnd ); wxPoint centerEndVector = TwoPointVector( m_Pos, m_ArcEnd );
m_Radius = wxRound( EuclideanNorm( centerStartVector ) ); m_Radius = KiROUND( EuclideanNorm( centerStartVector ) );
m_t1 = (int) ( atan2( (double) centerStartVector.y, m_t1 = (int) ( atan2( (double) centerStartVector.y,
(double) centerStartVector.x ) * 1800 / M_PI ); (double) centerStartVector.x ) * 1800 / M_PI );
......
...@@ -106,7 +106,7 @@ bool LIB_CIRCLE::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTra ...@@ -106,7 +106,7 @@ bool LIB_CIRCLE::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTra
wxPoint relpos = aPosRef - aTransform.TransformCoordinate( m_Pos ); wxPoint relpos = aPosRef - aTransform.TransformCoordinate( m_Pos );
int dist = wxRound( sqrt( ( (double) relpos.x * relpos.x ) + int dist = KiROUND( sqrt( ( (double) relpos.x * relpos.x ) +
( (double) relpos.y * relpos.y ) ) ); ( (double) relpos.y * relpos.y ) ) );
if( abs( dist - m_Radius ) <= aThreshold ) if( abs( dist - m_Radius ) <= aThreshold )
...@@ -346,7 +346,7 @@ void LIB_CIRCLE::calcEdit( const wxPoint& aPosition ) ...@@ -346,7 +346,7 @@ void LIB_CIRCLE::calcEdit( const wxPoint& aPosition )
int dx = m_Pos.x - aPosition.x; int dx = m_Pos.x - aPosition.x;
int dy = m_Pos.y - aPosition.y; int dy = m_Pos.y - aPosition.y;
m_Radius = wxRound( sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ) ); m_Radius = KiROUND( sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ) );
} }
else else
{ {
......
...@@ -1889,7 +1889,7 @@ EDA_RECT LIB_PIN::GetBoundingBox() const ...@@ -1889,7 +1889,7 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
int numberTextLength = showNum ? m_numTextSize * GetNumberString().Len() : 0; int numberTextLength = showNum ? m_numTextSize * GetNumberString().Len() : 0;
// Actual text height is bigger than text size // Actual text height is bigger than text size
int numberTextHeight = showNum ? wxRound( m_numTextSize * 1.1 ) : 0; int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
if( m_shape & INVERT ) if( m_shape & INVERT )
minsizeV = MAX( TARGET_PIN_RADIUS, INVERT_PIN_RADIUS ); minsizeV = MAX( TARGET_PIN_RADIUS, INVERT_PIN_RADIUS );
...@@ -1914,7 +1914,7 @@ EDA_RECT LIB_PIN::GetBoundingBox() const ...@@ -1914,7 +1914,7 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
nameTextLength = ( m_nameTextSize * length ) + nameTextOffset; nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
// Actual text height are bigger than text size // Actual text height are bigger than text size
nameTextHeight = wxRound( m_nameTextSize * 1.1 ) + TXTMARGE; nameTextHeight = KiROUND( m_nameTextSize * 1.1 ) + TXTMARGE;
} }
if( nameTextOffset ) // for values > 0, pin name is inside the body if( nameTextOffset ) // for values > 0, pin name is inside the body
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#include <dialogs/dialog_edit_component_in_lib.h> #include <dialogs/dialog_edit_component_in_lib.h>
#include <dialogs/dialog_libedit_dimensions.h> #include <dialogs/dialog_libedit_dimensions.h>
#include <dialog_helpers.h> //#include <dialog_helpers.h>
#include <menus_helpers.h> #include <menus_helpers.h>
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
......
...@@ -91,7 +91,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) ...@@ -91,7 +91,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
dlg.SetPadNameTextSize( ReturnStringFromValue( g_UserUnit, pin->GetNumberTextSize() ) ); dlg.SetPadNameTextSize( ReturnStringFromValue( g_UserUnit, pin->GetNumberTextSize() ) );
dlg.SetPadNameTextSizeUnits( units ); dlg.SetPadNameTextSizeUnits( units );
dlg.SetLength( ReturnStringFromValue( g_UserUnit, pin->GetLength(), m_internalUnits ) ); dlg.SetLength( ReturnStringFromValue( g_UserUnit, pin->GetLength() ) );
dlg.SetLengthUnits( units ); dlg.SetLengthUnits( units );
dlg.SetAddToAllParts( pin->GetUnit() == 0 ); dlg.SetAddToAllParts( pin->GetUnit() == 0 );
dlg.SetAddToAllBodyStyles( pin->GetConvert() == 0 ); dlg.SetAddToAllBodyStyles( pin->GetConvert() == 0 );
...@@ -119,10 +119,10 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) ...@@ -119,10 +119,10 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
} }
// Save the pin properties to use for the next new pin. // Save the pin properties to use for the next new pin.
LastPinNameSize = ReturnValueFromString( g_UserUnit, dlg.GetNameTextSize(), m_internalUnits ); LastPinNameSize = ReturnValueFromString( g_UserUnit, dlg.GetNameTextSize() );
LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize(), m_internalUnits ); LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize() );
LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() ); LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() );
LastPinLength = ReturnValueFromString( g_UserUnit, dlg.GetLength(), m_internalUnits ); LastPinLength = ReturnValueFromString( g_UserUnit, dlg.GetLength() );
LastPinShape = LIB_PIN::GetStyleCode( dlg.GetStyle() ); LastPinShape = LIB_PIN::GetStyleCode( dlg.GetStyle() );
LastPinType = dlg.GetElectricalType(); LastPinType = dlg.GetElectricalType();
LastPinCommonConvert = dlg.GetAddToAllBodyStyles(); LastPinCommonConvert = dlg.GetAddToAllBodyStyles();
......
...@@ -169,7 +169,7 @@ int SCH_BUS_ENTRY::GetPenSize() const ...@@ -169,7 +169,7 @@ int SCH_BUS_ENTRY::GetPenSize() const
if( m_Layer == LAYER_BUS && m_width == 0 ) if( m_Layer == LAYER_BUS && m_width == 0 )
{ {
pensize = wxRound( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND ); pensize = KiROUND( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND );
pensize = MAX( pensize, 3 ); pensize = MAX( pensize, 3 );
} }
......
...@@ -214,7 +214,7 @@ int SCH_LINE::GetPenSize() const ...@@ -214,7 +214,7 @@ int SCH_LINE::GetPenSize() const
if( m_Layer == LAYER_BUS && m_width == 0 ) if( m_Layer == LAYER_BUS && m_width == 0 )
{ {
pensize = wxRound( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND ); pensize = KiROUND( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND );
pensize = MAX( pensize, 3 ); pensize = MAX( pensize, 3 );
} }
......
...@@ -651,8 +651,8 @@ EDA_RECT SCH_SHEET::GetBoundingBox() const ...@@ -651,8 +651,8 @@ EDA_RECT SCH_SHEET::GetBoundingBox() const
end += m_pos; end += m_pos;
// Move upper and lower limits to include texts: // Move upper and lower limits to include texts:
box.SetY( box.GetY() - ( wxRound( m_sheetNameSize * 1.3 ) + 8 ) ); box.SetY( box.GetY() - ( KiROUND( m_sheetNameSize * 1.3 ) + 8 ) );
end.y += wxRound( m_fileNameSize * 1.3 ) + 8; end.y += KiROUND( m_fileNameSize * 1.3 ) + 8;
box.SetEnd( end ); box.SetEnd( end );
box.Inflate( lineWidth / 2 ); box.Inflate( lineWidth / 2 );
......
...@@ -1242,7 +1242,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const ...@@ -1242,7 +1242,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
int x = symb_len + linewidth + 3; int x = symb_len + linewidth + 3;
// 50% more for negation bar // 50% more for negation bar
int y = wxRound( (double) HalfSize * 1.5 + (double) linewidth + 3.0 ); int y = KiROUND( (double) HalfSize * 1.5 + (double) linewidth + 3.0 );
// Starting point(anchor) // Starting point(anchor)
aPoints.push_back( wxPoint( 0, 0 ) ); aPoints.push_back( wxPoint( 0, 0 ) );
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <gestfich.h> #include <gestfich.h>
#include <confirm.h> #include <confirm.h>
#include <base_units.h>
#include <general.h> #include <general.h>
#include <protos.h> #include <protos.h>
...@@ -862,7 +863,7 @@ void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event ) ...@@ -862,7 +863,7 @@ void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData ) void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData )
{ {
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE ); GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( aDC, GetScreen(), g_DrawDefaultLineThickness ); TraceWorkSheet( aDC, GetScreen(), g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
} }
......
...@@ -189,13 +189,9 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -189,13 +189,9 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
else if( loadFromFile ) else if( loadFromFile )
aSheet->Load( this ); aSheet->Load( this );
aSheet->SetFileNameSize( ReturnValueFromString( g_UserUnit, aSheet->SetFileNameSize( ReturnValueFromString( g_UserUnit, dlg.GetFileNameTextSize() ) );
dlg.GetFileNameTextSize(),
m_internalUnits ) );
aSheet->SetName( dlg.GetSheetName() ); aSheet->SetName( dlg.GetSheetName() );
aSheet->SetSheetNameSize( ReturnValueFromString( g_UserUnit, aSheet->SetSheetNameSize( ReturnValueFromString( g_UserUnit, dlg.GetSheetNameTextSize() ) );
dlg.GetSheetNameTextSize(),
m_internalUnits ) );
if( aSheet->GetName().IsEmpty() ) if( aSheet->GetName().IsEmpty() )
aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ), aSheet->GetTimeStamp() ) ); aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ), aSheet->GetTimeStamp() ) );
...@@ -235,8 +231,8 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -235,8 +231,8 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( sheet->HasPins() ) if( sheet->HasPins() )
{ {
int gridSizeX = wxRound( screen->GetGridSize().x ); int gridSizeX = KiROUND( screen->GetGridSize().x );
int gridSizeY = wxRound( screen->GetGridSize().y ); int gridSizeY = KiROUND( screen->GetGridSize().y );
// If the sheet has pins, use the pin positions to clamp the minimum height. // If the sheet has pins, use the pin positions to clamp the minimum height.
height = ( height < sheet->GetMinHeight() + gridSizeY ) ? height = ( height < sheet->GetMinHeight() + gridSizeY ) ?
......
...@@ -85,8 +85,8 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC ) ...@@ -85,8 +85,8 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC )
} }
aSheetPin->m_Text = dlg.GetLabelName(); aSheetPin->m_Text = dlg.GetLabelName();
aSheetPin->m_Size.y = ReturnValueFromString( g_UserUnit, dlg.GetTextHeight(), m_internalUnits ); aSheetPin->m_Size.y = ReturnValueFromString( g_UserUnit, dlg.GetTextHeight() );
aSheetPin->m_Size.x = ReturnValueFromString( g_UserUnit, dlg.GetTextWidth(), m_internalUnits ); aSheetPin->m_Size.x = ReturnValueFromString( g_UserUnit, dlg.GetTextWidth() );
aSheetPin->SetShape( dlg.GetConnectionType() ); aSheetPin->SetShape( dlg.GetConnectionType() );
if( aDC ) if( aDC )
......
...@@ -82,7 +82,7 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem ) ...@@ -82,7 +82,7 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem )
return; return;
val = dialog.GetWidth(); val = dialog.GetWidth();
m_drawLineWidth = ReturnValueFromString( g_UserUnit, val, m_internalUnits ); m_drawLineWidth = ReturnValueFromString( g_UserUnit, val );
m_drawSpecificConvert = !dialog.GetApplyToAllConversions(); m_drawSpecificConvert = !dialog.GetApplyToAllConversions();
m_drawSpecificUnit = !dialog.GetApplyToAllUnits(); m_drawSpecificUnit = !dialog.GetApplyToAllUnits();
......
...@@ -38,10 +38,10 @@ ...@@ -38,10 +38,10 @@
/** /**
* Function scale * Function scaletoIU
* converts a distance given in floating point to our deci-mils * converts a distance given in floating point to our internal units
*/ */
extern int scale( double aCoord, bool isMetric ); // defined it rs274d.cpp extern int scaletoIU( double aCoord, bool isMetric ); // defined it rs274d_read_XY_and_IJ_coordiantes.cpp
/* Format Gerber: NOTES: /* Format Gerber: NOTES:
* Tools and D_CODES * Tools and D_CODES
...@@ -301,9 +301,9 @@ void GERBER_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem ) ...@@ -301,9 +301,9 @@ void GERBER_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem )
continue; continue;
GERBER_DRAW_ITEM* dupItem = new GERBER_DRAW_ITEM( aItem ); GERBER_DRAW_ITEM* dupItem = new GERBER_DRAW_ITEM( aItem );
wxPoint move_vector; wxPoint move_vector;
move_vector.x = scale( ii * GetLayerParams().m_StepForRepeat.x, move_vector.x = scaletoIU( ii * GetLayerParams().m_StepForRepeat.x,
GetLayerParams().m_StepForRepeatMetric ); GetLayerParams().m_StepForRepeatMetric );
move_vector.y = scale( jj * GetLayerParams().m_StepForRepeat.y, move_vector.y = scaletoIU( jj * GetLayerParams().m_StepForRepeat.y,
GetLayerParams().m_StepForRepeatMetric ); GetLayerParams().m_StepForRepeatMetric );
dupItem->MoveXY( move_vector ); dupItem->MoveXY( move_vector );
m_Parent->GetBoard()->m_Drawings.Append( dupItem ); m_Parent->GetBoard()->m_Drawings.Append( dupItem );
......
This diff is collapsed.
...@@ -115,9 +115,9 @@ wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const ...@@ -115,9 +115,9 @@ wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const
EXCHG( abPos.x, abPos.y ); EXCHG( abPos.x, abPos.y );
abPos += m_layerOffset + m_imageParams->m_ImageOffset; abPos += m_layerOffset + m_imageParams->m_ImageOffset;
abPos.x = wxRound( abPos.x * m_drawScale.x ); abPos.x = KiROUND( abPos.x * m_drawScale.x );
abPos.y = wxRound( abPos.y * m_drawScale.y ); abPos.y = KiROUND( abPos.y * m_drawScale.y );
int rotation = wxRound(m_lyrRotation*10) + (m_imageParams->m_ImageRotation*10); int rotation = KiROUND(m_lyrRotation*10) + (m_imageParams->m_ImageRotation*10);
if( rotation ) if( rotation )
RotatePoint( &abPos, -rotation ); RotatePoint( &abPos, -rotation );
...@@ -144,13 +144,13 @@ wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition ) ...@@ -144,13 +144,13 @@ wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition )
if( !m_mirrorB ) if( !m_mirrorB )
NEGATE( xyPos.y ); NEGATE( xyPos.y );
int rotation = wxRound(m_lyrRotation*10) + (m_imageParams->m_ImageRotation*10); int rotation = KiROUND(m_lyrRotation*10) + (m_imageParams->m_ImageRotation*10);
if( rotation ) if( rotation )
RotatePoint( &xyPos, rotation ); RotatePoint( &xyPos, rotation );
xyPos.x = wxRound( xyPos.x / m_drawScale.x ); xyPos.x = KiROUND( xyPos.x / m_drawScale.x );
xyPos.y = wxRound( xyPos.y / m_drawScale.y ); xyPos.y = KiROUND( xyPos.y / m_drawScale.y );
xyPos -= m_layerOffset + m_imageParams->m_ImageOffset; xyPos -= m_layerOffset + m_imageParams->m_ImageOffset;
if( m_swapAxis ) if( m_swapAxis )
...@@ -368,7 +368,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, ...@@ -368,7 +368,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode,
break; break;
case GBR_CIRCLE: case GBR_CIRCLE:
radius = wxRound(hypot( (double) ( m_End.x - m_Start.x ), radius = KiROUND(hypot( (double) ( m_End.x - m_Start.x ),
(double) ( m_End.y - m_Start.y ) )); (double) ( m_End.y - m_Start.y ) ));
halfPenWidth = m_Size.x >> 1; halfPenWidth = m_Size.x >> 1;
......
...@@ -47,25 +47,25 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -47,25 +47,25 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
{ {
case WXK_NUMPAD8: case WXK_NUMPAD8:
case WXK_UP: case WXK_UP:
pos.y -= wxRound( gridSize.y ); pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD2: case WXK_NUMPAD2:
case WXK_DOWN: case WXK_DOWN:
pos.y += wxRound( gridSize.y ); pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD4: case WXK_NUMPAD4:
case WXK_LEFT: case WXK_LEFT:
pos.x -= wxRound( gridSize.x ); pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
case WXK_NUMPAD6: case WXK_NUMPAD6:
case WXK_RIGHT: case WXK_RIGHT:
pos.x += wxRound( gridSize.x ); pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos ); m_canvas->MoveCursor( pos );
break; break;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <macros.h> #include <macros.h>
#include <trigo.h> #include <trigo.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <base_units.h>
#include <gerbview.h> #include <gerbview.h>
#include <class_gerber_draw_item.h> #include <class_gerber_draw_item.h>
...@@ -155,7 +156,7 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent ) ...@@ -155,7 +156,7 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName ) int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName )
{ {
int current_Dcode, ii, dcode_scale; int current_Dcode, ii;
char* ptcar; char* ptcar;
int dimH, dimV, drill, dummy; int dimH, dimV, drill, dummy;
float fdimH, fdimV, fdrill; float fdimH, fdimV, fdrill;
...@@ -174,8 +175,7 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName ...@@ -174,8 +175,7 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName
/* Updating gerber scale: */ /* Updating gerber scale: */
dcode_scale = 10; /* By uniting dCode = mil, internal unit = 0.1 mil double dcode_scale = MILS_TO_IU_SCALAR; // By uniting dCode = mil, internal unit = MILS_TO_IU_SCALAR
* -> 1 unite dcode = 10 unit PCB */
current_Dcode = 0; current_Dcode = 0;
if( D_Code_FullFileName.IsEmpty() ) if( D_Code_FullFileName.IsEmpty() )
...@@ -215,9 +215,9 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName ...@@ -215,9 +215,9 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName
sscanf( line, "%d,%d,%d,%d,%d,%d,%d", &ii, sscanf( line, "%d,%d,%d,%d,%d,%d,%d", &ii,
&dimH, &dimV, &drill, &dummy, &dummy, &type_outil ); &dimH, &dimV, &drill, &dummy, &dummy, &type_outil );
dimH = wxRound( dimH * dcode_scale ); dimH = KiROUND( dimH * dcode_scale );
dimV = wxRound( dimV * dcode_scale ); dimV = KiROUND( dimV * dcode_scale );
drill = wxRound( drill * dcode_scale ); drill = KiROUND( drill * dcode_scale );
if( ii < 1 ) if( ii < 1 )
ii = 1; ii = 1;
...@@ -245,9 +245,9 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName ...@@ -245,9 +245,9 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName
} }
} }
dimH = wxRound( fdimH * dcode_scale * 1000 ); dimH = KiROUND( fdimH * dcode_scale * 1000 );
dimV = wxRound( fdimV * dcode_scale * 1000 ); dimV = KiROUND( fdimV * dcode_scale * 1000 );
drill = wxRound( fdrill * dcode_scale * 1000 ); drill = KiROUND( fdrill * dcode_scale * 1000 );
if( strchr( "CLROP", c_type_outil[0] ) ) if( strchr( "CLROP", c_type_outil[0] ) )
{ {
...@@ -600,7 +600,7 @@ void D_CODE::ConvertShapeToPolygon() ...@@ -600,7 +600,7 @@ void D_CODE::ConvertShapeToPolygon()
if( m_Rotation ) // vertical oval, rotate polygon. if( m_Rotation ) // vertical oval, rotate polygon.
{ {
int angle = wxRound( m_Rotation * 10 ); int angle = KiROUND( m_Rotation * 10 );
for( unsigned jj = 0; jj < m_PolyCorners.size(); jj++ ) for( unsigned jj = 0; jj < m_PolyCorners.size(); jj++ )
{ {
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="10" /> <FileVersion major="1" minor="11" />
<object class="Project" expanded="1"> <object class="Project" expanded="1">
<property name="class_decoration"></property> <property name="class_decoration"></property>
<property name="code_generation">C++</property> <property name="code_generation">C++</property>
<property name="disconnect_events">1</property> <property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property> <property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property> <property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property> <property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property> <property name="encoding">UTF-8</property>
...@@ -19,66 +20,33 @@ ...@@ -19,66 +20,33 @@
<property name="path">.</property> <property name="path">.</property>
<property name="precompiled_header"></property> <property name="precompiled_header"></property>
<property name="relative_path">1</property> <property name="relative_path">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="use_enum">0</property> <property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_managed">0</property> <property name="aui_managed">0</property>
<property name="aui_name"></property> <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center"></property> <property name="center"></property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="event_handler">impl_virtual</property> <property name="event_handler">impl_virtual</property>
<property name="extra_style"></property> <property name="extra_style"></property>
<property name="fg"></property> <property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property> <property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">DIALOG_PAGE_SHOW_PAGE_BORDERS_BASE</property> <property name="name">DIALOG_PAGE_SHOW_PAGE_BORDERS_BASE</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size">263,254</property> <property name="size">263,254</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Page Borders</property> <property name="title">Page Borders</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -150,7 +118,10 @@ ...@@ -150,7 +118,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
...@@ -172,7 +143,6 @@ ...@@ -172,7 +143,6 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Show Page Limits:</property> <property name="label">Show Page Limits:</property>
<property name="layer"></property>
<property name="majorDimension">1</property> <property name="majorDimension">1</property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
...@@ -188,9 +158,7 @@ ...@@ -188,9 +158,7 @@
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pin_button">1</property> <property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property> <property name="resize">Resizable</property>
<property name="row"></property>
<property name="selection">0</property> <property name="selection">0</property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
...@@ -244,7 +212,10 @@ ...@@ -244,7 +212,10 @@
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
...@@ -264,7 +235,6 @@ ...@@ -264,7 +235,6 @@
<property name="gripper">0</property> <property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="layer"></property>
<property name="max_size"></property> <property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
...@@ -279,19 +249,13 @@ ...@@ -279,19 +249,13 @@
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pin_button">1</property> <property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property> <property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property> <property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
......
...@@ -25,62 +25,28 @@ ...@@ -25,62 +25,28 @@
<property name="use_enum">0</property> <property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_managed">0</property> <property name="aui_managed">0</property>
<property name="aui_name"></property> <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center"></property> <property name="center"></property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="event_handler">impl_virtual</property> <property name="event_handler">impl_virtual</property>
<property name="extra_style"></property> <property name="extra_style"></property>
<property name="fg"></property> <property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property> <property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">DIALOG_DISPLAY_OPTIONS_BASE</property> <property name="name">DIALOG_DISPLAY_OPTIONS_BASE</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size">446,330</property> <property name="size">446,330</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Gerbview Options</property> <property name="title">Gerbview Options</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -1140,10 +1106,6 @@ ...@@ -1140,10 +1106,6 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <common.h> #include <common.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <drawtxt.h> #include <drawtxt.h>
#include <base_units.h>
#include <gerbview.h> #include <gerbview.h>
#include <class_board_design_settings.h> #include <class_board_design_settings.h>
...@@ -106,7 +107,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -106,7 +107,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( IsElementVisible( DCODES_VISIBLE ) ) if( IsElementVisible( DCODES_VISIBLE ) )
DrawItemsDCodeID( DC, GR_COPY ); DrawItemsDCodeID( DC, GR_COPY );
TraceWorkSheet( DC, screen, 0 ); TraceWorkSheet( DC, screen, 0, MILS_TO_IU_SCALAR );
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#include <gerbview.h> #include <gerbview.h>
#include <trigo.h> #include <trigo.h>
#include <macros.h> #include <macros.h>
#include <base_units.h>
#include <class_gerber_draw_item.h> #include <class_gerber_draw_item.h>
#include <class_GERBER.h> #include <class_GERBER.h>
#include <class_excellon.h> #include <class_excellon.h>
...@@ -430,8 +431,12 @@ bool EXCELLON_IMAGE::Execute_HEADER_Command( char*& text ) ...@@ -430,8 +431,12 @@ bool EXCELLON_IMAGE::Execute_HEADER_Command( char*& text )
dcode = GetDCODE( iprm + FIRST_DCODE ); // Remember: dcodes are >= FIRST_DCODE dcode = GetDCODE( iprm + FIRST_DCODE ); // Remember: dcodes are >= FIRST_DCODE
if( dcode == NULL ) if( dcode == NULL )
break; break;
double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT / 25.4 : PCB_INTERNAL_UNIT; // conv_scale = scaling factor from inch to Internal Unit
dcode->m_Size.x = dcode->m_Size.y = wxRound( dprm * conv_scale ); double conv_scale = MILS_TO_IU_SCALAR*1000;
if( m_GerbMetric )
conv_scale /= 25.4;
dcode->m_Size.x = dcode->m_Size.y = KiROUND( dprm * conv_scale );
dcode->m_Shape = APT_CIRCLE; dcode->m_Shape = APT_CIRCLE;
break; break;
} }
......
This diff is collapsed.
...@@ -3,6 +3,29 @@ ...@@ -3,6 +3,29 @@
* @brief GERBVIEW main file. * @brief GERBVIEW main file.
*/ */
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h> #include <fctsys.h>
#include <appl_wxstruct.h> #include <appl_wxstruct.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <class_drawpanel.h> #include <class_drawpanel.h>
#include <build_version.h> #include <build_version.h>
#include <macros.h> #include <macros.h>
#include <base_units.h>
#include <class_layer_box_selector.h> #include <class_layer_box_selector.h>
#include <gerbview.h> #include <gerbview.h>
...@@ -407,7 +408,7 @@ void GERBVIEW_FRAME::Liste_D_Codes() ...@@ -407,7 +408,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
D_CODE* pt_D_code; D_CODE* pt_D_code;
wxString Line; wxString Line;
wxArrayString list; wxArrayString list;
int scale = 10000; double scale = MILS_TO_IU_SCALAR * 1000;
int curr_layer = getActiveLayer(); int curr_layer = getActiveLayer();
for( int layer = 0; layer < 32; layer++ ) for( int layer = 0; layer < 32; layer++ )
......
...@@ -345,8 +345,8 @@ static void fillArcPOLY( BOARD* aPcb, GERBER_DRAW_ITEM* aGbrItem, ...@@ -345,8 +345,8 @@ static void fillArcPOLY( BOARD* aPcb, GERBER_DRAW_ITEM* aGbrItem,
* angle is trigonometrical (counter-clockwise), * angle is trigonometrical (counter-clockwise),
* and axis is the X,Y gerber coordinates * and axis is the X,Y gerber coordinates
*/ */
int start_angle = wxRound(atan2( (double) start.y, (double) start.x ) * 1800 / M_PI); int start_angle = KiROUND(atan2( (double) start.y, (double) start.x ) * 1800 / M_PI);
int end_angle = wxRound(atan2( (double) end.y, (double) end.x ) * 1800 / M_PI); int end_angle = KiROUND(atan2( (double) end.y, (double) end.x ) * 1800 / M_PI);
// dummyTrack has right geometric parameters, but // dummyTrack has right geometric parameters, but
// fillArcGBRITEM calculates arc parameters for a draw function that expects // fillArcGBRITEM calculates arc parameters for a draw function that expects
...@@ -543,23 +543,6 @@ bool GERBER_IMAGE::Execute_G_Command( char*& text, int G_command ) ...@@ -543,23 +543,6 @@ bool GERBER_IMAGE::Execute_G_Command( char*& text, int G_command )
} }
/**
* Function scale
* converts a distance given in floating point to our deci-mils
*/
int scale( double aCoord, bool isMetric )
{
int ret;
if( isMetric )
ret = wxRound( aCoord / 0.00254 );
else
ret = wxRound( aCoord * PCB_INTERNAL_UNIT );
return ret;
}
bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande ) bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande )
{ {
wxSize size( 15, 15 ); wxSize size( 15, 15 );
......
This diff is collapsed.
...@@ -37,6 +37,19 @@ ...@@ -37,6 +37,19 @@
#include <common.h> #include <common.h>
/// Scalar to convert mils to internal units.
#if defined( PCBNEW )
#if defined( USE_PCBNEW_NANOMETRES )
#define MILS_TO_IU_SCALAR 25.4e3 // Pcbnew in nanometers.
#else
#define MILS_TO_IU_SCALAR 10.0 // Pcbnew in deci-mils.
#endif
#else
#define MILS_TO_IU_SCALAR 1.0 // Eeschema and anything else.
#endif
/** /**
* Function To_User_Unit * Function To_User_Unit
* convert \a aValue in internal units to the appropriate user units defined by \a aUnit. * convert \a aValue in internal units to the appropriate user units defined by \a aUnit.
...@@ -80,4 +93,25 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb ...@@ -80,4 +93,25 @@ wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymb
*/ */
void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue ); void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue );
/**
* Return in internal units the value "val" given in inch or mm
*/
double From_User_Unit( EDA_UNITS_T aUnit, double aValue );
/**
* Function ReturnValueFromeString
* converts \a aTextValue in \a aUnits to internal units used by the application.
*
* @param aUnits The units of \a aTextValue.
* @param aTextValue A reference to a wxString object containing the string to convert.
* @return The string from Value, according to units (inch, mm ...) for display,
*/
int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue );
/**
* Convert the number Value in a string according to the internal units
* and the selected unit (g_UserUnit) and put it in the wxTextCtrl TextCtrl
*/
int ReturnValueFromTextCtrl( const wxTextCtrl& aTextCtr );
#endif // _BASE_UNITS_H_ #endif // _BASE_UNITS_H_
This diff is collapsed.
This diff is collapsed.
...@@ -37,7 +37,7 @@ public: ...@@ -37,7 +37,7 @@ public:
void SetPreviousZoom(); void SetPreviousZoom();
void SetLastZoom(); void SetLastZoom();
virtual int GetInternalUnits(); virtual int MilsToIuScalar();
/** /**
* Function GetCurItem * Function GetCurItem
...@@ -57,7 +57,6 @@ public: ...@@ -57,7 +57,6 @@ public:
*/ */
void SetCurItem( BOARD_ITEM* aItem ) { BASE_SCREEN::SetCurItem( (EDA_ITEM*)aItem ); } void SetCurItem( BOARD_ITEM* aItem ) { BASE_SCREEN::SetCurItem( (EDA_ITEM*)aItem ); }
/* full undo redo management : */ /* full undo redo management : */
// use BASE_SCREEN::ClearUndoRedoList() // use BASE_SCREEN::ClearUndoRedoList()
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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