Merged to testing, needs some fixes

This commit is contained in:
Miguel Angel Ajo 2012-04-21 22:04:02 +02:00
commit aef92a345c
187 changed files with 13418 additions and 12439 deletions

View File

@ -362,9 +362,9 @@ void EDA_3D_FRAME::Set3DBgColor()
S3D_Color color;
wxColour newcolor, oldcolor;
oldcolor.Set( wxRound( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),
wxRound( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ),
wxRound( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) );
oldcolor.Set( KiROUND( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),
KiROUND( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ),
KiROUND( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) );
newcolor = wxGetColourFromUser( this, oldcolor );

View File

@ -23,8 +23,6 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
option(USE_PCBNEW_SEXPR_FILE_FORMAT
"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
"Use nanometers for Pcbnew internal units instead of deci-mils (default OFF).")

View File

@ -55,8 +55,6 @@
#cmakedefine USE_IMAGES_IN_MENUS 1
#cmakedefine USE_NEW_PCBNEW_LOAD
#cmakedefine USE_NEW_PCBNEW_SAVE
#cmakedefine USE_PCBNEW_NANOMETRES
#cmakedefine USE_PCBNEW_SEXPR_FILE_FORMAT

View File

@ -62,16 +62,11 @@ Dick's Peronal TODO Items (Last Update: 5-April-2012)
*) a BOARD is a fully self contained document description.
*) plugin developers do not have to access globals, since a plugin could
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.
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.
2) Do an EAGLE XML import PCBNEW PLUGIN, and possibly add export support to it.
This is PLUGIN::Load() and maybe PLUGIN::Save().
6) Get back to the SWEET work.
3) Get back to the SWEET work.

View File

@ -116,21 +116,13 @@ set(PCB_COMMON_SRCS
../pcbnew/collectors.cpp
../pcbnew/sel_layer.cpp
../pcbnew/pcb_plot_params.cpp
../pcbnew/io_mgr.cpp
../pcbnew/legacy_plugin.cpp
../pcbnew/kicad_plugin.cpp
pcb_plot_params_keywords.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
set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES

View File

@ -33,6 +33,7 @@
#include <base_struct.h>
#include <class_base_screen.h>
#include <id.h>
#include <base_units.h>
#define CURSOR_SIZE 12 /// size of the cross cursor.
@ -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 scale = 1.0 / GetZoom();
@ -99,7 +94,7 @@ double BASE_SCREEN::GetScalingFactor() const
}
void BASE_SCREEN::SetScalingFactor(double aScale )
void BASE_SCREEN::SetScalingFactor( double aScale )
{
double zoom = 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()
{
if( m_ZoomList.IsEmpty() )
@ -164,12 +150,10 @@ bool BASE_SCREEN::SetZoom( double coeff )
bool BASE_SCREEN::SetNextZoom()
{
size_t i;
if( m_ZoomList.IsEmpty() || m_Zoom >= m_ZoomList.Last() )
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] )
{
@ -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 )
{
double x, y;
wxRealPoint new_size;
GRID_TYPE new_grid;
switch( aUnit )
{
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_size.x = From_User_Unit( aUnit, size.x );
new_size.y = From_User_Unit( aUnit, size.y );
new_grid.m_Id = id;
new_grid.m_Size = new_size;
AddGrid( new_grid );
}
@ -394,12 +362,12 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoi
wxPoint gridOrigin = m_GridOrigin;
double offset = fmod( gridOrigin.x, gridSize.x );
int x = wxRound( (aPosition.x - offset) / gridSize.x );
pt.x = wxRound( x * gridSize.x + offset );
int x = KiROUND( (aPosition.x - offset) / gridSize.x );
pt.x = KiROUND( x * gridSize.x + offset );
offset = fmod( gridOrigin.y, gridSize.y );
int y = wxRound( (aPosition.y - offset) / gridSize.y );
pt.y = wxRound ( y * gridSize.y + offset );
int y = KiROUND( (aPosition.y - offset) / gridSize.y );
pt.y = KiROUND ( y * gridSize.y + offset );
return pt;
}
@ -419,8 +387,8 @@ wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const
wxPoint pos = m_crossHairPosition - m_DrawOrg;
double scalar = GetScalingFactor();
pos.x = wxRound( (double) pos.x * scalar );
pos.y = wxRound( (double) pos.y * scalar );
pos.x = KiROUND( (double) pos.x * scalar );
pos.y = KiROUND( (double) pos.y * scalar );
return pos;
}

View File

@ -344,11 +344,11 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
// calculate the left common area coordinate:
int left = MAX( me.m_Pos.x, rect.m_Pos.x );
// 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:
int top = MAX( me.m_Pos.y, aRect.m_Pos.y );
// 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( left <= right && top <= bottom )

View File

@ -44,13 +44,19 @@
#if defined( USE_PCBNEW_NANOMETRES )
#define IU_TO_MM( x ) ( x * 1e-6 )
#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
#define IU_TO_MM( x ) ( ( x * 0.0001 ) * 25.4 )
#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
#elif defined( EESCHEMA )
#define IU_TO_MM( x ) ( ( x * 0.001 ) * 25.4 )
#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
#error "Cannot resolve internal units due to no definition of EESCHEMA or PCBNEW."
#endif
@ -159,3 +165,99 @@ void PutValueInLocalUnits( wxTextCtrl& aTextCtr, int aValue )
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;
}

View File

@ -197,8 +197,8 @@ void BITMAP_BASE::DrawBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
aDC->SetLogicalOrigin( logicalOriginX / GetScalingFactor(),
logicalOriginY / GetScalingFactor() );
aDC->DrawBitmap( *m_bitmap,
wxRound( pos.x / GetScalingFactor() ),
wxRound( pos.y / GetScalingFactor() ),
KiROUND( pos.x / GetScalingFactor() ),
KiROUND( pos.y / GetScalingFactor() ),
true );
aDC->SetUserScale( scale, scale );
aDC->SetLogicalOrigin( logicalOriginX, logicalOriginY );
@ -217,8 +217,8 @@ wxSize BITMAP_BASE::GetSize() const
size.x = m_bitmap->GetWidth();
size.y = m_bitmap->GetHeight();
size.x = wxRound( size.x * GetScalingFactor() );
size.y = wxRound( size.y * GetScalingFactor() );
size.x = KiROUND( size.x * GetScalingFactor() );
size.y = KiROUND( size.y * GetScalingFactor() );
}
return size;

View File

@ -98,7 +98,7 @@ double PLOTTER::user_to_device_size( double size )
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;
corner_list.clear();
wxPoint corner;

View File

@ -120,15 +120,17 @@ StructColors ColorRefs[NBCOLOR] =
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
}
void SetLocaleTo_Default( void )
void SetLocaleTo_Default()
{
if( ! g_DisableFloatingPointLocalNotation )
if( !g_DisableFloatingPointLocalNotation )
setlocale( LC_NUMERIC, "" ); // revert to the current locale
}
@ -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* list = new wxArrayString();
@ -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"
*/
@ -466,7 +371,7 @@ double RoundTo0( double x, double precision )
{
assert( precision != 0 );
long long ix = wxRound( x * precision );
long long ix = KiROUND( x * precision );
if ( x < 0.0 )
NEGATE( ix );

View File

@ -155,8 +155,8 @@ void DXF_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFactor
size.x = aImage.GetWidth();
size.y = aImage.GetHeight();
size.x = wxRound( size.x * aScaleFactor );
size.y = wxRound( size.y * aScaleFactor );
size.x = KiROUND( size.x * aScaleFactor );
size.y = KiROUND( size.y * aScaleFactor );
wxPoint start = aPos;
start.x -= size.x / 2;
@ -241,7 +241,7 @@ void DXF_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius,
return;
user_to_device_coordinates( centre );
radius = wxRound( user_to_device_size( radius ) );
radius = KiROUND( user_to_device_size( radius ) );
/* DXF ARC */
wxString cname = ColorRefs[current_color].m_Name;

View File

@ -284,7 +284,7 @@ void GERBER_PLOTTER::circle( wxPoint aCentre, int aDiameter, FILL_T aFill, int a
double radius = aDiameter / 2;
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;
set_current_line_width( aWidth );
move_to( start );
@ -351,8 +351,8 @@ void GERBER_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFac
size.x = aImage.GetWidth();
size.y = aImage.GetHeight();
size.x = wxRound( size.x * aScaleFactor );
size.y = wxRound( size.y * aScaleFactor );
size.x = KiROUND( size.x * aScaleFactor );
size.y = KiROUND( size.y * aScaleFactor );
wxPoint start = aPos;
start.x -= size.x / 2;

View File

@ -112,8 +112,8 @@ void HPGL_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFacto
size.x = aImage.GetWidth();
size.y = aImage.GetHeight();
size.x = wxRound( size.x * aScaleFactor );
size.y = wxRound( size.y * aScaleFactor );
size.x = KiROUND( size.x * aScaleFactor );
size.y = KiROUND( size.y * aScaleFactor );
wxPoint start = aPos;
start.x -= size.x / 2;
@ -285,7 +285,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
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 );
cx = 0; cy = deltaxy / 2;
RotatePoint( &cx, &cy, orient );
@ -298,7 +298,7 @@ void HPGL_PLOTTER::flash_pad_oval( wxPoint pos, wxSize size, int orient,
}
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,
user_to_device_coordinates( pos );
delta = wxRound( pen_diameter - pen_overlap );
delta = KiROUND( pen_diameter - pen_overlap );
rayon = diametre / 2;
if( trace_mode != LINE )
{
rayon = ( diametre - wxRound( pen_diameter ) ) / 2;
rayon = ( diametre - KiROUND( pen_diameter ) ) / 2;
}
if( rayon < 0 )
@ -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)
int move;
move = wxRound( pen_diameter );
move = KiROUND( pen_diameter );
for( int ii = 0; ii < 4; ii++ )
polygone[ii] = aCorners[ii];
@ -512,7 +512,7 @@ void HPGL_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
// TODO: replace this par the HPGL plot polygon.
int jj;
// Fill the shape
move = wxRound( pen_diameter - pen_overlap );
move = KiROUND( pen_diameter - pen_overlap );
// Calculate fill height.
if( polygone[0].y == polygone[3].y ) // Horizontal

View File

@ -160,7 +160,7 @@ void PS_PLOTTER::arc( wxPoint centre, int StAngle, int EndAngle, int radius,
// Calculate start point.
user_to_device_coordinates( centre );
radius = wxRound( user_to_device_size( radius ) );
radius = KiROUND( user_to_device_size( radius ) );
if( plotMirror )
fprintf( output_file, "%d %d %d %g %g arc%d\n", centre.x, centre.y,
radius, (double) -EndAngle / 10, (double) -StAngle / 10,
@ -216,8 +216,8 @@ void PS_PLOTTER::PlotImage( wxImage & aImage, wxPoint aPos, double aScaleFactor
pix_size.x = aImage.GetWidth();
pix_size.y = aImage.GetHeight();
wxSize drawsize; // requested size of image
drawsize.x = wxRound( aScaleFactor * pix_size.x );
drawsize.y = wxRound( aScaleFactor * pix_size.y );
drawsize.x = KiROUND( aScaleFactor * pix_size.x );
drawsize.y = KiROUND( aScaleFactor * pix_size.y );
// calculate the bottom left corner position of bitmap
wxPoint start = aPos;
@ -405,14 +405,14 @@ bool PS_PLOTTER::start_plot( FILE* fout )
if( pageInfo.IsCustom() )
fprintf( output_file, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
wxRound( psPageSize.x * 10 * CONV_SCALE ),
wxRound( psPageSize.y * 10 * CONV_SCALE ) );
KiROUND( psPageSize.x * 10 * CONV_SCALE ),
KiROUND( psPageSize.y * 10 * CONV_SCALE ) );
else // a standard paper size
fprintf( output_file, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
TO_UTF8( pageInfo.GetType() ),
wxRound( psPageSize.x * 10 * CONV_SCALE ),
wxRound( psPageSize.y * 10 * CONV_SCALE ) );
KiROUND( psPageSize.x * 10 * CONV_SCALE ),
KiROUND( psPageSize.y * 10 * CONV_SCALE ) );
if( pageInfo.IsPortrait() )
fprintf( output_file, "%%%%Orientation: Portrait\n" );

View File

@ -30,9 +30,8 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
wxPoint pos, ref;
EDA_COLOR_T color;
// paper is sized in mils. Here is a conversion factor to
// scale mils to internal units.
int conv_unit = screen->GetInternalUnits() / 1000;
// Paper is sized in mils. Here is a conversion factor to scale mils to internal units.
int conv_unit = screen->MilsToIuScalar();
wxString msg;
wxSize text_size;

View File

@ -72,7 +72,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
BASE_SCREEN* screen = aFrame->GetCanvas()->GetScreen();
/* 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() )
{

View File

@ -24,6 +24,7 @@
#include <wx/filename.h>
#include <wx/image.h>
#include <macros.h>
#include <common.h>
#if wxCHECK_VERSION( 2, 9, 0 )
@ -186,15 +187,15 @@ KicadSVGFileDCImpl::~KicadSVGFileDCImpl()
void KicadSVGFileDCImpl::DoGetSizeMM( int *width, int *height ) const
{
if (width)
*width = wxRound( (double)m_width / m_mm_to_pix_x );
*width = KiROUND( (double)m_width / m_mm_to_pix_x );
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
{
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)

View File

@ -26,7 +26,7 @@
*/
#include <fctsys.h>
#include <macros.h> // DIM()
#include <macros.h> // DIM()
#include <common.h>
#include <gr_basic.h>
#include <base_struct.h>
@ -34,6 +34,7 @@
#include <class_title_block.h>
#include <wxstruct.h>
#include <class_base_screen.h>
#include <base_units.h> // MILS_TO_IU_SCALAR
#include <wx/valgen.h>
#include <wx/tokenzr.h>
@ -118,10 +119,12 @@ void DIALOG_PAGES_SETTINGS::initDialog()
// initalize page format choice box and page format list.
// The first shows translated strings, the second contains not tralated strings
m_paperSizeComboBox->Clear();
for( unsigned ii = 0; ; ii++ )
{
if( pageFmts[ii].IsEmpty() )
break;
m_pageFmt.Add( pageFmts[ii] );
m_paperSizeComboBox->Append( wxGetTranslation( pageFmts[ii] ) );
}
@ -137,8 +140,8 @@ void DIALOG_PAGES_SETTINGS::initDialog()
msg.Printf( format, m_Screen->m_ScreenNumber );
m_TextSheetNumber->SetLabel( msg );
#else
m_TextSheetCount->Show(false);
m_TextSheetNumber->Show(false);
m_TextSheetCount->Show( false );
m_TextSheetNumber->Show( false );
#endif
m_pageInfo = m_Parent->GetPageSettings();
@ -251,10 +254,11 @@ void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
{
m_save_flag = false;
SavePageSettings( event );
if( m_save_flag )
{
m_modified = true;
Close( true );
m_modified = true;
Close( true );
}
}
@ -268,9 +272,12 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
{
int idx = m_paperSizeComboBox->GetSelection();
if( idx < 0 )
idx = 0;
const wxString paperType = m_pageFmt[idx];
if( paperType.Contains( PAGE_INFO::Custom ) )
{
m_orientationComboBox->Enable( false );
@ -280,14 +287,17 @@ void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
else
{
m_orientationComboBox->Enable( true );
if( paperType.Contains( wxT( "A4" ) ) && IsGOST() )
{
m_orientationComboBox->SetStringSelection( _( "Portrait" ) );
m_orientationComboBox->Enable( false );
}
}
m_TextUserSizeX->Enable( false );
m_TextUserSizeY->Enable( false );
}
GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample();
}
@ -407,8 +417,10 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
m_save_flag = true;
int idx = m_paperSizeComboBox->GetSelection();
if( idx < 0 )
idx = 0;
const wxString paperType = m_pageFmt[idx];
if( paperType.Contains( PAGE_INFO::Custom ) )
@ -416,6 +428,7 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
GetCustomSizeMilsFromDialog();
retSuccess = m_pageInfo.SetType( PAGE_INFO::Custom );
if( retSuccess )
{
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?" ),
m_save_flag = false;
return;
}
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 );
}
@ -580,12 +594,12 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
if( clamped_layout_size.x < clamped_layout_size.y )
{
lyHeight = MAX_PAGE_EXAMPLE_SIZE;
lyWidth = wxRound( (double) lyHeight / lyRatio );
lyWidth = KiROUND( (double) lyHeight / lyRatio );
}
else
{
lyWidth = MAX_PAGE_EXAMPLE_SIZE;
lyHeight = wxRound( (double) lyWidth / lyRatio );
lyHeight = KiROUND( (double) lyWidth / lyRatio );
}
if( m_page_bitmap )
@ -595,6 +609,7 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
}
m_page_bitmap = new wxBitmap( lyWidth + 1, lyHeight + 1 );
if( m_page_bitmap->IsOk() )
{
// Save current clip box and temporary expand it.
@ -602,7 +617,8 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
m_Parent->GetCanvas()->SetClipBox( EDA_RECT( wxPoint( 0, 0 ),
wxSize( INT_MAX / 2, INT_MAX / 2 ) ) );
// 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 scaleH = (double) lyHeight / clamped_layout_size.y / appScale;
@ -630,7 +646,7 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
m_Parent->TraceWorkSheet( (wxDC*) &memDC, dummySize, pointLeftTop, pointRightBottom,
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 );
m_PageLayoutExampleBitmap->SetBitmap( *m_page_bitmap );
@ -648,14 +664,17 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
{
int idx = m_paperSizeComboBox->GetSelection();
if( idx < 0 )
idx = 0;
const wxString paperType = m_pageFmt[idx];
// here we assume translators will keep original paper size spellings
if( paperType.Contains( PAGE_INFO::Custom ) )
{
GetCustomSizeMilsFromDialog();
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()
};
unsigned i;
for( i=0; i < DIM( papers ); ++i )
{
if( paperType.Contains( *papers[i] ) )
@ -740,5 +760,5 @@ void DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog()
// Prepare to painless double -> int conversion.
customSizeX = Clamp( double( INT_MIN ), customSizeX, 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 ) );
}

View File

@ -110,7 +110,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
m_snapToGrid = true;
// Internal units per inch: = 1000 for schema, = 10000 for PCB
m_internalUnits = EESCHEMA_INTERNAL_UNIT;
minsize.x = 470;
minsize.y = 350 + m_MsgFrameHeight;
@ -369,7 +368,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
else
{
id--;
int selectedZoom = GetScreen()->m_ZoomList[id];
double selectedZoom = GetScreen()->m_ZoomList[id];
if( GetScreen()->GetZoom() == selectedZoom )
return;
@ -516,8 +515,8 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
clientSize = m_canvas->GetClientSize();
// The logical size of the client window.
logicalClientSize.x = wxRound( (double) clientSize.x / scalar );
logicalClientSize.y = wxRound( (double) clientSize.y / scalar );
logicalClientSize.x = KiROUND( (double) clientSize.x / scalar );
logicalClientSize.y = KiROUND( (double) clientSize.y / scalar );
// A corner of the drawing in internal units.
wxSize corner = GetPageSizeIU();
@ -532,14 +531,14 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
drawingRect.GetTop(), drawingRect.GetBottom() );
// The size of the client rectangle in logical units.
int x = wxRound( (double) aCenterPosition.x - ( (double) logicalClientSize.x / 2.0 ) );
int y = wxRound( (double) aCenterPosition.y - ( (double) logicalClientSize.y / 2.0 ) );
int x = KiROUND( (double) aCenterPosition.x - ( (double) logicalClientSize.x / 2.0 ) );
int y = KiROUND( (double) aCenterPosition.y - ( (double) logicalClientSize.y / 2.0 ) );
// If drawn around the center, adjust the client rectangle accordingly.
if( screen->m_Center )
{
x += wxRound( (double) drawingRect.width / 2.0 );
y += wxRound( (double) drawingRect.height / 2.0 );
x += KiROUND( (double) drawingRect.width / 2.0 );
y += KiROUND( (double) drawingRect.height / 2.0 );
}
wxRect logicalClientRect( wxPoint( x, y ), logicalClientSize );
@ -575,7 +574,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
else
virtualSize.x = logicalClientRect.width;
}
else if( logicalClientRect.width < drawingRect.width )
else
{
if( drawingCenterX > clientCenterX )
virtualSize.x = drawingRect.width +
@ -586,10 +585,6 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
else
virtualSize.x = drawingRect.width;
}
else
{
virtualSize.x = drawingRect.width;
}
}
if( drawingRect.GetTop() < logicalClientRect.GetTop() && drawingRect.GetBottom() > logicalClientRect.GetBottom() )
@ -610,7 +605,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
else
virtualSize.y = logicalClientRect.height;
}
else if( logicalClientRect.height < drawingRect.height )
else
{
if( drawingCenterY > clientCenterY )
virtualSize.y = drawingRect.height +
@ -621,23 +616,19 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
else
virtualSize.y = drawingRect.height;
}
else
{
virtualSize.y = drawingRect.height;
}
}
}
if( screen->m_Center )
{
screen->m_DrawOrg.x = -( wxRound( (double) virtualSize.x / 2.0 ) );
screen->m_DrawOrg.y = -( wxRound( (double) virtualSize.y / 2.0 ) );
screen->m_DrawOrg.x = -( KiROUND( (double) virtualSize.x / 2.0 ) );
screen->m_DrawOrg.y = -( KiROUND( (double) virtualSize.y / 2.0 ) );
}
else
{
screen->m_DrawOrg.x = -( wxRound( (double) (virtualSize.x - drawingRect.width) / 2.0 ) );
screen->m_DrawOrg.y = -( wxRound( (double) (virtualSize.y - drawingRect.height) / 2.0 ) );
screen->m_DrawOrg.x = -( KiROUND( (double) (virtualSize.x - drawingRect.width) / 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
@ -649,20 +640,20 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
// Calculate the number of scroll bar units for the given zoom level in device units.
unitsX = wxRound( (double) virtualSize.x * scalar );
unitsY = wxRound( (double) virtualSize.y * scalar );
unitsX = KiROUND( (double) virtualSize.x * scalar );
unitsY = KiROUND( (double) virtualSize.y * scalar );
// Calculate the scroll bar position in logical units to place the center position at
// the center of client rectangle.
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;
posY = aCenterPosition.y - wxRound( (double) logicalClientRect.height / 2.0 ) -
posY = aCenterPosition.y - KiROUND( (double) logicalClientRect.height / 2.0 ) -
screen->m_DrawOrg.y;
// Convert scroll bar position to device units.
posX = wxRound( (double) posX * scalar );
posY = wxRound( (double) posY * scalar );
posX = KiROUND( (double) posX * scalar );
posY = KiROUND( (double) posY * scalar );
if( posX < 0 )
{

View File

@ -405,8 +405,8 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
double scale = GetParent()->GetScreen()->GetScalingFactor();
wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition();
center.x += wxRound( (double) ( x - tmpX ) / scale );
center.y += wxRound( (double) ( y - tmpY ) / scale );
center.x += KiROUND( (double) ( x - tmpX ) / scale );
center.y += KiROUND( (double) ( y - tmpY ) / scale );
GetParent()->GetScreen()->SetScrollCenterPosition( center );
Scroll( x, y );
@ -432,8 +432,8 @@ void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect )
int scrollX, scrollY;
double scalar = Screen->GetScalingFactor();
scrollX = wxRound( Screen->GetGridSize().x * scalar );
scrollY = wxRound( Screen->GetGridSize().y * scalar );
scrollX = KiROUND( Screen->GetGridSize().x * scalar );
scrollY = KiROUND( Screen->GetGridSize().y * scalar );
m_scrollIncrementX = MAX( GetClientSize().x / 8, scrollX );
m_scrollIncrementY = MAX( GetClientSize().y / 8, scrollY );
@ -599,8 +599,8 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
screen->m_StartVisu = CalcUnscrolledPosition( wxPoint( 0, 0 ) );
screenSize = GetClientSize();
screenGridSize.x = aDC->LogicalToDeviceXRel( wxRound( gridSize.x ) );
screenGridSize.y = aDC->LogicalToDeviceYRel( wxRound( gridSize.y ) );
screenGridSize.x = aDC->LogicalToDeviceXRel( KiROUND( gridSize.x ) );
screenGridSize.y = aDC->LogicalToDeviceYRel( KiROUND( gridSize.y ) );
org = m_ClipBox.GetPosition();
@ -621,10 +621,10 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
// Incrementing the start point by one grid step should prevent drawing grid points
// outside the clip box.
if( org.x < m_ClipBox.GetX() )
org.x += wxRound( gridSize.x );
org.x += KiROUND( gridSize.x );
if( org.y < m_ClipBox.GetY() )
org.y += wxRound( gridSize.y );
org.y += KiROUND( gridSize.y );
#if ( defined( __WXMAC__ ) || 1 )
// 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 )
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 )
{
aDC->DrawPoint( xpos, wxRound( y ) );
aDC->DrawPoint( xpos, KiROUND( y ) );
}
}
#else
@ -684,7 +684,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
// Draw a column of grid points.
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.
@ -700,7 +700,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
// Blit the column for each row of the damaged region.
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() ),
1, tmpBM.GetHeight(), &tmpDC, 0, 0, wxCOPY, true );
}
@ -1072,8 +1072,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
double scale = GetParent()->GetScreen()->GetScalingFactor();
wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition();
center.x += wxRound( (double) ( x - tmpX ) / scale ) / ppux;
center.y += wxRound( (double) ( y - tmpY ) / scale ) / ppuy;
center.x += KiROUND( (double) ( x - tmpX ) / scale ) / ppux;
center.y += KiROUND( (double) ( y - tmpY ) / scale ) / ppuy;
GetParent()->GetScreen()->SetScrollCenterPosition( center );
Refresh();
@ -1083,9 +1083,9 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{
double scale = GetParent()->GetScreen()->GetScalingFactor();
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 +
wxRound( (double) ( m_PanStartEventPosition.y - currentPosition.y ) / scale );
KiROUND( (double) ( m_PanStartEventPosition.y - currentPosition.y ) / scale );
GetParent()->RedrawScreen( wxPoint( x, y ), false );
}

View File

@ -35,7 +35,7 @@ double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR;
*/
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 )
{
int penSize = aPenSize;
double scale = aBold ? 4.0 : 6.0;
int maxWidth = wxRound( ABS( aSize ) / scale );
int maxWidth = KiROUND( ABS( aSize ) / scale );
if( penSize > maxWidth )
penSize = maxWidth;
@ -138,13 +138,13 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo
/* Get metrics */
int xsta = *ptcar++ - 'R';
int xsto = *ptcar++ - 'R';
tally += wxRound( aXSize * (xsto - xsta) * s_HerscheyScaleFactor );
tally += KiROUND( aXSize * (xsto - xsta) * s_HerscheyScaleFactor );
}
/* Italic correction, 1/8em */
if( aItalic )
{
tally += wxRound( aXSize * 0.125 );
tally += KiROUND( aXSize * 0.125 );
}
return tally;
}
@ -196,7 +196,7 @@ static void DrawGraphicTextPline(
*/
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,
{
wxPoint currpoint;
hc1 -= xsta; hc2 -= 11; /* Align the midpoint */
hc1 = wxRound( hc1 * size_h * s_HerscheyScaleFactor );
hc2 = wxRound( hc2 * size_v * s_HerscheyScaleFactor );
hc1 = KiROUND( hc1 * size_h * s_HerscheyScaleFactor );
hc2 = KiROUND( hc2 * size_v * s_HerscheyScaleFactor );
// To simulate an italic font, add a x offset depending on the y offset
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.y = hc2 + current_char_pos.y;
@ -481,7 +481,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
ptr++;
// 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 )

View File

@ -16,9 +16,8 @@
#include <pcbcommon.h>
#include <pcbstruct.h>
#include <richio.h>
#include <filter_reader.h>
#include <footprint_info.h>
#include <io_mgr.h>
#include <class_pad.h>
#include <class_module.h>
@ -39,110 +38,69 @@
* ...... other data (pads, outlines ..)
* $Endmodule
*/
bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames )
bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
{
FILE* file;
wxFileName filename;
wxString libname;
// Clear data before reading files
m_filesNotFound.Empty();
m_filesInvalid.Empty();
m_List.clear();
/* Parse Libraries Listed */
for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ )
// try
{
filename = aFootprintsLibNames[ii];
filename.SetExt( FootprintLibFileExtension );
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
libname = wxGetApp().FindLibraryPath( filename );
if( libname.IsEmpty() )
// Parse Libraries Listed
for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ )
{
m_filesNotFound << filename.GetFullName() << wxT("\n");
continue;
}
wxFileName filename = aFootprintsLibNames[ii];
/* Open library file */
file = wxFopen( libname, wxT( "rt" ) );
filename.SetExt( FootprintLibFileExtension );
if( file == NULL )
{
m_filesInvalid << libname << _(" (file cannot be opened)") << wxT("\n");
continue;
}
wxString libPath = wxGetApp().FindLibraryPath( filename );
FILE_LINE_READER fileReader( file, libname );
FILTER_READER reader( fileReader );
/* Read header. */
reader.ReadLine();
char * line = reader.Line();
StrPurge( line );
if( strnicmp( line, FOOTPRINT_LIBRARY_HEADER, FOOTPRINT_LIBRARY_HEADER_CNT ) != 0 )
{
wxString msg;
msg.Printf( _( "<%s> is not a valid KiCad PCB footprint library." ),
GetChars( libname ) );
m_filesInvalid << msg << wxT("\n");
continue;
}
// Read library
bool end = false;
while( !end && reader.ReadLine() )
{
line = reader.Line();
StrPurge( line );
if( strnicmp( line, "$EndLIBRARY", 11 ) == 0 )
if( !libPath )
{
end = true;
break;
m_filesNotFound << filename.GetFullName() << wxT("\n");
continue;
}
if( strnicmp( line, "$MODULE", 7 ) == 0 )
try
{
wxArrayString fpnames = pi->FootprintEnumerate( libPath );
line += 7;
FOOTPRINT_INFO* ItemLib = new FOOTPRINT_INFO();
ItemLib->m_Module = FROM_UTF8( StrPurge( line ) );
ItemLib->m_LibName = libname;
AddItem( ItemLib );
while( reader.ReadLine() )
for( unsigned i=0; i<fpnames.GetCount(); ++i )
{
line = reader.Line();
StrPurge( line );
if( strnicmp( line, "$EndMODULE", 10 ) == 0 )
break;
auto_ptr<MODULE> m( pi->FootprintLoad( libPath, fpnames[i] ) );
if( strnicmp( line, "$PAD", 4 ) == 0 )
ItemLib->m_padCount++;
// we're loading what we enumerated, all must be there.
wxASSERT( m.get() );
int id = ((line[0] & 0xFF) << 8) + (line[1] & 0xFF);
switch( id )
{
/* KeyWords */
case (('K'<<8) + 'w'):
ItemLib->m_KeyWord = FROM_UTF8( StrPurge( line + 3 ) );
break;
FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO();
/* Doc */
case (('C'<<8) + 'd'):
ItemLib->m_Doc = FROM_UTF8( StrPurge( line + 3 ) );
break;
}
fpinfo->m_Module = fpnames[i];
fpinfo->m_LibName = libPath;
fpinfo->m_padCount = m->GetPadCount();
fpinfo->m_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription();
AddItem( fpinfo );
}
}
}
if( !end )
{
m_filesInvalid << libname << _(" (Unexpected end of file)") << wxT("\n");
catch( IO_ERROR ioe )
{
m_filesInvalid << ioe.errorText << wxT("\n");
}
}
}
/* caller should catch this, UI seems not wanted here.
catch( IO_ERROR ioe )
{
DisplayError( NULL, ioe.errorText );
return false;
}
*/
m_List.sort();
return true;

View File

@ -1410,7 +1410,7 @@ void ClipAndDrawFilledPoly( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPoints[], in
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() )

View File

@ -6,7 +6,7 @@
#include <fctsys.h>
#include <macros.h>
#include <trigo.h>
#include <common.h>
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 )
*/
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;
cYrot = pointY;
@ -211,7 +211,7 @@ int ArcTangente( int dy, int dx )
}
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 )
double cosinus = cos( fangle );
double fpx = (*pY * sinus ) + (*pX * cosinus );
double fpy = (*pY * cosinus ) - (*pX * sinus );
*pX = wxRound( fpx );
*pY = wxRound( fpy );
*pX = KiROUND( fpx );
*pY = KiROUND( fpy );
}
}

View File

@ -1003,7 +1003,8 @@ Ki_WorkSheetData WS_Segm5_LT =
};
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width )
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
double aScalar )
{
if( !m_showBorderAndTitleBlock )
return;
@ -1012,41 +1013,39 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
wxSize pageSize = pageInfo.GetSizeMils();
// if not printing, draw the page limits:
if( !screen->m_IsPrinting && g_ShowPageLimits )
if( !aScreen->m_IsPrinting && g_ShowPageLimits )
{
int scale = m_internalUnits / 1000;
GRSetDrawMode( DC, GR_COPY );
GRRect( m_canvas->GetClipBox(), DC, 0, 0,
pageSize.x * scale, pageSize.y * scale, line_width,
GRSetDrawMode( aDC, GR_COPY );
GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
}
wxPoint margin_left_top( pageInfo.GetLeftMarginMils(), pageInfo.GetTopMarginMils() );
wxPoint margin_right_bottom( pageInfo.GetRightMarginMils(), pageInfo.GetBottomMarginMils() );
wxString paper = pageInfo.GetType();
wxString file = screen->GetFileName();
wxString file = aScreen->GetFileName();
TITLE_BLOCK t_block = GetTitleBlock();
int number_of_screens = screen->m_NumberOfScreen;
int screen_to_draw = screen->m_ScreenNumber;
int number_of_screens = aScreen->m_NumberOfScreen;
int screen_to_draw = aScreen->m_ScreenNumber;
TraceWorkSheet( ( wxDC* )DC, pageSize, margin_left_top, margin_right_bottom,
paper, file, t_block, number_of_screens, screen_to_draw,
( int )line_width );
TraceWorkSheet( aDC, pageSize, margin_left_top, margin_right_bottom,
paper, file, t_block, number_of_screens, screen_to_draw,
aLineWidth, aScalar );
}
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, EDA_COLOR_T aClr1,
EDA_COLOR_T aClr2 )
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, double aScalar,
EDA_COLOR_T aClr1, EDA_COLOR_T aClr2 )
{
wxPoint pos;
int refx, refy;
wxString Line;
Ki_WorkSheetData* WsItem;
int scale = m_internalUnits / 1000;
wxSize size( SIZETEXT * scale, SIZETEXT * scale );
wxSize size_ref( SIZETEXT_REF * scale, SIZETEXT_REF * scale );
wxSize size( SIZETEXT * aScalar, SIZETEXT * aScalar );
wxSize size_ref( SIZETEXT_REF * aScalar, SIZETEXT_REF * aScalar );
wxString msg;
GRSetDrawMode( aDC, GR_COPY );
@ -1062,15 +1061,15 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
#if defined(KICAD_GOST)
// Draw the border.
GRRect( m_canvas->GetClipBox(), aDC, refx * scale, refy * scale,
xg * scale, yg * scale, aLnW, aClr1 );
GRRect( m_canvas->GetClipBox(), aDC, refx * aScalar, refy * aScalar,
xg * aScalar, yg * aScalar, aLnW, aClr1 );
refx = aLT.x;
refy = aSz.y - aRB.y; // Lower left corner
for( WsItem = &WS_Segm1_LU; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = ( refx - WsItem->m_Posx ) * scale;
pos.y = ( refy - WsItem->m_Posy ) * scale;
pos.x = ( refx - WsItem->m_Posx ) * aScalar;
pos.y = ( refy - WsItem->m_Posy ) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
{
@ -1090,7 +1089,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
xg = aLT.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
xg * aScalar, yg * aScalar, aLnW, aClr1 );
break;
}
}
@ -1098,8 +1097,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
refy = aRB.y; // Left Top corner
for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = ( refx + WsItem->m_Posx ) * scale;
pos.y = ( refy + WsItem->m_Posy ) * scale;
pos.x = ( refx + WsItem->m_Posx ) * aScalar;
pos.y = ( refy + WsItem->m_Posy ) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
{
@ -1107,14 +1106,14 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
xg = aLT.x + WsItem->m_Endx;
yg = aRB.y + WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
xg * aScalar, yg * aScalar, aLnW, aClr1 );
break;
}
}
wxSize size2( SIZETEXT * scale * 2, SIZETEXT * scale * 2);
wxSize size3( SIZETEXT * scale * 3, SIZETEXT * scale * 3);
wxSize size1_5( SIZETEXT * scale * 1.5, SIZETEXT * scale * 1.5);
wxSize size2( SIZETEXT * aScalar * 2, SIZETEXT * aScalar * 2);
wxSize size3( SIZETEXT * aScalar * 3, SIZETEXT * aScalar * 3);
wxSize size1_5( SIZETEXT * aScalar * 1.5, SIZETEXT * aScalar * 1.5);
// lower right corner
refx = aSz.x - aRB.x;
refy = aSz.y - aRB.y;
@ -1123,8 +1122,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
{
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * scale;
pos.y = (refy - WsItem->m_Posy) * scale;
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
{
@ -1198,8 +1197,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
msg, TEXT_ORIENT_HORIZ, size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
pos.x = (aLT.x + 1260) * scale;
pos.y = (aLT.y + 270) * scale;
pos.x = (aLT.x + 1260) * aScalar;
pos.y = (aLT.y + 270) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
@ -1244,13 +1243,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
case WS_LEFT_SEGMENT:
WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy =
WS_MostLeftLine.m_Posy = STAMP_OY;
pos.y = ( refy - WsItem->m_Posy ) * scale;
pos.y = ( refy - WsItem->m_Posy ) * aScalar;
case WS_SEGMENT:
xg = aSz.x - aRB.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
xg * aScalar, yg * aScalar, aLnW, aClr1 );
break;
}
}
@ -1259,8 +1258,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
{
for( WsItem = &WS_CADRE_D; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = ( refx - WsItem->m_Posx ) * scale;
pos.y = ( refy - WsItem->m_Posy ) * scale;
pos.x = ( refx - WsItem->m_Posx ) * aScalar;
pos.y = ( refy - WsItem->m_Posy ) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
@ -1274,8 +1273,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
msg, TEXT_ORIENT_HORIZ, size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
pos.x = (aLT.x + 1260) * scale;
pos.y = (aLT.y + 270) * scale;
pos.x = (aLT.x + 1260) * aScalar;
pos.y = (aLT.y + 270) * aScalar;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
@ -1303,13 +1302,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
break;
case WS_LEFT_SEGMENT_D:
pos.y = ( refy - WsItem->m_Posy ) * scale;
pos.y = ( refy - WsItem->m_Posy ) * aScalar;
case WS_SEGMENT_D:
xg = aSz.x - aRB.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
xg * aScalar, yg * aScalar, aLnW, aClr1 );
break;
}
}
@ -1320,8 +1319,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
int ii, jj, ipas, gxpas, gypas;
for( ii = 0; ii < 2; ii++ )
{
GRRect( m_canvas->GetClipBox(), aDC, refx * scale, refy * scale,
xg * scale, yg * scale, aLnW, aClr1 );
GRRect( m_canvas->GetClipBox(), aDC, refx * aScalar, refy * aScalar,
xg * aScalar, yg * aScalar, aLnW, aClr1 );
refx += GRID_REF_W; refy += GRID_REF_W;
xg -= GRID_REF_W; yg -= GRID_REF_W;
@ -1343,24 +1342,24 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, ii * scale, refy * scale,
ii * scale, ( refy + GRID_REF_W ) * scale, aLnW, aClr1 );
GRLine( m_canvas->GetClipBox(), aDC, ii * aScalar, refy * aScalar,
ii * aScalar, ( refy + GRID_REF_W ) * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( ii - gxpas / 2 ) * scale,
( refy + GRID_REF_W / 2 ) * scale ),
wxPoint( ( ii - gxpas / 2 ) * aScalar,
( refy + GRID_REF_W / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, ii * scale, yg * scale,
ii * scale, ( yg - GRID_REF_W ) * scale, aLnW, aClr1 );
GRLine( m_canvas->GetClipBox(), aDC, ii * aScalar, yg * aScalar,
ii * aScalar, ( yg - GRID_REF_W ) * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( ii - gxpas / 2 ) * scale,
( yg - GRID_REF_W / 2) * scale ),
wxPoint( ( ii - gxpas / 2 ) * aScalar,
( yg - GRID_REF_W / 2) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
@ -1378,25 +1377,25 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
if( ii < yg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, refx * scale, ii * scale,
( refx + GRID_REF_W ) * scale, ii * scale, aLnW, aClr1 );
GRLine( m_canvas->GetClipBox(), aDC, refx * aScalar, ii * aScalar,
( refx + GRID_REF_W ) * aScalar, ii * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( refx + GRID_REF_W / 2 ) * scale,
( ii - gypas / 2 ) * scale ),
wxPoint( ( refx + GRID_REF_W / 2 ) * aScalar,
( ii - gypas / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
if( ii < yg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, xg * scale, ii * scale,
( xg - GRID_REF_W ) * scale, ii * scale, aLnW, aClr1 );
GRLine( m_canvas->GetClipBox(), aDC, xg * aScalar, ii * aScalar,
( xg - GRID_REF_W ) * aScalar, ii * aScalar, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( xg - GRID_REF_W / 2 ) * scale,
( ii - gxpas / 2 ) * scale ),
wxPoint( ( xg - GRID_REF_W / 2 ) * aScalar,
( ii - gxpas / 2 ) * aScalar ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
@ -1408,8 +1407,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = (refx - WsItem->m_Posx) * scale;
pos.y = (refy - WsItem->m_Posy) * scale;
pos.x = (refx - WsItem->m_Posx) * aScalar;
pos.y = (refy - WsItem->m_Posy) * aScalar;
msg.Empty();
switch( WsItem->m_Type )
@ -1592,13 +1591,13 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
WS_MostUpperLine.m_Posy =
WS_MostUpperLine.m_Endy =
WS_MostLeftLine.m_Posy = UpperLimit;
pos.y = (refy - WsItem->m_Posy) * scale;
pos.y = (refy - WsItem->m_Posy) * aScalar;
case WS_SEGMENT:
xg = aSz.x - GRID_REF_W - aRB.x - WsItem->m_Endx;
yg = aSz.y - GRID_REF_W - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
xg * aScalar, yg * aScalar, aLnW, aClr1 );
break;
}
}

View File

@ -41,17 +41,14 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent,
int textsize,
EDA_UNITS_T user_unit,
wxBoxSizer* BoxSizer,
int framelen,
int internal_unit )
int framelen )
{
m_UserUnit = user_unit;
m_Internal_Unit = internal_unit;
m_Title = NULL;
m_Title = new wxStaticText( parent, -1, Title );
BoxSizer->Add( m_Title, 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
BoxSizer->Add( m_Title, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
m_FrameText = new wxTextCtrl( parent, -1, TextToEdit );
@ -62,14 +59,12 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent,
wxString msg = _( "Size" ) + ReturnUnitSymbol( m_UserUnit );
wxStaticText* text = new wxStaticText( parent, -1, msg );
BoxSizer->Add( text, 0,
wxGROW | wxLEFT | wxRIGHT, 5 );
BoxSizer->Add( text, 0, 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,
wxSize( 70, -1 ) );
m_FrameSize = new wxTextCtrl( parent, -1, value, wxDefaultPosition, wxSize( 70, -1 ) );
BoxSizer->Add( m_FrameSize, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
}
@ -84,11 +79,8 @@ EDA_GRAPHIC_TEXT_CTRL::~EDA_GRAPHIC_TEXT_CTRL()
}
wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( int internalUnit, EDA_UNITS_T aUnit,
int textSize )
wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( EDA_UNITS_T aUnit, int textSize )
{
wxString value;
// Limiting the size of the text of reasonable values.
if( textSize < 10 )
textSize = 10;
@ -96,10 +88,7 @@ wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( int internalUnit, EDA_UNITS_T aUnit,
if( textSize > 3000 )
textSize = 3000;
value.Printf( ( internalUnit > 1000 ) ? wxT( "%.4f" ) : wxT( "%.3f" ),
To_User_Unit( aUnit, textSize ) );
return value;
return ReturnStringFromValue( aUnit, textSize );
}
@ -117,7 +106,7 @@ void EDA_GRAPHIC_TEXT_CTRL::SetValue( const wxString& value )
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 );
}
@ -129,12 +118,11 @@ const wxString EDA_GRAPHIC_TEXT_CTRL::GetText() const
}
int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText,
int internalUnit, EDA_UNITS_T aUnit )
int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText, EDA_UNITS_T aUnit )
{
int textsize;
textsize = ReturnValueFromString( aUnit, sizeText, internalUnit );
textsize = ReturnValueFromString( aUnit, sizeText );
// Limit to reasonable size
if( textsize < 10 )
@ -149,7 +137,7 @@ int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText,
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,
const wxString& title,
const wxPoint& pos_to_edit,
EDA_UNITS_T user_unit,
wxBoxSizer* BoxSizer,
int internal_unit )
wxBoxSizer* BoxSizer )
{
wxString text;
m_UserUnit = user_unit;
m_Internal_Unit = internal_unit;
if( title.IsEmpty() )
text = _( "Pos " );
@ -182,10 +168,8 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent,
text += _( "X" ) + ReturnUnitSymbol( m_UserUnit );
m_TextX = new wxStaticText( parent, -1, text );
BoxSizer->Add( m_TextX, 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
m_FramePosX = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition );
BoxSizer->Add( m_TextX, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
m_FramePosX = new wxTextCtrl( parent, -1, wxEmptyString, wxDefaultPosition );
BoxSizer->Add( m_FramePosX, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
@ -198,8 +182,7 @@ EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent,
m_TextY = new wxStaticText( parent, -1, text );
BoxSizer->Add( m_TextY, 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
BoxSizer->Add( m_TextY, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
m_FramePosY = new wxTextCtrl( parent, -1, wxEmptyString );
@ -224,8 +207,8 @@ wxPoint EDA_POSITION_CTRL::GetValue()
{
wxPoint coord;
coord.x = ReturnValueFromString( m_UserUnit, m_FramePosX->GetValue(), m_Internal_Unit );
coord.y = ReturnValueFromString( m_UserUnit, m_FramePosY->GetValue(), m_Internal_Unit );
coord.x = ReturnValueFromString( m_UserUnit, m_FramePosX->GetValue() );
coord.y = ReturnValueFromString( m_UserUnit, m_FramePosY->GetValue() );
return coord;
}
@ -259,12 +242,10 @@ void EDA_POSITION_CTRL::SetValue( int x_value, int y_value )
/* EDA_SIZE_CTRL */
/*******************/
EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit,
EDA_UNITS_T aUnit, wxBoxSizer* aBoxSizer,
int internal_unit ) :
EDA_POSITION_CTRL( parent, title,
wxPoint( size_to_edit.x, size_to_edit.y ),
aUnit, aBoxSizer, internal_unit )
const wxSize& size_to_edit, EDA_UNITS_T aUnit,
wxBoxSizer* aBoxSizer ) :
EDA_POSITION_CTRL( parent, title, wxPoint( size_to_edit.x, size_to_edit.y ),
aUnit, aBoxSizer )
{
}
@ -284,23 +265,20 @@ wxSize EDA_SIZE_CTRL::GetValue()
/* Class to display and edit a dimension INCHES, MM, or other */
/**************************************************************/
EDA_VALUE_CTRL::EDA_VALUE_CTRL( wxWindow* parent, const wxString& title,
int value, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit )
int value, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer )
{
wxString label = title;
m_UserUnit = user_unit;
m_Internal_Unit = internal_unit;
m_Value = value;
label += ReturnUnitSymbol( m_UserUnit );
m_Text = new wxStaticText( parent, -1, label );
BoxSizer->Add( m_Text, 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
BoxSizer->Add( m_Text, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
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,
0,
@ -321,7 +299,7 @@ int EDA_VALUE_CTRL::GetValue()
int coord;
wxString txtvalue = m_ValueCtrl->GetValue();
coord = ReturnValueFromString( m_UserUnit, txtvalue, m_Internal_Unit );
coord = ReturnValueFromString( m_UserUnit, txtvalue );
return coord;
}

View File

@ -380,25 +380,25 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
case WXK_NUMPAD8: /* cursor moved up */
case WXK_UP:
pos.y -= wxRound( gridSize.y );
pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD2: /* cursor moved down */
case WXK_DOWN:
pos.y += wxRound( gridSize.y );
pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD4: /* cursor moved left */
case WXK_LEFT:
pos.x -= wxRound( gridSize.x );
pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD6: /* cursor moved right */
case WXK_RIGHT:
pos.x += wxRound( gridSize.x );
pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;
}

View File

@ -17,8 +17,7 @@
#include <cvpcb.h>
#include <cvpcb_mainframe.h>
#include <class_DisplayFootprintsFrame.h>
#include <richio.h>
#include <filter_reader.h>
#include <io_mgr.h>
#include <wildcards_and_files_ext.h>
@ -29,122 +28,50 @@
* @param CmpName - Module name
* @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();
for( ii = 0; ii < parent->m_ModuleLibNames.GetCount(); ii++ )
try
{
fn = parent->m_ModuleLibNames[ii];
fn.SetExt( FootprintLibFileExtension );
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
tmp = wxGetApp().FindLibraryPath( fn );
if( !tmp )
for( unsigned i = 0; i < parent->m_ModuleLibNames.GetCount(); ++i )
{
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;
}
wxFileName fn = parent->m_ModuleLibNames[i];
FILE* file = wxFopen( tmp, wxT( "rt" ) );
fn.SetExt( FootprintLibFileExtension );
if( file == NULL )
{
msg.Printf( _( "Could not open PCB foot print library file <%s>." ),
GetChars( tmp ) );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
continue;
}
wxString libPath = wxGetApp().FindLibraryPath( fn );
FILE_LINE_READER fileReader( file, tmp );
FILTER_READER reader( fileReader );
/* Read header. */
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 )
if( !libPath )
{
while( reader.ReadLine() )
{
Line = reader.Line();
wxString msg = wxString::Format(
_("PCB foot print library file <%s> could not be found in the default search paths." ),
fn.GetFullName().GetData() );
if( strnicmp( Line, "$EndINDEX", 9 ) == 0 )
break;
// @todo we should not be using wxMessageBox directly.
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
continue;
}
StrPurge( Line );
MODULE* footprint = pi->FootprintLoad( libPath, aFootprintName );
if( stricmp( Line, TO_UTF8( CmpName ) ) == 0 )
{
Found = 1;
break;
}
}
if( footprint )
{
footprint->SetPosition( wxPoint( 0, 0 ) );
return footprint;
}
}
while( Found && reader.ReadLine() )
{
Line = reader.Line();
if( Line[0] != '$' )
continue;
if( Line[1] != 'M' )
continue;
if( strnicmp( Line, "$MODULE", 7 ) != 0 )
continue;
/* Read component name. */
sscanf( Line + 7, " %s", Name );
if( stricmp( Name, TO_UTF8( CmpName ) ) == 0 )
{
Module = new MODULE( GetBoard() );
// 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 );
return NULL;
}

View File

@ -208,25 +208,25 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
case WXK_NUMPAD8:
case WXK_UP:
pos.y -= wxRound( gridSize.y );
pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD2:
case WXK_DOWN:
pos.y += wxRound( gridSize.y );
pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD4:
case WXK_LEFT:
pos.x -= wxRound( gridSize.x );
pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD6:
case WXK_RIGHT:
pos.x += wxRound( gridSize.x );
pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;
@ -293,25 +293,25 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
case WXK_NUMPAD8:
case WXK_UP:
pos.y -= wxRound( gridSize.y );
pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD2:
case WXK_DOWN:
pos.y += wxRound( gridSize.y );
pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD4:
case WXK_LEFT:
pos.x -= wxRound( gridSize.x );
pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD6:
case WXK_RIGHT:
pos.x += wxRound( gridSize.x );
pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;
@ -375,25 +375,25 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
case WXK_NUMPAD8:
case WXK_UP:
pos.y -= wxRound( gridSize.y );
pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD2:
case WXK_DOWN:
pos.y += wxRound( gridSize.y );
pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD4:
case WXK_LEFT:
pos.x -= wxRound( gridSize.x );
pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD6:
case WXK_RIGHT:
pos.x += wxRound( gridSize.x );
pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;

View File

@ -92,8 +92,7 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
void DIALOG_SVG_PRINT::SetPenWidth()
{
g_DrawDefaultLineThickness =
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() );
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth );
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
{
@ -118,7 +117,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
SetPenWidth();
g_DrawDefaultLineThickness =
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() );
ReturnValueFromTextCtrl( *m_DialogPenWidth );
SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen();
@ -216,7 +215,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
LOCALE_IO toggle;
float dpi = (float) frame->GetInternalUnits();
float dpi = 1000.0;
KicadSVGFileDC dc( FullFileName, sheetSize.x, sheetSize.y, dpi );
EDA_RECT tmp = *panel->GetClipBox();
@ -228,6 +227,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) );
screen->m_IsPrinting = true;
if( frame->IsType( SCHEMATIC_FRAME ) )
screen->Draw( panel, &dc, GR_COPY );
@ -237,7 +237,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
sheetSize.y/2) );
if( aPrint_Sheet_Ref )
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness );
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
screen->m_IsPrinting = false;
panel->SetClipBox( tmp );

View File

@ -39,7 +39,6 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY()
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg()
{
SetFocus();
m_AliasLocation = -1;
LIB_COMPONENT* component = m_Parent->GetComponent();

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -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 );
@ -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 );
bSizerBasicPanel->Add( m_OptionsBoxSizer, 0, 0, 5 );
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
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 );
bSizerMidBasicPanel->Add( bSizernbunits, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer17;
@ -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 );
bSizer17->Add( m_SetSkew, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMidBasicPanel->Add( bSizer17, 1, wxEXPAND, 5 );
bSizerBasicPanel->Add( bSizerMidBasicPanel, 0, wxEXPAND, 5 );
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
bSizerBasicPanel->Add( m_OptionPartsLocked, 0, wxALL, 5 );
m_PanelBasic->SetSizer( bSizerBasicPanel );
m_PanelBasic->Layout();
bSizerBasicPanel->Fit( m_PanelBasic );
@ -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 );
bSizerPaneldocbutts->Add( m_buttonBrowseDocFiles, 0, wxALL, 5 );
m_PanelDocBoxSizer->Add( bSizerPaneldocbutts, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
m_PanelDoc->SetSizer( m_PanelDocBoxSizer );
m_PanelDoc->Layout();
m_PanelDocBoxSizer->Fit( m_PanelDoc );
@ -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 );
bLeftBoxSizerPanelAlias->Add( m_PartAliasListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMainPanelAlias->Add( bLeftBoxSizerPanelAlias, 1, wxEXPAND, 5 );
wxBoxSizer* bRightBoxSizerPanelAlias;
@ -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 );
bRightBoxSizerPanelAlias->Add( m_ButtonDeleteAllAlias, 0, wxALL, 5 );
bSizerMainPanelAlias->Add( bRightBoxSizerPanelAlias, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_PanelAlias->SetSizer( bSizerMainPanelAlias );
m_PanelAlias->Layout();
bSizerMainPanelAlias->Fit( m_PanelAlias );
@ -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 );
bFpFilterLeftBoxSizer->Add( m_FootprintFilterListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bPanelFpFilterBoxSizer->Add( bFpFilterLeftBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bFpFilterRightBoxSizer;
@ -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 );
bFpFilterRightBoxSizer->Add( m_ButtonDeleteAllFootprintFilter, 0, wxALL|wxEXPAND, 5 );
bPanelFpFilterBoxSizer->Add( bFpFilterRightBoxSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_PanelFootprintFilter->SetSizer( bPanelFpFilterBoxSizer );
m_PanelFootprintFilter->Layout();
bPanelFpFilterBoxSizer->Fit( m_PanelFootprintFilter );
@ -226,6 +239,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
bUpperSizer->Add( m_NoteBook, 1, wxEXPAND, 5 );
bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_stdSizerButton = new wxStdDialogButtonSizer();
@ -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_stdSizerButton->AddButton( m_stdSizerButtonCancel );
m_stdSizerButton->Realize();
bMainSizer->Add( m_stdSizerButton, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_ButtonCopyDoc->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::CopyDocToAlias ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -11,6 +11,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
@ -47,7 +48,7 @@
///////////////////////////////////////////////////////////////////////////////
/// 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:
@ -106,7 +107,7 @@ class DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE : public wxDialog
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();
};

View File

@ -631,8 +631,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
else
fieldValueTextCtrl->Enable( true );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( EESCHEMA_INTERNAL_UNIT,
g_UserUnit, field.m_Size.x ) );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.m_Size.x ) );
wxPoint coord = field.m_Pos;
wxPoint zero = -m_Cmp->m_Pos; // relative zero
@ -711,11 +710,11 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), g_UserUnit );
field.m_Size.y = field.m_Size.x;
int style = m_StyleRadioBox->GetSelection();
if( (style & 1 ) != 0 )
field.m_Italic = true;
else
@ -726,10 +725,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
else
field.m_Bold = false;
field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT );
field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -261,7 +261,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
m_CurrentText->SetOrientation( m_TextOrient->GetSelection() );
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;
if( m_TextShape )

View File

@ -658,8 +658,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
fieldValueTextCtrl->SetValue( field.m_Text );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( EESCHEMA_INTERNAL_UNIT,
g_UserUnit, field.m_Size.x ) );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.m_Size.x ) );
wxPoint coord = field.m_Pos;
wxPoint zero;
@ -745,8 +744,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(), g_UserUnit );
field.m_Size.y = field.m_Size.x;
@ -761,10 +759,8 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
else
field.m_Bold = false;
field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT );
field.m_Pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() );
field.m_Pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() );
// 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

View File

@ -133,7 +133,7 @@ void DIALOG_EDIT_ONE_FIELD::TransfertDataToField()
{
m_textorient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
wxString msg = m_TextSize->GetValue();
m_textsize = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() );
m_textsize = ReturnValueFromString( g_UserUnit, msg );
switch( m_TextHJustificationOpt->GetSelection() )
{

View File

@ -145,9 +145,13 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
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->SetToolTip( _("Use middle mouse button dragging to pan") );
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 );
m_checkAutoPan = new wxCheckBox( m_panel1, wxID_ANY, _("Enable automatic &panning"), wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -2533,7 +2533,7 @@
<property name="style"></property>
<property name="subclass"></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_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
@ -2600,7 +2600,7 @@
<property name="gripper">0</property>
<property name="hidden">0</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="maximize_button">0</property>
<property name="maximum_size"></property>
@ -2621,7 +2621,7 @@
<property name="style"></property>
<property name="subclass"></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_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>

View File

@ -1,6 +1,8 @@
#include <fctsys.h>
#include <macros.h>
#include <gr_basic.h>
#include <base_units.h>
#include <libeditframe.h>
#include <class_libentry.h>
#include <lib_pin.h>
@ -91,11 +93,11 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event )
{
if( ! IsShown() ) // do nothing at init time
return;
int units = ((LIB_EDIT_FRAME*)GetParent())->GetInternalUnits();
int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize(), units );
int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize(), units);
int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize() );
int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize());
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 pinType = GetElectricalType();

View File

@ -148,7 +148,7 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
Line = m_TextValue->GetValue();
m_parent->m_textOrientation = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
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_drawSpecificUnit = m_CommonUnit->GetValue() ? false : true;

File diff suppressed because it is too large Load Diff

View File

@ -1,233 +1,240 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_lib_new_component_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxVERTICAL );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("General Settings"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
m_staticText6->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bSizer5->Add( m_staticText6, 0, wxALIGN_LEFT, 3 );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
bSizer2->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Component &name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
m_staticText2->SetToolTip( _("This is the component name in library,\nand also the default component value when loaded in the schematic.") );
bSizer2->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer2->Add( 0, 0, 1, wxEXPAND, 3 );
m_textName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 100,-1 ), 0 );
bSizer2->Add( m_textName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer2->Add( 30, 0, 0, wxEXPAND, 3 );
bSizer5->Add( bSizer2, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
bSizer3->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Default &reference designator:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
m_staticText3->SetToolTip( _("This is the reference used in schematic for annotation.\nDo not use digits in reference.") );
bSizer3->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
m_textReference = new wxTextCtrl( this, wxID_ANY, _("U"), wxDefaultPosition, wxSize( 100,-1 ), 0 );
bSizer3->Add( m_textReference, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer3->Add( 30, 0, 0, wxEXPAND, 5 );
bSizer5->Add( bSizer3, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
bSizer4->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Number of &parts per package:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
m_staticText4->SetToolTip( _("This is the number of parts in this component package.\nA 74LS00 gate has 4 parts per packages.") );
bSizer4->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer4->Add( 0, 0, 1, wxEXPAND, 3 );
m_spinPartCount = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxSize( 100,-1 ), wxSP_ARROW_KEYS, 1, 26, 0 );
bSizer4->Add( m_spinPartCount, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer4->Add( 30, 0, 0, wxEXPAND, 3 );
bSizer5->Add( bSizer4, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
bSizer7->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkHasConversion = new wxCheckBox( this, wxID_ANY, _("Create component with &alternate body style (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkHasConversion->SetToolTip( _("Check this option for components that have a De Morgan representation.\nThis is usual for gates.") );
bSizer7->Add( m_checkHasConversion, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer7, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
bSizer8->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkIsPowerSymbol = new wxCheckBox( this, wxID_ANY, _("Create component as power &symbol"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkIsPowerSymbol->SetToolTip( _("Check this option for power symbols.\nPower symbols have specific properties for Eeschema:\n- Value cannot be edited (to avoid mistakes) because this is the pin name that is important for a power symbol\n- Reference is updated automatically when a netlist is created (no need to run Annotate)") );
bSizer8->Add( m_checkIsPowerSymbol, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer8, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
bSizer9->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkLockItems = new wxCheckBox( this, wxID_ANY, _("Parts in package locked (cannot be swapped)"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkLockItems->SetToolTip( _("Check this option if Eeschema cannot change parts selections inside a given package\nThis happens when parts are different in this package.\nWhen this option is not checked, Eeschema automatically choose the parts in packages to minimize packages count") );
bSizer9->Add( m_checkLockItems, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer9, 0, wxALL|wxEXPAND, 0 );
bSizer5->Add( 0, 0, 0, wxALL|wxEXPAND, 10 );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("Global Pin Settings"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
m_staticText7->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bSizer5->Add( m_staticText7, 0, wxALIGN_LEFT|wxBOTTOM, 3 );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
bSizer6->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText41 = new wxStaticText( this, wxID_ANY, _("Pin text position &offset:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText41->Wrap( -1 );
m_staticText41->SetToolTip( _("Margin (in 0.001 inches) between a pin name position and the component body.\nA value from 10 to 40 is usually good.") );
bSizer6->Add( m_staticText41, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer6->Add( 0, 0, 1, wxEXPAND, 3 );
m_spinPinTextPosition = new wxSpinCtrl( this, wxID_ANY, wxT("40"), wxDefaultPosition, wxSize( 100,-1 ), wxSP_ARROW_KEYS, 1, 100, 40 );
bSizer6->Add( m_spinPinTextPosition, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxSize( 30,-1 ), 0 );
m_staticText5->Wrap( -1 );
bSizer6->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL, 3 );
bSizer5->Add( bSizer6, 1, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxHORIZONTAL );
bSizer10->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkShowPinNumber = new wxCheckBox( this, wxID_ANY, _("Show pin n&umber text"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinNumber->SetValue(true);
bSizer10->Add( m_checkShowPinNumber, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer10, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxHORIZONTAL );
bSizer12->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkShowPinName = new wxCheckBox( this, wxID_ANY, _("Show pin name te&xt"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinName->SetValue(true);
bSizer12->Add( m_checkShowPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer12, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer121;
bSizer121 = new wxBoxSizer( wxHORIZONTAL );
bSizer121->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkShowPinNameInside = new wxCheckBox( this, wxID_ANY, _("Pin name &inside"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinNameInside->SetValue(true);
bSizer121->Add( m_checkShowPinNameInside, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer121, 1, wxEXPAND, 5 );
bSizer5->Add( 0, 5, 0, wxALL|wxEXPAND, 10 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizer5->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 0 );
mainSizer->Add( bSizer5, 1, wxALL|wxEXPAND, 12 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
}
DIALOG_LIB_NEW_COMPONENT_BASE::~DIALOG_LIB_NEW_COMPONENT_BASE()
{
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_lib_new_component_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_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 );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxVERTICAL );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("General Settings"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
m_staticText6->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bSizer5->Add( m_staticText6, 0, wxALIGN_LEFT, 3 );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
bSizer2->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Component &name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
m_staticText2->SetToolTip( _("This is the component name in library,\nand also the default component value when loaded in the schematic.") );
bSizer2->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer2->Add( 0, 0, 1, wxEXPAND, 3 );
m_textName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 100,-1 ), 0 );
bSizer2->Add( m_textName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer2->Add( 30, 0, 0, wxEXPAND, 3 );
bSizer5->Add( bSizer2, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
bSizer3->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Default &reference designator:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
m_staticText3->SetToolTip( _("This is the reference used in schematic for annotation.\nDo not use digits in reference.") );
bSizer3->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
m_textReference = new wxTextCtrl( this, wxID_ANY, _("U"), wxDefaultPosition, wxSize( 100,-1 ), 0 );
bSizer3->Add( m_textReference, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer3->Add( 30, 0, 0, wxEXPAND, 5 );
bSizer5->Add( bSizer3, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
bSizer4->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Number of &parts per package:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
m_staticText4->SetToolTip( _("This is the number of parts in this component package.\nA 74LS00 gate has 4 parts per packages.") );
bSizer4->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer4->Add( 0, 0, 1, wxEXPAND, 3 );
m_spinPartCount = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxSize( 100,-1 ), wxSP_ARROW_KEYS, 1, 26, 0 );
bSizer4->Add( m_spinPartCount, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer4->Add( 30, 0, 0, wxEXPAND, 3 );
bSizer5->Add( bSizer4, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
bSizer7->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkHasConversion = new wxCheckBox( this, wxID_ANY, _("Create component with &alternate body style (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkHasConversion->SetToolTip( _("Check this option for components that have a De Morgan representation.\nThis is usual for gates.") );
bSizer7->Add( m_checkHasConversion, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer7, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
bSizer8->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkIsPowerSymbol = new wxCheckBox( this, wxID_ANY, _("Create component as power &symbol"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkIsPowerSymbol->SetToolTip( _("Check this option for power symbols.\nPower symbols have specific properties for Eeschema:\n- Value cannot be edited (to avoid mistakes) because this is the pin name that is important for a power symbol\n- Reference is updated automatically when a netlist is created (no need to run Annotate)") );
bSizer8->Add( m_checkIsPowerSymbol, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer8, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
bSizer9->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkLockItems = new wxCheckBox( this, wxID_ANY, _("Parts in package locked (cannot be swapped)"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkLockItems->SetToolTip( _("Check this option if Eeschema cannot change parts selections inside a given package\nThis happens when parts are different in this package.\nWhen this option is not checked, Eeschema automatically choose the parts in packages to minimize packages count") );
bSizer9->Add( m_checkLockItems, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer9, 0, wxALL|wxEXPAND, 0 );
bSizer5->Add( 0, 0, 0, wxALL|wxEXPAND, 10 );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("Global Pin Settings"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
m_staticText7->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bSizer5->Add( m_staticText7, 0, wxALIGN_LEFT|wxBOTTOM, 3 );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
bSizer6->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText41 = new wxStaticText( this, wxID_ANY, _("Pin text position &offset:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText41->Wrap( -1 );
m_staticText41->SetToolTip( _("Margin (in 0.001 inches) between a pin name position and the component body.\nA value from 10 to 40 is usually good.") );
bSizer6->Add( m_staticText41, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer6->Add( 0, 0, 1, wxEXPAND, 3 );
m_spinPinTextPosition = new wxSpinCtrl( this, wxID_ANY, wxT("40"), wxDefaultPosition, wxSize( 100,-1 ), wxSP_ARROW_KEYS, 1, 100, 40 );
bSizer6->Add( m_spinPinTextPosition, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxSize( 30,-1 ), 0 );
m_staticText5->Wrap( -1 );
bSizer6->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL, 3 );
bSizer5->Add( bSizer6, 1, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxHORIZONTAL );
bSizer10->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkShowPinNumber = new wxCheckBox( this, wxID_ANY, _("Show pin n&umber text"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinNumber->SetValue(true);
bSizer10->Add( m_checkShowPinNumber, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer10, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxHORIZONTAL );
bSizer12->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkShowPinName = new wxCheckBox( this, wxID_ANY, _("Show pin name te&xt"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinName->SetValue(true);
bSizer12->Add( m_checkShowPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer12, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer121;
bSizer121 = new wxBoxSizer( wxHORIZONTAL );
bSizer121->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkShowPinNameInside = new wxCheckBox( this, wxID_ANY, _("Pin name &inside"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinNameInside->SetValue(true);
bSizer121->Add( m_checkShowPinNameInside, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer121, 1, wxEXPAND, 5 );
bSizer5->Add( 0, 5, 0, wxALL|wxEXPAND, 10 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizer5->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 0 );
mainSizer->Add( bSizer5, 1, wxALL|wxEXPAND, 12 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
}
DIALOG_LIB_NEW_COMPONENT_BASE::~DIALOG_LIB_NEW_COMPONENT_BASE()
{
}

View File

@ -1,82 +1,66 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_lib_new_component_base__
#define __dialog_lib_new_component_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/spinctrl.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
{
private:
protected:
wxStaticText* m_staticText6;
wxStaticText* m_staticText2;
wxTextCtrl* m_textName;
wxStaticText* m_staticText3;
wxTextCtrl* m_textReference;
wxStaticText* m_staticText4;
wxSpinCtrl* m_spinPartCount;
wxCheckBox* m_checkHasConversion;
wxCheckBox* m_checkIsPowerSymbol;
wxCheckBox* m_checkLockItems;
wxStaticText* m_staticText7;
wxStaticText* m_staticText41;
wxSpinCtrl* m_spinPinTextPosition;
wxStaticText* m_staticText5;
wxCheckBox* m_checkShowPinNumber;
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__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_LIB_NEW_COMPONENT_BASE_H__
#define __DIALOG_LIB_NEW_COMPONENT_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/spinctrl.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 DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText6;
wxStaticText* m_staticText2;
wxTextCtrl* m_textName;
wxStaticText* m_staticText3;
wxTextCtrl* m_textReference;
wxStaticText* m_staticText4;
wxSpinCtrl* m_spinPartCount;
wxCheckBox* m_checkHasConversion;
wxCheckBox* m_checkIsPowerSymbol;
wxCheckBox* m_checkLockItems;
wxStaticText* m_staticText7;
wxStaticText* m_staticText41;
wxSpinCtrl* m_spinPinTextPosition;
wxStaticText* m_staticText5;
wxCheckBox* m_checkShowPinNumber;
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_H__

View File

@ -207,19 +207,19 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event )
{
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();
s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
s_Offset.y = ReturnValueFromString( g_UserUnit, msg );
}
}
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenWidth( )
{
g_HPGL_Pen_Descr.m_Pen_Diam = ReturnValueFromTextCtrl( *m_penWidthCtrl,
EESCHEMA_INTERNAL_UNIT);
g_HPGL_Pen_Descr.m_Pen_Diam = ReturnValueFromTextCtrl( *m_penWidthCtrl );
if( 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 )
{
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();
s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
s_Offset.y = ReturnValueFromString( g_UserUnit, msg );
}
Plot_Schematic_HPGL( aPlotAll );

View File

@ -164,8 +164,8 @@ void DIALOG_PLOT_SCHEMATIC_PS::initOptVars()
m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue();
m_plotColorOpt = m_PlotPSColorOption->GetSelection();
m_pageSizeSelect = m_SizeOption->GetSelection();
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl,
EESCHEMA_INTERNAL_UNIT );
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl );
if( g_DrawDefaultLineThickness < 1 )
g_DrawDefaultLineThickness = 1;
}

View File

@ -378,7 +378,7 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
aScreen->Draw( panel, dc, GR_DEFAULT_DRAWMODE );
if( printReference )
parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness );
parent->TraceWorkSheet( dc, aScreen, g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
g_DrawBgColor = bg_color;
aScreen->m_IsPrinting = false;

View File

@ -31,6 +31,7 @@
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <wxEeschemaStruct.h>
#include <base_units.h>
#include <general.h>
#include <class_library.h>
@ -70,7 +71,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
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
if( IsShown() )

View File

@ -188,7 +188,7 @@ bool LIB_ARC::HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTran
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 )
return false;
@ -738,7 +738,7 @@ void LIB_ARC::calcRadiusAngles()
wxPoint centerStartVector = TwoPointVector( m_Pos, m_ArcStart );
wxPoint centerEndVector = TwoPointVector( m_Pos, m_ArcEnd );
m_Radius = wxRound( EuclideanNorm( centerStartVector ) );
m_Radius = KiROUND( EuclideanNorm( centerStartVector ) );
m_t1 = (int) ( atan2( (double) centerStartVector.y,
(double) centerStartVector.x ) * 1800 / M_PI );

View File

@ -106,7 +106,7 @@ bool LIB_CIRCLE::HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTra
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 ) ) );
if( abs( dist - m_Radius ) <= aThreshold )
@ -346,7 +346,7 @@ void LIB_CIRCLE::calcEdit( const wxPoint& aPosition )
int dx = m_Pos.x - aPosition.x;
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
{

View File

@ -1889,7 +1889,7 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
int numberTextLength = showNum ? m_numTextSize * GetNumberString().Len() : 0;
// 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 )
minsizeV = MAX( TARGET_PIN_RADIUS, INVERT_PIN_RADIUS );
@ -1914,7 +1914,7 @@ EDA_RECT LIB_PIN::GetBoundingBox() const
nameTextLength = ( m_nameTextSize * length ) + nameTextOffset;
// 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

View File

@ -50,7 +50,7 @@
#include <dialogs/dialog_edit_component_in_lib.h>
#include <dialogs/dialog_libedit_dimensions.h>
#include <dialog_helpers.h>
//#include <dialog_helpers.h>
#include <menus_helpers.h>
#include <boost/foreach.hpp>

View File

@ -91,7 +91,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
dlg.SetPadNameTextSize( ReturnStringFromValue( g_UserUnit, pin->GetNumberTextSize() ) );
dlg.SetPadNameTextSizeUnits( units );
dlg.SetLength( ReturnStringFromValue( g_UserUnit, pin->GetLength(), m_internalUnits ) );
dlg.SetLength( ReturnStringFromValue( g_UserUnit, pin->GetLength() ) );
dlg.SetLengthUnits( units );
dlg.SetAddToAllParts( pin->GetUnit() == 0 );
dlg.SetAddToAllBodyStyles( pin->GetConvert() == 0 );
@ -119,10 +119,10 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
}
// Save the pin properties to use for the next new pin.
LastPinNameSize = ReturnValueFromString( g_UserUnit, dlg.GetNameTextSize(), m_internalUnits );
LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize(), m_internalUnits );
LastPinNameSize = ReturnValueFromString( g_UserUnit, dlg.GetNameTextSize() );
LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize() );
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() );
LastPinType = dlg.GetElectricalType();
LastPinCommonConvert = dlg.GetAddToAllBodyStyles();

View File

@ -169,7 +169,7 @@ int SCH_BUS_ENTRY::GetPenSize() const
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 );
}

View File

@ -214,7 +214,7 @@ int SCH_LINE::GetPenSize() const
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 );
}

View File

@ -651,8 +651,8 @@ EDA_RECT SCH_SHEET::GetBoundingBox() const
end += m_pos;
// Move upper and lower limits to include texts:
box.SetY( box.GetY() - ( wxRound( m_sheetNameSize * 1.3 ) + 8 ) );
end.y += wxRound( m_fileNameSize * 1.3 ) + 8;
box.SetY( box.GetY() - ( KiROUND( m_sheetNameSize * 1.3 ) + 8 ) );
end.y += KiROUND( m_fileNameSize * 1.3 ) + 8;
box.SetEnd( end );
box.Inflate( lineWidth / 2 );

View File

@ -1242,7 +1242,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
int x = symb_len + linewidth + 3;
// 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)
aPoints.push_back( wxPoint( 0, 0 ) );

View File

@ -32,6 +32,7 @@
#include <class_drawpanel.h>
#include <gestfich.h>
#include <confirm.h>
#include <base_units.h>
#include <general.h>
#include <protos.h>
@ -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 )
{
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
TraceWorkSheet( aDC, GetScreen(), g_DrawDefaultLineThickness );
TraceWorkSheet( aDC, GetScreen(), g_DrawDefaultLineThickness, MILS_TO_IU_SCALAR );
}

View File

@ -189,13 +189,9 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
else if( loadFromFile )
aSheet->Load( this );
aSheet->SetFileNameSize( ReturnValueFromString( g_UserUnit,
dlg.GetFileNameTextSize(),
m_internalUnits ) );
aSheet->SetFileNameSize( ReturnValueFromString( g_UserUnit, dlg.GetFileNameTextSize() ) );
aSheet->SetName( dlg.GetSheetName() );
aSheet->SetSheetNameSize( ReturnValueFromString( g_UserUnit,
dlg.GetSheetNameTextSize(),
m_internalUnits ) );
aSheet->SetSheetNameSize( ReturnValueFromString( g_UserUnit, dlg.GetSheetNameTextSize() ) );
if( aSheet->GetName().IsEmpty() )
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&
if( sheet->HasPins() )
{
int gridSizeX = wxRound( screen->GetGridSize().x );
int gridSizeY = wxRound( screen->GetGridSize().y );
int gridSizeX = KiROUND( screen->GetGridSize().x );
int gridSizeY = KiROUND( screen->GetGridSize().y );
// If the sheet has pins, use the pin positions to clamp the minimum height.
height = ( height < sheet->GetMinHeight() + gridSizeY ) ?

View File

@ -85,8 +85,8 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC )
}
aSheetPin->m_Text = dlg.GetLabelName();
aSheetPin->m_Size.y = ReturnValueFromString( g_UserUnit, dlg.GetTextHeight(), m_internalUnits );
aSheetPin->m_Size.x = ReturnValueFromString( g_UserUnit, dlg.GetTextWidth(), m_internalUnits );
aSheetPin->m_Size.y = ReturnValueFromString( g_UserUnit, dlg.GetTextHeight() );
aSheetPin->m_Size.x = ReturnValueFromString( g_UserUnit, dlg.GetTextWidth() );
aSheetPin->SetShape( dlg.GetConnectionType() );
if( aDC )

View File

@ -82,7 +82,7 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem )
return;
val = dialog.GetWidth();
m_drawLineWidth = ReturnValueFromString( g_UserUnit, val, m_internalUnits );
m_drawLineWidth = ReturnValueFromString( g_UserUnit, val );
m_drawSpecificConvert = !dialog.GetApplyToAllConversions();
m_drawSpecificUnit = !dialog.GetApplyToAllUnits();

View File

@ -38,10 +38,10 @@
/**
* Function scale
* converts a distance given in floating point to our deci-mils
* Function scaletoIU
* 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:
* Tools and D_CODES
@ -301,9 +301,9 @@ void GERBER_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem )
continue;
GERBER_DRAW_ITEM* dupItem = new GERBER_DRAW_ITEM( aItem );
wxPoint move_vector;
move_vector.x = scale( ii * GetLayerParams().m_StepForRepeat.x,
move_vector.x = scaletoIU( ii * GetLayerParams().m_StepForRepeat.x,
GetLayerParams().m_StepForRepeatMetric );
move_vector.y = scale( jj * GetLayerParams().m_StepForRepeat.y,
move_vector.y = scaletoIU( jj * GetLayerParams().m_StepForRepeat.y,
GetLayerParams().m_StepForRepeatMetric );
dupItem->MoveXY( move_vector );
m_Parent->GetBoard()->m_Drawings.Append( dupItem );

View File

@ -39,10 +39,10 @@
/**
* Function scale
* converts a distance given in floating point to our deci-mils
* Function scaletoIU
* 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
/**
* Function mapPt
@ -52,7 +52,7 @@ extern int scale( double aCoord, bool isMetric ); // defined it rs274d
*/
static wxPoint mapPt( double x, double y, bool isMetric )
{
wxPoint ret( scale( x, isMetric ), scale( y, isMetric ) );
wxPoint ret( scaletoIU( x, isMetric ), scaletoIU( y, isMetric ) );
return ret;
}
@ -157,7 +157,7 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
*/
curPos += mapPt( params[2].GetValue( tool ), params[3].GetValue( tool ), m_GerbMetric );
curPos = aParent->GetABPosition( curPos );
int radius = scale( params[1].GetValue( tool ), m_GerbMetric ) / 2;
int radius = scaletoIU( params[1].GetValue( tool ), m_GerbMetric ) / 2;
if( !aFilledShape )
GRCircle( aClipBox, aDC, curPos, radius, 0, aColor );
else
@ -176,7 +176,7 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
ConvertShapeToPolygon( aParent, polybuffer );
// shape rotation:
rotation = wxRound( params[6].GetValue( tool ) * 10.0 );
rotation = KiROUND( params[6].GetValue( tool ) * 10.0 );
if( rotation )
{
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
@ -205,7 +205,7 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
ConvertShapeToPolygon( aParent, polybuffer );
// shape rotation:
rotation = wxRound( params[5].GetValue( tool ) * 10.0 );
rotation = KiROUND( params[5].GetValue( tool ) * 10.0 );
if( rotation )
{
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
@ -234,7 +234,7 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
ConvertShapeToPolygon( aParent, polybuffer );
// shape rotation:
rotation = wxRound( params[5].GetValue( tool ) * 10.0 );
rotation = KiROUND( params[5].GetValue( tool ) * 10.0 );
if( rotation )
{
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
@ -264,7 +264,7 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
ConvertShapeToPolygon( aParent, polybuffer );
// shape rotation:
rotation = wxRound( params[5].GetValue( tool ) * 10.0 );
rotation = KiROUND( params[5].GetValue( tool ) * 10.0 );
// Because a thermal shape has 4 identical sub-shapes, only one is created in polybuffer.
// We must draw 4 sub-shapes rotated by 90 deg
@ -300,10 +300,10 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
* type(6), pos.x, pos.y, diam, penwidth, gap, circlecount, crosshair thickness, crosshaire len, rotation
* type is not stored in parameters list, so the first parameter is pos.x
*/
int outerDiam = scale( params[2].GetValue( tool ), m_GerbMetric );
int penThickness = scale( params[3].GetValue( tool ), m_GerbMetric );
int gap = scale( params[4].GetValue( tool ), m_GerbMetric );
int numCircles = wxRound( params[5].GetValue( tool ) );
int outerDiam = scaletoIU( params[2].GetValue( tool ), m_GerbMetric );
int penThickness = scaletoIU( params[3].GetValue( tool ), m_GerbMetric );
int gap = scaletoIU( params[4].GetValue( tool ), m_GerbMetric );
int numCircles = KiROUND( params[5].GetValue( tool ) );
// Draw circles:
wxPoint center = aParent->GetABPosition( curPos );
@ -329,7 +329,7 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
// Draw the cross:
ConvertShapeToPolygon( aParent, polybuffer );
rotation = wxRound( params[8].GetValue( tool ) * 10.0 );
rotation = KiROUND( params[8].GetValue( tool ) * 10.0 );
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
{
// shape rotation:
@ -352,14 +352,14 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
* type is not stored in parameters list, so the first parameter is exposure
*/
int numPoints = (int) params[1].GetValue( tool );
rotation = wxRound( params[numPoints * 2 + 4].GetValue( tool ) * 10.0 );
rotation = KiROUND( params[numPoints * 2 + 4].GetValue( tool ) * 10.0 );
wxPoint pos;
// Read points. numPoints does not include the starting point, so add 1.
for( int i = 0; i<numPoints + 1; ++i )
{
int jj = i * 2 + 2;
pos.x = scale( params[jj].GetValue( tool ), m_GerbMetric );
pos.y = scale( params[jj + 1].GetValue( tool ), m_GerbMetric );
pos.x = scaletoIU( params[jj].GetValue( tool ), m_GerbMetric );
pos.y = scaletoIU( params[jj + 1].GetValue( tool ), m_GerbMetric );
polybuffer.push_back(pos);
}
// rotate polygon and move it to the actual position
@ -392,7 +392,7 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
ConvertShapeToPolygon( aParent, polybuffer );
// rotate polygon and move it to the actual position
rotation = wxRound( params[5].GetValue( tool ) * 10.0 );
rotation = KiROUND( params[5].GetValue( tool ) * 10.0 );
for( unsigned ii = 0; ii < polybuffer.size(); ii++ )
{
RotatePoint( &polybuffer[ii], -rotation );
@ -438,13 +438,13 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent,
case AMP_LINE2:
case AMP_LINE20: // Line with rectangle ends. (Width, start and end pos + rotation)
{
int width = scale( params[1].GetValue( tool ), m_GerbMetric );
int width = scaletoIU( params[1].GetValue( tool ), m_GerbMetric );
wxPoint start = mapPt( params[2].GetValue( tool ),
params[3].GetValue( tool ), m_GerbMetric );
wxPoint end = mapPt( params[4].GetValue( tool ),
params[5].GetValue( tool ), m_GerbMetric );
wxPoint delta = end - start;
int len = wxRound( hypot( delta.x, delta.y ) );
int len = KiROUND( hypot( delta.x, delta.y ) );
// To build the polygon, we must create a horizonta polygon starting to "start"
// and rotate it to have it end point to "end"
@ -459,7 +459,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent,
aBuffer.push_back( currpt );
// Rotate rectangle and move it to the actual start point
int angle = wxRound( atan2( (double) delta.y, (double) delta.x ) * 1800.0 / M_PI );
int angle = KiROUND( atan2( (double) delta.y, (double) delta.x ) * 1800.0 / M_PI );
for( unsigned ii = 0; ii < 4; ii++ )
{
@ -509,10 +509,10 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent,
// Only 1/4 of the full shape is built, because the other 3 shapes will be draw from this first
// rotated by 90, 180 and 270 deg.
// params = center.x (unused here), center.y (unused here), outside diam, inside diam, crosshair thickness
int outerRadius = scale( params[2].GetValue( tool ), m_GerbMetric ) / 2;
int innerRadius = scale( params[3].GetValue( tool ), m_GerbMetric ) / 2;
int halfthickness = scale( params[4].GetValue( tool ), m_GerbMetric ) / 2;
int angle_start = wxRound( asin(
int outerRadius = scaletoIU( params[2].GetValue( tool ), m_GerbMetric ) / 2;
int innerRadius = scaletoIU( params[3].GetValue( tool ), m_GerbMetric ) / 2;
int halfthickness = scaletoIU( params[4].GetValue( tool ), m_GerbMetric ) / 2;
int angle_start = KiROUND( asin(
(double) halfthickness / innerRadius ) * 1800 / M_PI );
// Draw shape in the first cadrant (X and Y > 0)
@ -537,7 +537,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent,
// outer arc
startpos.x = outerRadius;
startpos.y = 0;
angle_start = wxRound( asin( (double) halfthickness / outerRadius ) * 1800 / M_PI );
angle_start = KiROUND( asin( (double) halfthickness / outerRadius ) * 1800 / M_PI );
angle_end = 900 - angle_start;
// First point, near Y axis, outer arc
@ -560,8 +560,8 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent,
case AMP_MOIRE: // A cross hair with n concentric circles. Only the cros is build as polygon
// because circles can be drawn easily
{
int crossHairThickness = scale( params[6].GetValue( tool ), m_GerbMetric );
int crossHairLength = scale( params[7].GetValue( tool ), m_GerbMetric );
int crossHairThickness = scaletoIU( params[6].GetValue( tool ), m_GerbMetric );
int crossHairLength = scaletoIU( params[7].GetValue( tool ), m_GerbMetric );
// Create cross. First create 1/4 of the shape.
// Others point are the same, totated by 90, 180 and 270 deg
@ -593,8 +593,8 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent,
case AMP_POLYGON: // Creates a regular polygon
{
int vertexcount = wxRound( params[1].GetValue( tool ) );
int radius = scale( params[4].GetValue( tool ), m_GerbMetric ) / 2;
int vertexcount = KiROUND( params[1].GetValue( tool ) );
int radius = scaletoIU( params[4].GetValue( tool ), m_GerbMetric ) / 2;
// rs274x said: vertex count = 3 ... 10, and the first corner is on the X axis
if( vertexcount < 3 )
vertexcount = 3;
@ -635,12 +635,12 @@ int AM_PRIMITIVE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
{
case AMP_CIRCLE:
// params = exposure, diameter, pos.x, pos.y
dim = scale( params[1].GetValue( tool ), m_GerbMetric ); // Diameter
dim = scaletoIU( params[1].GetValue( tool ), m_GerbMetric ); // Diameter
break;
case AMP_LINE2:
case AMP_LINE20: // Line with rectangle ends. (Width, start and end pos + rotation)
dim = scale( params[1].GetValue( tool ), m_GerbMetric ); // linne width
dim = scaletoIU( params[1].GetValue( tool ), m_GerbMetric ); // linne width
break;
case AMP_LINE_CENTER:
@ -662,12 +662,12 @@ int AM_PRIMITIVE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
// Only 1/4 of the full shape is built, because the other 3 shapes will be draw from this first
// rotated by 90, 180 and 270 deg.
// params = center.x (unused here), center.y (unused here), outside diam, inside diam, crosshair thickness
dim = scale( params[2].GetValue( tool ), m_GerbMetric ) / 2; // Outer diam
dim = scaletoIU( params[2].GetValue( tool ), m_GerbMetric ) / 2; // Outer diam
}
break;
case AMP_MOIRE: // A cross hair with n concentric circles.
dim = scale( params[7].GetValue( tool ), m_GerbMetric ); // = cross hair len
dim = scaletoIU( params[7].GetValue( tool ), m_GerbMetric ); // = cross hair len
break;
case AMP_OUTLINE: // a free polygon :
@ -681,8 +681,8 @@ int AM_PRIMITIVE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
for( int i = 0; i<numPoints + 1; ++i )
{
int jj = i * 2 + 2;
pos.x = scale( params[jj].GetValue( tool ), m_GerbMetric );
pos.y = scale( params[jj + 1].GetValue( tool ), m_GerbMetric );
pos.x = scaletoIU( params[jj].GetValue( tool ), m_GerbMetric );
pos.y = scaletoIU( params[jj + 1].GetValue( tool ), m_GerbMetric );
if( i == 0 )
pos_min = pos_max = pos;
else
@ -708,7 +708,7 @@ int AM_PRIMITIVE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
break;
case AMP_POLYGON: // Regular polygon
dim = scale( params[4].GetValue( tool ), m_GerbMetric ) / 2; // Radius
dim = scaletoIU( params[4].GetValue( tool ), m_GerbMetric ) / 2; // Radius
break;
case AMP_COMMENT:

View File

@ -115,9 +115,9 @@ wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const
EXCHG( abPos.x, abPos.y );
abPos += m_layerOffset + m_imageParams->m_ImageOffset;
abPos.x = wxRound( abPos.x * m_drawScale.x );
abPos.y = wxRound( abPos.y * m_drawScale.y );
int rotation = wxRound(m_lyrRotation*10) + (m_imageParams->m_ImageRotation*10);
abPos.x = KiROUND( abPos.x * m_drawScale.x );
abPos.y = KiROUND( abPos.y * m_drawScale.y );
int rotation = KiROUND(m_lyrRotation*10) + (m_imageParams->m_ImageRotation*10);
if( rotation )
RotatePoint( &abPos, -rotation );
@ -144,13 +144,13 @@ wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition )
if( !m_mirrorB )
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 )
RotatePoint( &xyPos, rotation );
xyPos.x = wxRound( xyPos.x / m_drawScale.x );
xyPos.y = wxRound( xyPos.y / m_drawScale.y );
xyPos.x = KiROUND( xyPos.x / m_drawScale.x );
xyPos.y = KiROUND( xyPos.y / m_drawScale.y );
xyPos -= m_layerOffset + m_imageParams->m_ImageOffset;
if( m_swapAxis )
@ -368,7 +368,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode,
break;
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 ) ));
halfPenWidth = m_Size.x >> 1;

View File

@ -47,25 +47,25 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
{
case WXK_NUMPAD8:
case WXK_UP:
pos.y -= wxRound( gridSize.y );
pos.y -= KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD2:
case WXK_DOWN:
pos.y += wxRound( gridSize.y );
pos.y += KiROUND( gridSize.y );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD4:
case WXK_LEFT:
pos.x -= wxRound( gridSize.x );
pos.x -= KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;
case WXK_NUMPAD6:
case WXK_RIGHT:
pos.x += wxRound( gridSize.x );
pos.x += KiROUND( gridSize.x );
m_canvas->MoveCursor( pos );
break;

View File

@ -35,6 +35,7 @@
#include <macros.h>
#include <trigo.h>
#include <gr_basic.h>
#include <base_units.h>
#include <gerbview.h>
#include <class_gerber_draw_item.h>
@ -155,7 +156,7 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName )
{
int current_Dcode, ii, dcode_scale;
int current_Dcode, ii;
char* ptcar;
int dimH, dimV, drill, dummy;
float fdimH, fdimV, fdrill;
@ -174,8 +175,7 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName
/* Updating gerber scale: */
dcode_scale = 10; /* By uniting dCode = mil, internal unit = 0.1 mil
* -> 1 unite dcode = 10 unit PCB */
double dcode_scale = MILS_TO_IU_SCALAR; // By uniting dCode = mil, internal unit = MILS_TO_IU_SCALAR
current_Dcode = 0;
if( D_Code_FullFileName.IsEmpty() )
@ -215,9 +215,9 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName
sscanf( line, "%d,%d,%d,%d,%d,%d,%d", &ii,
&dimH, &dimV, &drill, &dummy, &dummy, &type_outil );
dimH = wxRound( dimH * dcode_scale );
dimV = wxRound( dimV * dcode_scale );
drill = wxRound( drill * dcode_scale );
dimH = KiROUND( dimH * dcode_scale );
dimV = KiROUND( dimV * dcode_scale );
drill = KiROUND( drill * dcode_scale );
if( ii < 1 )
ii = 1;
@ -245,9 +245,9 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName
}
}
dimH = wxRound( fdimH * dcode_scale * 1000 );
dimV = wxRound( fdimV * dcode_scale * 1000 );
drill = wxRound( fdrill * dcode_scale * 1000 );
dimH = KiROUND( fdimH * dcode_scale * 1000 );
dimV = KiROUND( fdimV * dcode_scale * 1000 );
drill = KiROUND( fdrill * dcode_scale * 1000 );
if( strchr( "CLROP", c_type_outil[0] ) )
{
@ -600,7 +600,7 @@ void D_CODE::ConvertShapeToPolygon()
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++ )
{

View File

@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="10" />
<FileVersion major="1" minor="11" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">table</property>
<property name="file">dialog_layers_select_to_pcb_base</property>
@ -18,68 +20,44 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<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_name"></property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center">wxBOTH</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></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="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_LAYERS_MAP_DIALOG_BASE</property>
<property name="layer"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">LAYERS_MAP_DIALOG_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="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size">400,286</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Layer selection:</property>
<property name="toolbar_pane">0</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_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
@ -161,7 +139,11 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
@ -180,9 +162,10 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_M_STATICLINESEP</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
@ -193,19 +176,13 @@
<property name="permission">protected</property>
<property name="pin_button">1</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"></property>
<property name="style">wxLI_VERTICAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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_name"></property>
<property name="window_style"></property>
@ -263,7 +240,11 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
@ -283,9 +264,10 @@
<property name="hidden">0</property>
<property name="id">ID_M_STATICTEXTCOPPERLAYERCOUNT</property>
<property name="label">Copper layers count:</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
@ -296,19 +278,13 @@
<property name="permission">protected</property>
<property name="pin_button">1</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"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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_name"></property>
<property name="window_style"></property>
@ -347,7 +323,11 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
@ -367,9 +347,10 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_M_COMBOCOPPERLAYERSCOUNT</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
@ -380,9 +361,8 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
@ -455,7 +435,11 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
@ -476,9 +460,10 @@
<property name="hidden">0</property>
<property name="id">ID_STORE_CHOICE</property>
<property name="label">Store Choice</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
@ -489,9 +474,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</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"></property>
<property name="style"></property>
@ -540,7 +523,11 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
@ -561,9 +548,10 @@
<property name="hidden">0</property>
<property name="id">ID_GET_PREVIOUS_CHOICE</property>
<property name="label">Get Stored Choice</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
@ -574,9 +562,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</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"></property>
<property name="style"></property>
@ -625,7 +611,11 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
@ -646,9 +636,10 @@
<property name="hidden">0</property>
<property name="id">ID_RESET_CHOICE</property>
<property name="label">Reset</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
@ -659,9 +650,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</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"></property>
<property name="style"></property>
@ -716,7 +705,11 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
@ -735,9 +728,10 @@
<property name="gripper">0</property>
<property name="hidden">0</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="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
@ -748,19 +742,13 @@
<property name="permission">protected</property>
<property name="pin_button">1</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"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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_name"></property>
<property name="window_style"></property>

View File

@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="10" />
<FileVersion major="1" minor="11" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_print_using_printer_base</property>
@ -18,10 +20,13 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center"></property>
<property name="context_help"></property>
@ -42,15 +47,17 @@
<property name="subclass"></property>
<property name="title">Print</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_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose">OnCloseWindow</event>
<event name="OnEnterWindow"></event>
@ -151,26 +158,57 @@
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxRadioBox" 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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;fit in page&quot; &quot;Scale 0.5&quot; &quot;Scale 0.7&quot; &quot;Approx. Scale 1&quot; &quot;Accurate Scale 1&quot; &quot;Scale 1.4&quot; &quot;Scale 2&quot; &quot;Scale 3&quot; &quot;Scale 4&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></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="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Approx. Scale:</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_ScaleOption</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">3</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -210,28 +248,55 @@
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></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="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">X Scale Adjust</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_FineAdjustXscaleTitle</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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_name"></property>
<property name="window_style"></property>
@ -266,23 +331,54 @@
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" 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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></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="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</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="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_FineAdjustXscaleOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Set X scale adjust for exact scale plotting</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -326,28 +422,55 @@
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></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="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Y Scale Adjust</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_FineAdjustYscaleTitle</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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_name"></property>
<property name="window_style"></property>
@ -382,23 +505,54 @@
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" 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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></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="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</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="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_FineAdjustYscaleOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Set Y scale adjust for exact scale plotting</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -465,24 +619,55 @@
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" 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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></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="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Mirror</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_Print_Mirror</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -524,26 +709,57 @@
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxRadioBox" 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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Color&quot; &quot;Black and white&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></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="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_PRINT_MODE</property>
<property name="label">Print Mode</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_ModeColorOption</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Choose if you want to print sheets in color, or force the black and white mode.</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -594,24 +810,55 @@
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</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="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_PRINT_OPTIONS</property>
<property name="label">Page Options</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonOption</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -651,24 +898,55 @@
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</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="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_PREVIEW</property>
<property name="label">Preview</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonPreview</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -708,24 +986,55 @@
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</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="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_PRINT_ALL</property>
<property name="label">Print</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonPrint</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -765,24 +1074,55 @@
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</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="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Close</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonQuit</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>

View File

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="10" />
<FileVersion major="1" minor="11" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
@ -19,66 +20,33 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<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_name"></property>
<property name="best_size"></property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</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_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="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</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="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</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="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size">263,254</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Page Borders</property>
<property name="toolbar_pane">0</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_name"></property>
<property name="window_style"></property>
@ -150,7 +118,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@ -172,7 +143,6 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show Page Limits:</property>
<property name="layer"></property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@ -188,9 +158,7 @@
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
@ -244,7 +212,10 @@
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
@ -264,7 +235,6 @@
<property name="gripper">0</property>
<property name="hidden">0</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>
@ -279,19 +249,13 @@
<property name="permission">protected</property>
<property name="pin_button">1</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"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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_name"></property>
<property name="window_style"></property>

View File

@ -25,62 +25,28 @@
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<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_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</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_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="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</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="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</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="resize">Resizable</property>
<property name="show">1</property>
<property name="size">446,330</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Gerbview Options</property>
<property name="toolbar_pane">0</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_name"></property>
<property name="window_style"></property>
@ -1140,10 +1106,6 @@
<property name="subclass"></property>
<property name="toolbar_pane">0</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_name"></property>
<property name="window_style"></property>

View File

@ -33,6 +33,7 @@
#include <common.h>
#include <class_drawpanel.h>
#include <drawtxt.h>
#include <base_units.h>
#include <gerbview.h>
#include <class_board_design_settings.h>
@ -106,7 +107,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( IsElementVisible( DCODES_VISIBLE ) )
DrawItemsDCodeID( DC, GR_COPY );
TraceWorkSheet( DC, screen, 0 );
TraceWorkSheet( DC, screen, 0, MILS_TO_IU_SCALAR );
if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );

View File

@ -63,6 +63,7 @@
#include <gerbview.h>
#include <trigo.h>
#include <macros.h>
#include <base_units.h>
#include <class_gerber_draw_item.h>
#include <class_GERBER.h>
#include <class_excellon.h>
@ -430,8 +431,12 @@ bool EXCELLON_IMAGE::Execute_HEADER_Command( char*& text )
dcode = GetDCODE( iprm + FIRST_DCODE ); // Remember: dcodes are >= FIRST_DCODE
if( dcode == NULL )
break;
double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT / 25.4 : PCB_INTERNAL_UNIT;
dcode->m_Size.x = dcode->m_Size.y = wxRound( dprm * conv_scale );
// conv_scale = scaling factor from inch to Internal Unit
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;
break;
}

View File

@ -15,43 +15,48 @@
#include <../pcbnew/class_track.h>
#include <../pcbnew/class_drawsegment.h>
#include <io_mgr.h>
#include <gerbview.h>
#include <class_board_design_settings.h>
#include <class_gerber_draw_item.h>
#include <select_layers_to_pcb.h>
#include <build_version.h> // BOARD_FILE_VERSION
#include <build_version.h>
#include <wildcards_and_files_ext.h>
/* A helper class to export a Gerber set of files to Pcbnew
*/
class GBR_TO_PCB_EXPORTER
{
GERBVIEW_FRAME* m_gerbview_frame; // the maint gerber frame
FILE * m_file; // .brd file to write to
BOARD* m_pcb; // the board to populate and export
public:
GBR_TO_PCB_EXPORTER(GERBVIEW_FRAME * aFrame, FILE * aFile );
GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME* aFrame, const wxString& aFileName );
~GBR_TO_PCB_EXPORTER();
/**
* Function ExportPcb
* saves a board from a gerber load.
*/
bool ExportPcb( int* LayerLookUpTable );
BOARD* GetBoard() { return m_pcb; }
private:
bool WriteSetup( ); // Write the SETUP section data file
bool WriteGeneralDescrPcb( );
void export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void cleanBoard();
GERBVIEW_FRAME* m_gerbview_frame; // the maint gerber frame
wxString m_file_name; // BOARD file to write to
BOARD* m_pcb; // the board to populate and export
};
GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME * aFrame, FILE * aFile )
GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME* aFrame, const wxString& aFileName )
{
m_gerbview_frame = aFrame;
m_file = aFile;
m_file_name = aFileName;
m_pcb = new BOARD();
}
@ -84,51 +89,37 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
return;
}
wxString FullFileName, msg;
wxString fileName;
wxString path = wxGetCwd();;
wxString PcbExt( wxT( ".brd" ) );
wxFileDialog filedlg( this, _( "Board file name:" ),
path, fileName, LegacyPcbFileWildcard,
wxFD_OPEN );
msg = wxT( "*" ) + PcbExt;
FullFileName = EDA_FileSelector( _( "Board file name:" ),
wxEmptyString,
wxEmptyString,
PcbExt,
msg,
this,
wxFD_SAVE,
false
);
if( FullFileName == wxEmptyString )
if( filedlg.ShowModal() == wxID_CANCEL )
return;
fileName = filedlg.GetPath();
/* Install a dialog frame to choose the mapping
* between gerber layers and Pcbnew layers
*/
LAYERS_MAP_DIALOG* dlg = new LAYERS_MAP_DIALOG( this );
int ok = dlg->ShowModal();
dlg->Destroy();
LAYERS_MAP_DIALOG* layerdlg = new LAYERS_MAP_DIALOG( this );
int ok = layerdlg->ShowModal();
layerdlg->Destroy();
if( ok != wxID_OK )
return;
if( wxFileExists( FullFileName ) )
if( wxFileExists( fileName ) )
{
if( !IsOK( this, _( "Ok to change the existing file ?" ) ) )
return;
}
FILE * file = wxFopen( FullFileName, wxT( "wt" ) );
GBR_TO_PCB_EXPORTER gbr_exporter( this, fileName );
if( file == NULL )
{
msg = _( "Unable to create " ) + FullFileName;
DisplayError( this, msg );
return;
}
GBR_TO_PCB_EXPORTER gbr_exporter( this, file );
gbr_exporter.ExportPcb( dlg->GetLayersLookUpTable() );
fclose( file );
gbr_exporter.ExportPcb( layerdlg->GetLayersLookUpTable() );
}
@ -162,54 +153,6 @@ void GBR_TO_PCB_EXPORTER::cleanBoard()
}
bool GBR_TO_PCB_EXPORTER::WriteSetup( )
{
fprintf( m_file, "$SETUP\n" );
fprintf( m_file, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf( m_file, "Layers %d\n", m_pcb->GetCopperLayerCount() );
fprintf( m_file, "$EndSETUP\n\n" );
return true;
}
bool GBR_TO_PCB_EXPORTER::WriteGeneralDescrPcb( )
{
int nbLayers;
// Print the copper layer count
nbLayers = m_pcb->GetCopperLayerCount();
if( nbLayers <= 1 ) // Minimal layers count in Pcbnew is 2
{
nbLayers = 2;
m_pcb->SetCopperLayerCount(2);
}
fprintf( m_file, "$GENERAL\n" );
fprintf( m_file, "encoding utf-8\n");
fprintf( m_file, "LayerCount %d\n", nbLayers );
// Compute and print the board bounding box
EDA_RECT bbbox = m_pcb->ComputeBoundingBox();
fprintf( m_file, "Di %d %d %d %d\n",
bbbox.GetX(), bbbox.GetY(),
bbbox.GetRight(),
bbbox.GetBottom() );
fprintf( m_file, "$EndGENERAL\n\n" );
return true;
}
/* Routine to save the board
* @param frame = pointer to the main frame
* @param File = FILE * pointer to an already opened file
* @param LayerLookUpTable = look up table: Pcbnew layer for each gerber layer
* @return 1 if OK, 0 if fail
*/
bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
{
BOARD* gerberPcb = m_gerbview_frame->GetBoard();
@ -235,22 +178,31 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
cleanBoard();
m_pcb->SetCopperLayerCount( LayerLookUpTable[32] );
// Switch the locale to standard C (needed to print floating point numbers)
SetLocaleTo_C_standard();
try
{
wxFileName pcbFileName( m_file_name );
PROPERTIES props;
// write PCB header
fprintf( m_file, "PCBNEW-BOARD Version %d date %s\n\n", LEGACY_BOARD_FILE_VERSION,
TO_UTF8( DateAndTime() ) );
WriteGeneralDescrPcb( );
WriteSetup( );
wxString header = wxString::Format(
wxT( "PCBNEW-BOARD Version %d date %s\n\n# Created by GerbView%s\n\n" ),
LEGACY_BOARD_FILE_VERSION, DateAndTime().GetData(),
GetBuildVersion().GetData() );
// write items on file
m_pcb->Save( m_file );
props["header"] = header;
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
pi->Save( m_file_name, m_pcb, &props );
}
catch( IO_ERROR ioe )
{
DisplayError( m_gerbview_frame, ioe.errorText );
return false;
}
SetLocaleTo_Default(); // revert to the current locale
return true;
}
void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
DRAWSEGMENT* drawitem = new DRAWSEGMENT( m_pcb, PCB_LINE_T );
@ -268,7 +220,7 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in
(double)( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) );
drawitem->SetShape( S_ARC );
drawitem->SetAngle( wxRound( (a - b) / M_PI * 1800.0 ) );
drawitem->SetAngle( KiROUND( (a - b) / M_PI * 1800.0 ) );
drawitem->SetStart( aGbrItem->m_ArcCentre );
if( drawitem->GetAngle() < 0 )

View File

@ -3,6 +3,29 @@
* @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 <appl_wxstruct.h>
#include <class_drawpanel.h>

View File

@ -32,6 +32,7 @@
#include <class_drawpanel.h>
#include <build_version.h>
#include <macros.h>
#include <base_units.h>
#include <class_layer_box_selector.h>
#include <gerbview.h>
@ -407,7 +408,7 @@ void GERBVIEW_FRAME::Liste_D_Codes()
D_CODE* pt_D_code;
wxString Line;
wxArrayString list;
int scale = 10000;
double scale = MILS_TO_IU_SCALAR * 1000;
int curr_layer = getActiveLayer();
for( int layer = 0; layer < 32; layer++ )

View File

@ -8,11 +8,50 @@
#include <gerbview.h>
#include <macros.h>
#include <class_GERBER.h>
#include <base_units.h>
/* These routines read the text string point from Text.
* On exit, Text points the beginning of the sequence unread
*/
// convertion scale from gerber file units to Gerbview internal units
// depending on the gerber file format
// this scale list assumes gerber units are imperial.
// for metric gerber units, the imperial to metric conversion is made in read functions
static double scale_list[10] =
{
1000.0 * MILS_TO_IU_SCALAR,
100.0 * MILS_TO_IU_SCALAR,
10.0 * MILS_TO_IU_SCALAR,
1.0 * MILS_TO_IU_SCALAR,
0.1 * MILS_TO_IU_SCALAR,
0.01 * MILS_TO_IU_SCALAR,
0.001 * MILS_TO_IU_SCALAR,
0.0001 * MILS_TO_IU_SCALAR,
0.00001 * MILS_TO_IU_SCALAR,
0.000001 * MILS_TO_IU_SCALAR
};
/**
* Function scale
* converts a distance given in floating point to our internal units
* (deci-mils or nano units)
*/
int scaletoIU( double aCoord, bool isMetric )
{
int ret;
if( isMetric )
ret = KiROUND( aCoord * MILS_TO_IU_SCALAR / 0.00254 );
else
ret = KiROUND( aCoord * MILS_TO_IU_SCALAR );
return ret;
}
wxPoint GERBER_IMAGE::ReadXYCoord( char*& Text )
{
wxPoint pos;
@ -53,10 +92,11 @@ wxPoint GERBER_IMAGE::ReadXYCoord( char*& Text )
*text = 0;
if( is_float )
{
if( m_GerbMetric )
current_coord = wxRound( atof( line ) / 0.00254 );
else
current_coord = wxRound( atof( line ) * PCB_INTERNAL_UNIT );
// When X or Y values are float numbers, they are given in mm or inches
if( m_GerbMetric ) // units are mm
current_coord = KiROUND( atof( line ) * MILS_TO_IU_SCALAR / 0.0254 );
else // units are inches
current_coord = KiROUND( atof( line ) * MILS_TO_IU_SCALAR * 1000 );
}
else
{
@ -74,19 +114,12 @@ wxPoint GERBER_IMAGE::ReadXYCoord( char*& Text )
*text = 0;
}
current_coord = atoi( line );
double real_scale = 1.0;
double scale_list[10] =
{
10000.0, 1000.0, 100.0, 10.0,
1,
0.1, 0.01, 0.001, 0.0001,0.00001
};
real_scale = scale_list[fmt_scale];
double real_scale = scale_list[fmt_scale];
if( m_GerbMetric )
real_scale = real_scale / 25.4;
current_coord = wxRound( current_coord * real_scale );
current_coord = KiROUND( current_coord * real_scale );
}
if( type_coord == 'X' )
@ -150,10 +183,11 @@ wxPoint GERBER_IMAGE::ReadIJCoord( char*& Text )
*text = 0;
if( is_float )
{
if( m_GerbMetric )
current_coord = wxRound( atof( line ) / 0.00254 );
else
current_coord = wxRound( atof( line ) * PCB_INTERNAL_UNIT );
// When X or Y values are float numbers, they are given in mm or inches
if( m_GerbMetric ) // units are mm
current_coord = KiROUND( atof( line ) * MILS_TO_IU_SCALAR / 0.0254 );
else // units are inches
current_coord = KiROUND( atof( line ) * MILS_TO_IU_SCALAR * 1000 );
}
else
{
@ -172,21 +206,14 @@ wxPoint GERBER_IMAGE::ReadIJCoord( char*& Text )
*text = 0;
}
current_coord = atoi( line );
double real_scale = 1.0;
if( fmt_scale < 0 || fmt_scale > 9 )
fmt_scale = 4; // select scale 1.0
double scale_list[10] =
{
10000.0, 1000.0, 100.0, 10.0,
1,
0.1, 0.01, 0.001, 0.0001,0.00001
};
real_scale = scale_list[fmt_scale];
double real_scale = scale_list[fmt_scale];
if( m_GerbMetric )
real_scale = real_scale / 25.4;
current_coord = wxRound( current_coord * real_scale );
current_coord = KiROUND( current_coord * real_scale );
}
if( type_coord == 'I' )
pos.x = current_coord;

View File

@ -345,8 +345,8 @@ static void fillArcPOLY( BOARD* aPcb, GERBER_DRAW_ITEM* aGbrItem,
* angle is trigonometrical (counter-clockwise),
* and axis is the X,Y gerber coordinates
*/
int start_angle = wxRound(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 start_angle = KiROUND(atan2( (double) start.y, (double) start.x ) * 1800 / M_PI);
int end_angle = KiROUND(atan2( (double) end.y, (double) end.x ) * 1800 / M_PI);
// dummyTrack has right geometric parameters, but
// 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 )
}
/**
* 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 )
{
wxSize size( 15, 15 );

View File

@ -5,6 +5,7 @@
#include <fctsys.h>
#include <common.h>
#include <macros.h>
#include <base_units.h>
#include <gerbview.h>
#include <class_GERBER.h>
@ -157,7 +158,11 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
char line[GERBER_BUFZ];
wxString msg;
double fcoord;
double conv_scale = m_GerbMetric ? PCB_INTERNAL_UNIT / 25.4 : PCB_INTERNAL_UNIT;
// conv_scale = scaling factor from inch to Internal Unit
double conv_scale = MILS_TO_IU_SCALAR*1000;
if( m_GerbMetric )
conv_scale /= 25.4;
// D( printf( "%22s: Command <%c%c>\n", __func__, (command >> 8) & 0xFF, command & 0xFF ); )
@ -301,13 +306,13 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
case 'A': // A axis offset in current unit (inch or mm)
text++;
fcoord = ReadDouble( text );
m_Offset.x = wxRound( fcoord * conv_scale );
m_Offset.x = KiROUND( fcoord * conv_scale );
break;
case 'B': // B axis offset in current unit (inch or mm)
text++;
fcoord = ReadDouble( text );
m_Offset.y = wxRound( fcoord * conv_scale );
m_Offset.y = KiROUND( fcoord * conv_scale );
break;
}
}
@ -341,13 +346,13 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
case 'A': // A axis offset in current unit (inch or mm)
text++;
fcoord = ReadDouble( text );
m_ImageOffset.x = wxRound( fcoord * conv_scale );
m_ImageOffset.x = KiROUND( fcoord * conv_scale );
break;
case 'B': // B axis offset in current unit (inch or mm)
text++;
fcoord = ReadDouble( text );
m_ImageOffset.y = wxRound( fcoord * conv_scale );
m_ImageOffset.y = KiROUND( fcoord * conv_scale );
break;
}
}
@ -424,7 +429,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
m_ImageJustifyXCenter = true;
text++;
}
else m_ImageJustifyOffset.x = wxRound( ReadDouble( text ) * conv_scale);
else m_ImageJustifyOffset.x = KiROUND( ReadDouble( text ) * conv_scale);
break;
case 'B': // B axis justify
@ -439,7 +444,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
m_ImageJustifyYCenter = true;
text++;
}
else m_ImageJustifyOffset.y = wxRound( ReadDouble( text ) * conv_scale);
else m_ImageJustifyOffset.y = KiROUND( ReadDouble( text ) * conv_scale);
break;
default:
text++;
@ -575,7 +580,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
text += 2; // skip "C," for example
dcode->m_Size.x = dcode->m_Size.y =
wxRound( ReadDouble( text ) * conv_scale );
KiROUND( ReadDouble( text ) * conv_scale );
switch( stdAperture ) // Aperture desceiption has optional parameters. Read them
{
@ -588,7 +593,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
{
text++;
dcode->m_Drill.x = dcode->m_Drill.y =
wxRound( ReadDouble( text ) * conv_scale );
KiROUND( ReadDouble( text ) * conv_scale );
dcode->m_DrillShape = APT_DEF_ROUND_HOLE;
}
@ -599,7 +604,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
{
text++;
dcode->m_Drill.y =
wxRound( ReadDouble( text ) * conv_scale );
KiROUND( ReadDouble( text ) * conv_scale );
dcode->m_DrillShape = APT_DEF_RECT_HOLE;
}
@ -617,7 +622,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
{
text++;
dcode->m_Size.y =
wxRound( ReadDouble( text ) * conv_scale );
KiROUND( ReadDouble( text ) * conv_scale );
}
while( *text == ' ' )
@ -627,7 +632,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
{
text++;
dcode->m_Drill.x = dcode->m_Drill.y =
wxRound( ReadDouble( text ) * conv_scale );
KiROUND( ReadDouble( text ) * conv_scale );
dcode->m_DrillShape = APT_DEF_ROUND_HOLE;
}
@ -638,7 +643,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
{
text++;
dcode->m_Drill.y =
wxRound( ReadDouble( text ) * conv_scale );
KiROUND( ReadDouble( text ) * conv_scale );
dcode->m_DrillShape = APT_DEF_RECT_HOLE;
}
dcode->m_Defined = true;
@ -675,7 +680,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
{
text++;
dcode->m_Drill.x = dcode->m_Drill.y =
wxRound( ReadDouble( text ) * conv_scale );
KiROUND( ReadDouble( text ) * conv_scale );
dcode->m_DrillShape = APT_DEF_ROUND_HOLE;
}
@ -686,7 +691,7 @@ bool GERBER_IMAGE::ExecuteRS274XCommand( int command,
{
text++;
dcode->m_Drill.y =
wxRound( ReadDouble( text ) * conv_scale );
KiROUND( ReadDouble( text ) * conv_scale );
dcode->m_DrillShape = APT_DEF_RECT_HOLE;
}
dcode->m_Defined = true;

View File

@ -37,6 +37,19 @@
#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
* 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
*/
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_

View File

@ -158,14 +158,14 @@ public:
wxString GetFileName() const { return m_fileName; }
/**
* Function GetInternalUnits
* @return the screen units scalar.
* Function MilsToIuScalar
* returns the scalar required to convert mils to internal units.
*
* Default implementation returns scalar used for schematic screen. The
* internal units used by the schematic screen is 1 mil (0.001"). Override
* this in derived classes that require internal units other than 1 mil.
* @note This is a temporary hack until the derived objects SCH_SCREEN and PCB_SCREEN
* no longer need to be derived from BASE_SCREEN. I does allow removal of the
* obsolete GetInternalUnits function.
*/
virtual int GetInternalUnits( void );
virtual int MilsToIuScalar() { return 1; }
/**
* Function GetCrossHairPosition
@ -296,13 +296,6 @@ public:
*/
bool SetZoom( double coeff );
/**
* Function SetZoomList
* sets the list of zoom factors.
* @param aZoomList An array of zoom factors in ascending order, zero terminated
*/
void SetZoomList( const wxArrayDouble& aZoomList );
bool SetNextZoom();
bool SetPreviousZoom();
bool SetFirstZoom();

View File

@ -98,26 +98,6 @@ public:
BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
#if 0
// DICK: there is no value in having a polymorphic {Get,Set}Position(). We never
// call GetPosition() using a generic pointer, and the virtual is slower and
// can never be inlined.
/**
* Function GetPosition
* returns the position of this object.
* @return const wxPoint - The position of this object
*/
virtual const wxPoint GetPosition() const = 0;
/**
* Function SetPosition
* sets the position of this object.
* @param aPos is the new position of this object
*/
virtual void SetPosition( const wxPoint& aPos ) = 0;
#endif
/**
* Function GetLayer
* returns the layer this item is on.
@ -173,7 +153,6 @@ public:
return false; // only MODULEs can be locked at this time.
}
/**
* Function UnLink
* detaches this object from its owner. This base class implementation
@ -191,21 +170,12 @@ public:
delete this;
}
/**
* Function ShowShape
* converts the enum STROKE_T integer value to a wxString.
*/
static wxString ShowShape( STROKE_T aShape );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual bool Save( FILE* aFile ) const = 0;
// Some geometric transforms, that must be rewritten for derived classes
/**
* Function Move

View File

@ -37,7 +37,7 @@ public:
void SetPreviousZoom();
void SetLastZoom();
virtual int GetInternalUnits();
virtual int MilsToIuScalar();
/**
* Function GetCurItem
@ -57,7 +57,6 @@ public:
*/
void SetCurItem( BOARD_ITEM* aItem ) { BASE_SCREEN::SetCurItem( (EDA_ITEM*)aItem ); }
/* full undo redo management : */
// use BASE_SCREEN::ClearUndoRedoList()

View File

@ -118,11 +118,52 @@ enum pseudokeys {
#define OFF 0
//-----<KiROUND KIT>------------------------------------------------------------
/**
* KiROUND
* rounds a floating point number to an int using
* "round halfway cases away from zero".
* In Debug build an assert fires if will not fit into an int.
*/
#if defined( DEBUG )
// DEBUG: a macro to capture line and file, then calls this inline
static inline int KiRound( double v, int line, const char* filename )
{
v = v < 0 ? v - 0.5 : v + 0.5;
if( v > INT_MAX + 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' > 0 ' for int\n", __FUNCTION__, filename, line, v );
}
else if( v < INT_MIN - 0.5 )
{
printf( "%s: in file %s on line %d, val: %.16g too ' < 0 ' for int\n", __FUNCTION__, filename, line, v );
}
return int( v );
}
#define KiROUND( v ) KiRound( v, __LINE__, __FILE__ )
#else
// RELEASE: a macro so compile can pre-compute constants.
#define KiROUND( v ) int( (v) < 0 ? (v) - 0.5 : (v) + 0.5 )
#endif
//-----</KiROUND KIT>-----------------------------------------------------------
/// Convert mm to mils.
inline int Mm2mils( double x ) { return wxRound( x * 1000./25.4 ); }
inline int Mm2mils( double x ) { return KiROUND( x * 1000./25.4 ); }
/// Convert mils to mm.
inline int Mils2mm( double x ) { return wxRound( x * 25.4 / 1000. ); }
inline int Mils2mm( double x ) { return KiROUND( x * 25.4 / 1000. ); }
/// Return whether GOST is in play
@ -220,9 +261,13 @@ public:
/**
* Function GetWxOrientation.
* @return int - ws' style printing orientation.
* @return ws' style printing orientation (wxPORTRAIT or wxLANDSCAPE).
*/
#if wxCHECK_VERSION( 2, 9, 0 )
wxPrintOrientation GetWxOrientation() const { return IsPortrait() ? wxPORTRAIT : wxLANDSCAPE; }
#else
int GetWxOrientation() const { return IsPortrait() ? wxPORTRAIT : wxLANDSCAPE; }
#endif
/**
* Function GetPaperId
@ -450,6 +495,7 @@ void SetLocaleTo_C_standard();
*/
void SetLocaleTo_Default();
/**
* Class LOCALE_IO
* is a class that can be instantiated within a scope in which you are expecting
@ -460,10 +506,23 @@ void SetLocaleTo_Default();
class LOCALE_IO
{
public:
LOCALE_IO() { SetLocaleTo_C_standard(); }
~LOCALE_IO() { SetLocaleTo_Default(); }
LOCALE_IO()
{
if( C_count++ == 0 )
SetLocaleTo_C_standard();
}
~LOCALE_IO()
{
if( --C_count == 0 )
SetLocaleTo_Default();
}
private:
static int C_count; // allow for nesting of LOCALE_IO instantiations
};
/**
* Function EnsureTextCtrlWidth
* sets the minimum pixel width on a text control in order to make a text
@ -553,23 +612,8 @@ wxString ReturnUnitSymbol( EDA_UNITS_T aUnits = g_UserUnit,
wxString GetUnitsLabel( EDA_UNITS_T aUnits );
wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit = g_UserUnit );
/**
* Function ReturnValueFromeString
* @return The string from Value, according to units (inch, mm ...) for display,
* and the initial unit for value
* Unit = display units (INCH, MM ..)
* Value = text
* Internal_Unit = units per inch for computed value
*/
int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue, int Internal_Unit );
void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit = g_UserUnit );
/* 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& TextCtr, int Internal_Unit );
/**
* Round to the nearest precision.
*
@ -589,11 +633,6 @@ double RoundTo0( double x, double precision );
*/
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 );
/**
* Function GenDate
* @return A wxString object containing the date in the format "day month year" like

View File

@ -14,6 +14,7 @@
* depending on compil option
*/
#if defined(PCBNEW) || defined(CVPCB)
/// Convert mils to PCBNEW internal units (iu).
inline int Mils2iu( int mils )
{
@ -36,4 +37,11 @@ inline int DMils2iu( int dmils )
#endif
}
#elif defined(EESCHEMA)
inline int Mils2iu( int mils )
{
return mils;
}
#endif
#endif // #define CONVERT_TO_BIU_H

View File

@ -70,7 +70,6 @@ class EDA_GRAPHIC_TEXT_CTRL
{
public:
EDA_UNITS_T m_UserUnit;
int m_Internal_Unit;
wxTextCtrl* m_FrameText;
wxTextCtrl* m_FrameSize;
@ -80,8 +79,7 @@ private:
public:
EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent, const wxString& Title,
const wxString& TextToEdit, int textsize,
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer, int framelen = 200,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer, int framelen = 200 );
~EDA_GRAPHIC_TEXT_CTRL();
@ -90,7 +88,7 @@ public:
void Enable( bool state );
void SetTitle( const wxString& title );
void SetFocus() { m_FrameText->SetFocus(); }
void SetFocus() { m_FrameText->SetFocus(); }
void SetValue( const wxString& value );
void SetValue( int value );
@ -98,10 +96,9 @@ public:
* Function FormatSize
* formats a string containing the size in the desired units.
*/
static wxString FormatSize( int internalUnit, EDA_UNITS_T user_unit, int textSize );
static wxString FormatSize( EDA_UNITS_T user_unit, int textSize );
static int ParseSize( const wxString& sizeText, int internalUnit,
EDA_UNITS_T user_unit );
static int ParseSize( const wxString& sizeText, EDA_UNITS_T user_unit );
};
@ -113,7 +110,6 @@ class EDA_POSITION_CTRL
{
public:
EDA_UNITS_T m_UserUnit;
int m_Internal_Unit;
wxPoint m_Pos_To_Edit;
wxTextCtrl* m_FramePosX;
@ -123,9 +119,7 @@ private:
public:
EDA_POSITION_CTRL( wxWindow* parent, const wxString& title,
const wxPoint& pos_to_edit,
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
const wxPoint& pos_to_edit, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer );
~EDA_POSITION_CTRL();
@ -143,9 +137,7 @@ class EDA_SIZE_CTRL : public EDA_POSITION_CTRL
{
public:
EDA_SIZE_CTRL( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit,
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
const wxSize& size_to_edit, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer );
~EDA_SIZE_CTRL() { }
wxSize GetValue();
@ -162,13 +154,11 @@ public:
int m_Value;
wxTextCtrl* m_ValueCtrl;
private:
int m_Internal_Unit;
wxStaticText* m_Text;
public:
EDA_VALUE_CTRL( wxWindow* parent, const wxString& title, int value,
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer );
~EDA_VALUE_CTRL();
@ -182,72 +172,4 @@ public:
}
};
/**
* Template DIALOG_SHIM
* is a way to have a common way of handling KiCad dialog windows:
* <ul>
* <li>class specific: static s_LastPos and static s_LastSize for retentative
* dialog window positioning, per class.
* <li> invocation of SetFocus() to allow ESC key to work on Linux.
* <li> future others...
* </ul>
* by wedging in a class (a SHIM) between the wxFormbuilder coded base class and
* our derived dialog classes. Use it via the macro named DIALOG_EXTEND_WITH_SHIM
* and be sure to code your constructor to invoke *_SHIM() base class constructor,
* not the one from wxFormbuilder.
* @author Dick Hollenbeck
*/
template <class T>
class DIALOG_SHIM : public T
{
public:
DIALOG_SHIM( wxFrame* aParent ) :
T( aParent )
{
wxDialog::SetFocus();
}
// overload wxDialog::Show
bool Show( bool show )
{
bool ret;
if( show )
{
ret = wxDialog::Show( show );
if( s_LastPos.x != -1 )
wxDialog::SetSize( s_LastPos.x, s_LastPos.y, s_LastSize.x, s_LastSize.y, 0 );
}
else
{
// Save the dialog's position before hiding
s_LastPos = wxDialog::GetPosition();
s_LastSize = wxDialog::GetSize();
ret = wxDialog::Show( show );
}
return ret;
}
private:
static wxPoint s_LastPos;
static wxSize s_LastSize;
};
template<class T>
wxPoint DIALOG_SHIM<T>::s_LastPos( -1, -1 );
template<class T>
wxSize DIALOG_SHIM<T>::s_LastSize( 0, 0 );
/**
* Macro DIALOG_EXTEND_WITH_SHIM
* instantiates the template DIALOG_SHIM<> and thereby declares a shim class.
* @author Dick Hollenbeck
*/
#define DIALOG_EXTEND_WITH_SHIM( DERRIVED, BASE ) \
typedef DIALOG_SHIM<BASE> BASE##_SHIM; \
class DERRIVED : public BASE##_SHIM
#endif // DIALOG_HELPERS_H_

View File

@ -32,6 +32,7 @@ public:
}
};
class FOOTPRINT_LIST
{
public:

View File

@ -3,13 +3,8 @@
* @brief Classes and definitions used in Pcbnew.
*/
#ifndef PCBSTRUCT_H
#define PCBSTRUCT_H
// Definitions relatives aux libraries
#define FOOTPRINT_LIBRARY_HEADER "PCBNEW-LibModule-V1"
#define FOOTPRINT_LIBRARY_HEADER_CNT 18
#ifndef PCBSTRUCT_H_
#define PCBSTRUCT_H_
/// Values for m_DisplayViaMode member:
@ -83,4 +78,4 @@ public:
DISPLAY_OPTIONS();
};
#endif // PCBSTRUCT_H
#endif // PCBSTRUCT_H_

View File

@ -257,7 +257,7 @@ public:
virtual void set_current_line_width( int width )
{
// Handy override
current_pen_width = wxRound( pen_diameter );
current_pen_width = KiROUND( pen_diameter );
}
virtual void set_default_line_width( int width ) {};

View File

@ -373,20 +373,45 @@ public:
// loading footprints
/**
* Function GetModuleLibrary
* Function loadFootprintFromLibrary
* loads @a aFootprintName from @a aLibraryPath.
* If found add the module is also added to the BOARD, just for good measure.
*
* Read active libraries or one library to find and load a given module
* If found the module is linked to the tail of linked list of modules
* @param aLibraryFullFilename - the full filename of the library to read. If empty,
* all active libraries are read
* @param aModuleName = module name to load
* @param aDisplayMessageError = true to display an error message if any.
*
* @param aFootprintName is the footprint to load
*
* @param aDisplayError = true to display an error message if any.
*
* @return MODULE* - new module, or NULL
*/
MODULE* loadFootprintFromLibrary( const wxString& aLibraryPath,
const wxString& aFootprintName, bool aDisplayError );
MODULE* loadFootprintFromLibraries( const wxString& aFootprintName,
bool aDisplayError );
/**
* Function GetModuleLibrary
* scans active libraries to find and load @a aFootprintName.
* If found add the module is also added to the BOARD, just for good measure.
*
* @param aFootprintName is the footprint to load
*
* @param aDisplayError = true to display an error message if any.
*
* @return a pointer to the new module, or NULL
*
*/
MODULE* GetModuleLibrary( const wxString& aLibraryFullFilename,
const wxString& aModuleName,
bool aDisplayMessageError );
MODULE* GetModuleLibrary( const wxString& aLibraryPath, const wxString& aFootprintName,
bool aDisplayError )
{
if( !aLibraryPath )
return loadFootprintFromLibraries( aFootprintName, aDisplayError );
else
return loadFootprintFromLibrary( aLibraryPath, aFootprintName, aDisplayError );
}
/**
* Function Select_1_Module_From_List
@ -409,7 +434,8 @@ public:
/**
* Function Load_Module_From_Library
* Open a dialog to select a footprint, and load in in current board
* opens a dialog to select a footprint, and loads it into current board.
*
* @param aLibrary = the library name to use, or empty string to search
* in all loaded libraries
* @param aUseFootprintViewer = true to show the option

View File

@ -387,10 +387,6 @@ protected:
/// The area to draw on.
EDA_DRAW_PANEL* m_canvas;
/// Internal units count that is equivalent to 1 inch. Set to 1000 (0.001") for
/// schematic drawing and 10000 (0.0001") for PCB drawing.
int m_internalUnits;
/// Tool ID of previously active draw tool bar button.
int m_lastDrawToolId;
@ -477,8 +473,6 @@ public:
void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; }
int GetInternalUnits() const { return m_internalUnits; }
EDA_DRAW_PANEL* GetCanvas() { return m_canvas; }
virtual wxString GetScreenDesc();
@ -667,7 +661,7 @@ public:
*/
double GetZoom();
void TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth );
void TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth, double aScalar );
/**
* Function TraceWorkSheet is a core function for drawing of the page layout with
@ -682,13 +676,14 @@ public:
* @param aNScr The number of screens (for basic inscriptions).
* @param aScr The screen number (for basic inscriptions).
* @param aLnW The line width for drawing.
* @param aScalar Scalar to convert from mils to internal units.
* @param aClr1 The color for drawing.
* @param aClr2 The colr for inscriptions.
*/
void TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, EDA_COLOR_T aClr1 = RED,
EDA_COLOR_T aClr2 = RED );
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, double aScalar,
EDA_COLOR_T aClr1 = RED, EDA_COLOR_T aClr2 = RED );
void PlotWorkSheet( PLOTTER* aPlotter, BASE_SCREEN* aScreen );

View File

@ -7,6 +7,7 @@
#include <fctsys.h>
#include <gestfich.h>
#include <macros.h>
#include <kicad.h>
#include <tree_project_frame.h>
@ -214,8 +215,9 @@ bool TREEPROJECT_ITEM::Delete( bool check )
/*******************************************/
/* delete a file */
{
wxMessageDialog dialog( m_Parent,
_ ("Do you really want to delete ") + GetFileName(),
wxString msg;
msg.Printf( _("Do you really want to delete '%s'"), GetChars(GetFileName() ) );
wxMessageDialog dialog( m_Parent, msg,
_( "Delete File" ), wxYES_NO | wxICON_QUESTION );
if( !check || wxID_YES == dialog.ShowModal() )
@ -264,7 +266,8 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
ExecuteFile( m_Parent, EESCHEMA_EXE, FullFileName );
break;
case TREE_PCB:
case TREE_LEGACY_PCB:
case TREE_SEXP_PCB:
ExecuteFile( m_Parent, PCBNEW_EXE, FullFileName );
break;

View File

@ -2,6 +2,30 @@
* @file class_treeprojectfiles.cpp
* this is the wxTreeCtrl that shows a KiCad tree project files
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2012 Jean-Pierre Charras
* Copyright (C) 2004-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>
@ -38,7 +62,8 @@ TREEPROJECTFILES::TREEPROJECTFILES( TREE_PROJECT_FRAME* parent ) :
m_ImageList->Add( KiBitmap( kicad_icon_small_xpm ) ); // TREE_PROJECT
m_ImageList->Add( KiBitmap( eeschema_xpm ) ); // TREE_SCHEMA
m_ImageList->Add( KiBitmap( pcbnew_xpm ) ); // TREE_PCB
m_ImageList->Add( KiBitmap( pcbnew_xpm ) ); // TREE_LEGACY_PCB
m_ImageList->Add( KiBitmap( pcbnew_xpm ) ); // TREE_SFMT_PCB
m_ImageList->Add( KiBitmap( icon_gerbview_small_xpm ) ); // TREE_GERBER
m_ImageList->Add( KiBitmap( datasheet_xpm ) ); // TREE_PDF
m_ImageList->Add( KiBitmap( icon_txt_xpm ) ); // TREE_TXT

View File

@ -3,6 +3,31 @@
* @brief Frame showing fast launch buttons and messages box
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2012 Jean-Pierre Charras
* Copyright (C) 2004-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 <macros.h>

View File

@ -2,9 +2,29 @@
/* files-io.cpp */
/****************/
#ifdef __GNUG__
#pragma implementation
#endif
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2012 Jean-Pierre Charras
* Copyright (C) 2004-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 <appl_wxstruct.h>
@ -110,7 +130,8 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
{
/* List of file extensions to save. */
static const wxChar* extentionList[] = {
wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.cmp" ), wxT( "*.brd" ),
wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.cmp" ),
wxT( "*.brd" ), wxT( "*.kicad_brd" ),
wxT( "*.net" ), wxT( "*.pro" ), wxT( "*.pho" ), wxT( "*.py" ),
wxT( "*.pdf" ), wxT( "*.txt" ), wxT( "*.dcm" ),
NULL

View File

@ -157,7 +157,8 @@ public: KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
enum TreeFileType {
TREE_PROJECT = 1,
TREE_SCHEMA, // Schematic file (.sch)
TREE_PCB, // board file (.brd)
TREE_LEGACY_PCB, // board file (.brd) legacy format
TREE_SEXP_PCB, // board file (.kicad_brd) new s expression format
TREE_GERBER, // Gerber file (.pho, .g*)
TREE_PDF, // PDF file (.pdf)
TREE_TXT, // ascii text file (.txt)

View File

@ -6,7 +6,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2012 Jean-Pierre Charras
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or

View File

@ -8,6 +8,7 @@
#include <confirm.h>
#include <gestfich.h>
#include <appl_wxstruct.h>
#include <macros.h>
#include <kicad.h>
#include <tree_project_frame.h>
@ -20,6 +21,8 @@
#include <wx/imaglist.h>
#include <menus_helpers.h>
// TODO: use the wxString defined in wildcards_and_files_ext.h, when exists
const wxString PcbSexpFileExtension( wxT("kicad_brd") );
/* Note about the tree project build process:
* Building the tree project can be *very* long if there are a lot of subdirectories
@ -39,7 +42,8 @@ const wxChar* s_AllowedExtensionsToList[] =
{
wxT( "^.*\\.pro$" ),
wxT( "^.*\\.pdf$" ),
wxT( "^[^$].*\\.brd$" ), // Pcbnew files
wxT( "^[^$].*\\.brd$" ), // Legacy Pcbnew files
wxT( "^[^$].*\\.kicad_brd$" ), // S format Pcbnew files
wxT( "^.*\\.net$" ),
wxT( "^.*\\.txt$" ),
wxT( "^.*\\.pho$" ), // Gerber file (Kicad extension)
@ -89,7 +93,7 @@ BEGIN_EVENT_TABLE( TREE_PROJECT_FRAME, wxSashLayoutWindow )
EVT_TREE_BEGIN_DRAG( ID_PROJECT_TREE, TREE_PROJECT_FRAME::OnDragStart )
EVT_TREE_END_DRAG( ID_PROJECT_TREE, TREE_PROJECT_FRAME::OnDragEnd )
EVT_MENU( ID_PROJECT_TXTEDIT, TREE_PROJECT_FRAME::OnTxtEdit )
EVT_MENU( ID_PROJECT_NEWDIR, TREE_PROJECT_FRAME::OnNewDirectory )
EVT_MENU( ID_PROJECT_NEWDIR, TREE_PROJECT_FRAME::OnCreateNewDirectory )
EVT_MENU( ID_PROJECT_DELETE, TREE_PROJECT_FRAME::OnDeleteFile )
EVT_MENU( ID_PROJECT_RENAME, TREE_PROJECT_FRAME::OnRenameFile )
END_EVENT_TABLE()
@ -155,12 +159,11 @@ TREE_PROJECT_FRAME::TREE_PROJECT_FRAME( KICAD_MANAGER_FRAME* parent ) :
menu = m_ContextMenus[i];
// ID_PROJECT_RENAME
item = new wxMenuItem( menu,
ID_PROJECT_RENAME,
item = new wxMenuItem( menu, ID_PROJECT_RENAME,
TREE_DIRECTORY != i ? _( "&Rename file" ) :
_( "&Rename directory" ),
TREE_DIRECTORY != i ? _( "Rename file" ) :
_( "&Rename directory" ) );
_( "Rename directory" ) );
item->SetBitmap( KiBitmap( right_xpm ) );
menu->Append( item );
@ -182,7 +185,7 @@ TREE_PROJECT_FRAME::TREE_PROJECT_FRAME( KICAD_MANAGER_FRAME* parent ) :
TREE_DIRECTORY != i ? _( "&Delete File" ) :
_( "&Delete Directory" ),
TREE_DIRECTORY != i ? _( "Delete the File" ) :
_( "&Delete the Directory and its content" ) );
_( "Delete the Directory and its content" ) );
item->SetBitmap( KiBitmap( delete_xpm ) );
menu->Append( item );
}
@ -321,50 +324,17 @@ wxMenu* TREE_PROJECT_FRAME::GetContextMenu( int type )
/**
* @brief TODO
* Called by the popup menu in the tree frame
* Creates a new subdirectory inside the current kicad project directory
* the user is prompted to enter a directory name
*/
/*****************************************************************************/
void TREE_PROJECT_FRAME::OnNewDirectory( wxCommandEvent& event )
/*****************************************************************************/
void TREE_PROJECT_FRAME::OnCreateNewDirectory( wxCommandEvent& event )
{
NewFile( TREE_DIRECTORY );
}
/**
* @brief TODO
*/
/*****************************************************************************/
void TREE_PROJECT_FRAME::NewFile( TreeFileType type )
/*****************************************************************************/
{
wxString mask = GetFileExt( type );
wxString wildcard = GetFileWildcard( type );
// Get the directory:
wxString dir;
wxString title;
TREEPROJECT_ITEM* treeData;
title = ( TREE_DIRECTORY != type ) ? _( "Create New File" ) :
_( "Create New Directory" );
treeData = GetSelectedData();
// Get the root directory name:
TREEPROJECT_ITEM* treeData = GetSelectedData();
if( !treeData )
return;
dir = wxGetCwd() + wxFileName().GetPathSeparator() + treeData->GetDir();
// Ask for the new file name
wxString nameless_prj = NAMELESS_PROJECT;
nameless_prj += wxT(".") + mask;
wxFileDialog dlg( this, title, dir, nameless_prj,
wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
TreeFileType rootType = treeData->GetType();
wxTreeItemId root;
@ -375,34 +345,31 @@ void TREE_PROJECT_FRAME::NewFile( TreeFileType type )
else
{
root = m_TreeProject->GetItemParent( m_TreeProject->GetSelection() );
if( !root.IsOk() )
root = m_TreeProject->GetSelection();
}
NewFile( dlg.GetPath(), type, root );
}
// Ask for the new sub directory name
wxString curr_dir = treeData->GetDir();
/**
* @brief TODO
*/
/*****************************************************************************/
void TREE_PROJECT_FRAME::NewFile( const wxString& name,
TreeFileType type,
wxTreeItemId& root )
/*****************************************************************************/
{
if( TREE_DIRECTORY != type )
// Make the current subdir relative to the current path:
if( !curr_dir.IsEmpty() ) // A subdir is selected
{
wxFile( name, wxFile::write );
}
else
{
wxMkdir( name );
curr_dir += wxFileName::GetPathSeparator();
curr_dir += wxT("dummy");
wxFileName fn(curr_dir);
fn.MakeRelativeTo();
curr_dir = fn.GetPath() + wxFileName::GetPathSeparator();
}
wxString msg;
msg.Printf( wxT("Current working directory:\n%s"), GetChars( wxGetCwd() ) );
wxString subdir = wxGetTextFromUser( msg, _( "Create New Directory" ), curr_dir );
AddFile( name, root );
if( subdir.IsEmpty() )
return;
if( wxMkdir( subdir ) )
AddFileToTree( subdir, root );
}
@ -425,10 +392,14 @@ wxString TREE_PROJECT_FRAME::GetFileExt( TreeFileType type )
ext = SchematicFileExtension;
break;
case TREE_PCB:
case TREE_LEGACY_PCB:
ext = PcbFileExtension;
break;
case TREE_SEXP_PCB:
ext = PcbSexpFileExtension;
break;
case TREE_GERBER:
ext = GerberFileExtension;
break;
@ -485,7 +456,8 @@ wxString TREE_PROJECT_FRAME::GetFileWildcard( TreeFileType type )
ext = SchematicFileWildcard;
break;
case TREE_PCB:
case TREE_LEGACY_PCB:
case TREE_SEXP_PCB:
ext = PcbFileWildcard;
break;
@ -530,7 +502,7 @@ wxString TREE_PROJECT_FRAME::GetFileWildcard( TreeFileType type )
/**
* Function AddFile
* Function AddFileToTree
* @brief Add filename "name" to the tree \n
* if name is a directory, add the sub directory file names
* @param aName = the filename or the dirctory name to add
@ -539,7 +511,7 @@ wxString TREE_PROJECT_FRAME::GetFileWildcard( TreeFileType type )
* false to stop file add.
* @return true if the file (or directory) is added.
*/
bool TREE_PROJECT_FRAME::AddFile( const wxString& aName,
bool TREE_PROJECT_FRAME::AddFileToTree( const wxString& aName,
wxTreeItemId& aRoot, bool aRecurse )
{
wxTreeItemId cellule;
@ -681,7 +653,7 @@ bool TREE_PROJECT_FRAME::AddFile( const wxString& aName,
{
do // Add name in tree, but do not recurse
{
AddFile( aName + sep + dir_filename, cellule, false );
AddFileToTree( aName + sep + dir_filename, cellule, false );
} while( dir.GetNext( &dir_filename ) );
}
@ -743,7 +715,7 @@ void TREE_PROJECT_FRAME::ReCreateTreePrj()
while( cont )
{
if( filename != fn.GetFullName() )
AddFile( dir.GetName() + wxFileName::GetPathSeparator() +
AddFileToTree( dir.GetName() + wxFileName::GetPathSeparator() +
filename, m_root );
cont = dir.GetNext( &filename );
@ -980,7 +952,7 @@ void TREE_PROJECT_FRAME::OnExpand( wxTreeEvent& Event )
{
do // Add name to tree item, but do not recurse in subdirs:
{
AddFile( fileName + sep + dir_filename, kid, false );
AddFileToTree( fileName + sep + dir_filename, kid, false );
} while( dir.GetNext( &dir_filename ) );
}
itemData->m_WasPopulated = true; // set state to populated

Some files were not shown because too many files have changed in this diff Show More