Commit e8362df1 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Add missing source file licenses and code policy fixes.

parent fa9f2f04
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/************************************/ /************************************/
/* routines to handle bezier curves */ /* routines to handle bezier curves */
/************************************/ /************************************/
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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 <bin_mod.h> #include <bin_mod.h>
#include <online_help.h> #include <online_help.h>
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/* Date for KiCad build version */ /* Date for KiCad build version */
#include <fctsys.h> #include <fctsys.h>
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/** /**
* @file class_colors_design_settings.cpp * @file class_colors_design_settings.cpp
* @brief Handle colors used to draw all items or layers. * @brief Handle colors used to draw all items or layers.
...@@ -83,11 +107,6 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS() ...@@ -83,11 +107,6 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
} }
/**
* Function GetLayerColor
* @return the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
{ {
if( (unsigned) aLayer < DIM(m_LayersColors) ) if( (unsigned) aLayer < DIM(m_LayersColors) )
...@@ -98,11 +117,6 @@ EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const ...@@ -98,11 +117,6 @@ EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
} }
/**
* Function SetLayerColor
* sets the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ) void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
{ {
if( (unsigned) aLayer < DIM(m_LayersColors) ) if( (unsigned) aLayer < DIM(m_LayersColors) )
...@@ -112,11 +126,6 @@ void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ...@@ -112,11 +126,6 @@ void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor
} }
/**
* Function GetItemColor
* @return the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
{ {
if( (unsigned) aItemIdx < DIM( m_ItemsColors ) ) if( (unsigned) aItemIdx < DIM( m_ItemsColors ) )
...@@ -128,11 +137,6 @@ EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const ...@@ -128,11 +137,6 @@ EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
} }
/**
* Function SetItemColor
* sets the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, EDA_COLOR_T aColor ) void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, EDA_COLOR_T aColor )
{ {
if( (unsigned) aItemIdx < DIM(m_ItemsColors) ) if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
...@@ -142,11 +146,6 @@ void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, EDA_COLOR_T aColor ) ...@@ -142,11 +146,6 @@ void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, EDA_COLOR_T aColor )
} }
/**
* Function SetAllColorsAs
* sets alls colors to aColor
* Usefull to create a monochrome color selection for printing purpose
*/
void COLORS_DESIGN_SETTINGS::SetAllColorsAs( EDA_COLOR_T aColor ) void COLORS_DESIGN_SETTINGS::SetAllColorsAs( EDA_COLOR_T aColor )
{ {
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ ) for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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 <common.h> #include <common.h>
#include <colors_selection.h> #include <colors_selection.h>
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/** /**
* @file class_marker_base.cpp * @file class_marker_base.cpp
* @brief Implementation of MARKER_BASE class. * @brief Implementation of MARKER_BASE class.
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/** /**
* @file class_plotter.cpp * @file class_plotter.cpp
* @brief KiCad: Base of all the plot routines * @brief KiCad: Base of all the plot routines
...@@ -48,13 +72,7 @@ PLOTTER::~PLOTTER() ...@@ -48,13 +72,7 @@ PLOTTER::~PLOTTER()
} }
} }
/*
* Open or create the plot file aFullFilename
* return true if success, false if the file connot be created/opened
*
* Virtual because some plotters use ascii files, some others binary files (PDF)
* The base class open the file in text mode
*/
bool PLOTTER::OpenFile( const wxString& aFullFilename ) bool PLOTTER::OpenFile( const wxString& aFullFilename )
{ {
filename = aFullFilename; filename = aFullFilename;
...@@ -71,11 +89,7 @@ bool PLOTTER::OpenFile( const wxString& aFullFilename ) ...@@ -71,11 +89,7 @@ bool PLOTTER::OpenFile( const wxString& aFullFilename )
return true; return true;
} }
/**
* Modifies coordinates according to the orientation,
* scale factor, and offsets trace. Also convert from a wxPoint to DPOINT,
* since some output engines needs floating point coordinates.
*/
DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate ) DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate )
{ {
wxPoint pos = aCoordinate - plotOffset; wxPoint pos = aCoordinate - plotOffset;
...@@ -100,29 +114,20 @@ DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate ) ...@@ -100,29 +114,20 @@ DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate )
return DPOINT( x, y ); return DPOINT( x, y );
} }
/**
* Modifies size according to the plotter scale factors
* (wxSize version, returns a DPOINT)
*/
DPOINT PLOTTER::userToDeviceSize( const wxSize& size ) DPOINT PLOTTER::userToDeviceSize( const wxSize& size )
{ {
return DPOINT( size.x * plotScale * iuPerDeviceUnit, return DPOINT( size.x * plotScale * iuPerDeviceUnit,
size.y * plotScale * iuPerDeviceUnit ); size.y * plotScale * iuPerDeviceUnit );
} }
/**
* Modifies size according to the plotter scale factors
* (simple double version)
*/
double PLOTTER::userToDeviceSize( double size ) double PLOTTER::userToDeviceSize( double size )
{ {
return size * plotScale * iuPerDeviceUnit; return size * plotScale * iuPerDeviceUnit;
} }
/**
* Generic fallback: arc rendered as a polyline
*/
void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width ) FILL_T fill, int width )
{ {
...@@ -149,11 +154,8 @@ void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int r ...@@ -149,11 +154,8 @@ void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int r
FinishTo( end ); FinishTo( end );
} }
/**
* Fallback: if it doesn't handle bitmaps, we plot a rectangle void PLOTTER::PlotImage(const wxImage & aImage, const wxPoint& aPos, double aScaleFactor )
*/
void PLOTTER::PlotImage(const wxImage & aImage, const wxPoint& aPos,
double aScaleFactor )
{ {
wxSize size( aImage.GetWidth() * aScaleFactor, wxSize size( aImage.GetWidth() * aScaleFactor,
aImage.GetHeight() * aScaleFactor ); aImage.GetHeight() * aScaleFactor );
...@@ -170,9 +172,6 @@ void PLOTTER::PlotImage(const wxImage & aImage, const wxPoint& aPos, ...@@ -170,9 +172,6 @@ void PLOTTER::PlotImage(const wxImage & aImage, const wxPoint& aPos,
} }
/**
* Plot a square centered on the position. Building block for markers
*/
void PLOTTER::markerSquare( const wxPoint& position, int radius ) void PLOTTER::markerSquare( const wxPoint& position, int radius )
{ {
double r = KiROUND( radius / 1.4142 ); double r = KiROUND( radius / 1.4142 );
...@@ -197,17 +196,13 @@ void PLOTTER::markerSquare( const wxPoint& position, int radius ) ...@@ -197,17 +196,13 @@ void PLOTTER::markerSquare( const wxPoint& position, int radius )
PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() ); PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() );
} }
/**
* Plot a circle centered on the position. Building block for markers
*/
void PLOTTER::markerCircle( const wxPoint& position, int radius ) void PLOTTER::markerCircle( const wxPoint& position, int radius )
{ {
Circle( position, radius * 2, NO_FILL, GetCurrentLineWidth() ); Circle( position, radius * 2, NO_FILL, GetCurrentLineWidth() );
} }
/**
* Plot a lozenge centered on the position. Building block for markers
*/
void PLOTTER::markerLozenge( const wxPoint& position, int radius ) void PLOTTER::markerLozenge( const wxPoint& position, int radius )
{ {
std::vector< wxPoint > corner_list; std::vector< wxPoint > corner_list;
...@@ -231,48 +226,35 @@ void PLOTTER::markerLozenge( const wxPoint& position, int radius ) ...@@ -231,48 +226,35 @@ void PLOTTER::markerLozenge( const wxPoint& position, int radius )
PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() ); PlotPoly( corner_list, NO_FILL, GetCurrentLineWidth() );
} }
/**
* Plot a - bar centered on the position. Building block for markers
*/
void PLOTTER::markerHBar( const wxPoint& pos, int radius ) void PLOTTER::markerHBar( const wxPoint& pos, int radius )
{ {
MoveTo( wxPoint( pos.x - radius, pos.y ) ); MoveTo( wxPoint( pos.x - radius, pos.y ) );
FinishTo( wxPoint( pos.x + radius, pos.y ) ); FinishTo( wxPoint( pos.x + radius, pos.y ) );
} }
/**
* Plot a / bar centered on the position. Building block for markers
*/
void PLOTTER::markerSlash( const wxPoint& pos, int radius ) void PLOTTER::markerSlash( const wxPoint& pos, int radius )
{ {
MoveTo( wxPoint( pos.x - radius, pos.y - radius ) ); MoveTo( wxPoint( pos.x - radius, pos.y - radius ) );
FinishTo( wxPoint( pos.x + radius, pos.y + radius ) ); FinishTo( wxPoint( pos.x + radius, pos.y + radius ) );
} }
/**
* Plot a \ bar centered on the position. Building block for markers
*/
void PLOTTER::markerBackSlash( const wxPoint& pos, int radius ) void PLOTTER::markerBackSlash( const wxPoint& pos, int radius )
{ {
MoveTo( wxPoint( pos.x + radius, pos.y - radius ) ); MoveTo( wxPoint( pos.x + radius, pos.y - radius ) );
FinishTo( wxPoint( pos.x - radius, pos.y + radius ) ); FinishTo( wxPoint( pos.x - radius, pos.y + radius ) );
} }
/**
* Plot a | bar centered on the position. Building block for markers
*/
void PLOTTER::markerVBar( const wxPoint& pos, int radius ) void PLOTTER::markerVBar( const wxPoint& pos, int radius )
{ {
MoveTo( wxPoint( pos.x, pos.y - radius ) ); MoveTo( wxPoint( pos.x, pos.y - radius ) );
FinishTo( wxPoint( pos.x, pos.y + radius ) ); FinishTo( wxPoint( pos.x, pos.y + radius ) );
} }
/**
* Draw a pattern shape number aShapeId, to coord x0, y0.
* x0, y0 = coordinates tables
* Diameter diameter = (coord table) hole
* AShapeId = index (used to generate forms characters)
*/
void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId ) void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
{ {
int radius = diametre / 2; int radius = diametre / 2;
...@@ -379,9 +361,6 @@ void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId ) ...@@ -379,9 +361,6 @@ void PLOTTER::Marker( const wxPoint& position, int diametre, unsigned aShapeId )
} }
/**
* Convert a thick segment and plot it as an oval
*/
void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width, void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode ) EDA_DRAW_MODE_T tracemode )
{ {
...@@ -403,8 +382,7 @@ void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width ...@@ -403,8 +382,7 @@ void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width
} }
void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient, void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient, int width )
int width )
{ {
SetCurrentLineWidth( width ); SetCurrentLineWidth( width );
width = currentPenWidth; width = currentPenWidth;
...@@ -452,8 +430,6 @@ void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient ...@@ -452,8 +430,6 @@ void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient
} }
/* Plot 1 segment like a track segment
*/
void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width, void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode ) EDA_DRAW_MODE_T tracemode )
{ {
...@@ -529,8 +505,7 @@ void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width, ...@@ -529,8 +505,7 @@ void PLOTTER::ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
} }
void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width, void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width, EDA_DRAW_MODE_T tracemode )
EDA_DRAW_MODE_T tracemode )
{ {
switch( tracemode ) switch( tracemode )
{ {
...@@ -556,4 +531,3 @@ void PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings ) ...@@ -556,4 +531,3 @@ void PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
wxASSERT( !outputFile ); wxASSERT( !outputFile );
pageInfo = aPageSettings; pageInfo = aPageSettings;
} }
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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 <colors.h> #include <colors.h>
...@@ -97,6 +120,7 @@ EDA_COLOR_T ColorFindNearest( int aR, int aG, int aB ) ...@@ -97,6 +120,7 @@ EDA_COLOR_T ColorFindNearest( int aR, int aG, int aB )
int distance = (aR - c.m_Red) * (aR - c.m_Red) + int distance = (aR - c.m_Red) * (aR - c.m_Red) +
(aG - c.m_Green) * (aG - c.m_Green) + (aG - c.m_Green) * (aG - c.m_Green) +
(aB - c.m_Blue) * (aB - c.m_Blue); (aB - c.m_Blue) * (aB - c.m_Blue);
if( distance < nearest_distance && c.m_Red >= aR && if( distance < nearest_distance && c.m_Red >= aR &&
c.m_Green >= aG && c.m_Blue >= aB ) c.m_Green >= aG && c.m_Blue >= aB )
{ {
...@@ -130,6 +154,7 @@ EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 ) ...@@ -130,6 +154,7 @@ EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 )
* BLACK means not computed yet. If we're lucky we already have * BLACK means not computed yet. If we're lucky we already have
* an answer */ * an answer */
EDA_COLOR_T candidate = mix_cache[aColor1][aColor2]; EDA_COLOR_T candidate = mix_cache[aColor1][aColor2];
if( candidate != BLACK ) if( candidate != BLACK )
return candidate; return candidate;
...@@ -146,7 +171,7 @@ EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 ) ...@@ -146,7 +171,7 @@ EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 )
/* Here, BLACK is *not* a good answer, since it would recompute the next time. /* Here, BLACK is *not* a good answer, since it would recompute the next time.
* Even theorically its not possible (with the current rules), but * Even theorically its not possible (with the current rules), but
* maybe the metric will change in the future */ * maybe the metric will change in the future */
if( candidate == BLACK) if( candidate == BLACK )
candidate = DARKDARKGRAY; candidate = DARKDARKGRAY;
// Store the result in the cache. The operation is commutative, too // Store the result in the cache. The operation is commutative, too
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/** /**
* @file common_plotGERBER_functions.cpp * @file common_plotGERBER_functions.cpp
* @brief Common GERBER plot routines. * @brief Common GERBER plot routines.
...@@ -15,6 +39,7 @@ ...@@ -15,6 +39,7 @@
#include <build_version.h> #include <build_version.h>
GERBER_PLOTTER::GERBER_PLOTTER() GERBER_PLOTTER::GERBER_PLOTTER()
{ {
workFile = 0; workFile = 0;
...@@ -32,6 +57,7 @@ GERBER_PLOTTER::GERBER_PLOTTER() ...@@ -32,6 +57,7 @@ GERBER_PLOTTER::GERBER_PLOTTER()
m_gerberUnitFmt = 6; m_gerberUnitFmt = 6;
} }
void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) double aScale, bool aMirror )
{ {
...@@ -54,6 +80,7 @@ void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, ...@@ -54,6 +80,7 @@ void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
SetDefaultLineWidth( 100 * aIusPerDecimil ); // Arbitrary default SetDefaultLineWidth( 100 * aIusPerDecimil ); // Arbitrary default
} }
void GERBER_PLOTTER::SetGerberCoordinatesFormat( int aResolution, bool aUseInches ) void GERBER_PLOTTER::SetGerberCoordinatesFormat( int aResolution, bool aUseInches )
{ {
m_gerberUnitInch = aUseInches; m_gerberUnitInch = aUseInches;
...@@ -66,11 +93,6 @@ void GERBER_PLOTTER::SetGerberCoordinatesFormat( int aResolution, bool aUseInche ...@@ -66,11 +93,6 @@ void GERBER_PLOTTER::SetGerberCoordinatesFormat( int aResolution, bool aUseInche
} }
/**
* Emit a D-Code record, using proper conversions
* to format a leading zero omitted gerber coordinate
* (for n decimal positions, see header generation in start_plot
*/
void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode ) void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode )
{ {
...@@ -78,11 +100,7 @@ void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode ) ...@@ -78,11 +100,7 @@ void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode )
KiROUND( pt.x ), KiROUND( pt.y ), dcode ); KiROUND( pt.x ), KiROUND( pt.y ), dcode );
} }
/**
* Function start_plot
* Write GERBER header to file
* initialize global variable g_Plot_PlotOutputFile
*/
bool GERBER_PLOTTER::StartPlot() bool GERBER_PLOTTER::StartPlot()
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
...@@ -241,9 +259,6 @@ void GERBER_PLOTTER::selectAperture( const wxSize& size, ...@@ -241,9 +259,6 @@ void GERBER_PLOTTER::selectAperture( const wxSize& size,
} }
/**
* Generate the table of D codes
*/
void GERBER_PLOTTER::writeApertureList() void GERBER_PLOTTER::writeApertureList()
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
...@@ -308,19 +323,18 @@ void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume ) ...@@ -308,19 +323,18 @@ void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume )
break; break;
case 'U': case 'U':
emitDcode( pos_dev, 2 ); emitDcode( pos_dev, 2 );
break; break;
case 'D': case 'D':
emitDcode( pos_dev, 1 ); emitDcode( pos_dev, 1 );
} }
penState = plume; penState = plume;
} }
void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
int width )
{ {
std::vector< wxPoint > cornerList; std::vector< wxPoint > cornerList;
...@@ -338,8 +352,7 @@ void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, ...@@ -338,8 +352,7 @@ void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
} }
void GERBER_PLOTTER::Circle( const wxPoint& aCenter, int aDiameter, FILL_T aFill, void GERBER_PLOTTER::Circle( const wxPoint& aCenter, int aDiameter, FILL_T aFill, int aWidth )
int aWidth )
{ {
Arc( aCenter, 0, 3600, aDiameter / 2, aFill, aWidth ); Arc( aCenter, 0, 3600, aDiameter / 2, aFill, aWidth );
} }
...@@ -357,8 +370,7 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAn ...@@ -357,8 +370,7 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAn
end.x = aCenter.x + KiROUND( cosdecideg( aRadius, aEndAngle ) ); end.x = aCenter.x + KiROUND( cosdecideg( aRadius, aEndAngle ) );
end.y = aCenter.y - KiROUND( sindecideg( aRadius, aEndAngle ) ); end.y = aCenter.y - KiROUND( sindecideg( aRadius, aEndAngle ) );
DPOINT devEnd = userToDeviceCoordinates( end ); DPOINT devEnd = userToDeviceCoordinates( end );
DPOINT devCenter = userToDeviceCoordinates( aCenter ) DPOINT devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
- userToDeviceCoordinates( start );
fprintf( outputFile, "G75*\n" ); // Multiquadrant mode fprintf( outputFile, "G75*\n" ); // Multiquadrant mode
...@@ -374,10 +386,6 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAn ...@@ -374,10 +386,6 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAn
} }
/**
* Gerber polygon: they can (and *should*) be filled with the
* appropriate G36/G37 sequence
*/
void GERBER_PLOTTER:: PlotPoly( const std::vector< wxPoint >& aCornerList, void GERBER_PLOTTER:: PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth ) FILL_T aFill, int aWidth )
{ {
...@@ -419,11 +427,8 @@ void GERBER_PLOTTER:: PlotPoly( const std::vector< wxPoint >& aCornerList, ...@@ -419,11 +427,8 @@ void GERBER_PLOTTER:: PlotPoly( const std::vector< wxPoint >& aCornerList,
} }
} }
/**
* Filled circular flashes are stored as apertures void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_MODE_T trace_mode )
*/
void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
wxSize size( diametre, diametre ); wxSize size( diametre, diametre );
...@@ -437,17 +442,14 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, ...@@ -437,17 +442,14 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
break; break;
case FILLED: case FILLED:
DPOINT pos_dev = userToDeviceCoordinates( pos ); DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Circle ); selectAperture( size, APERTURE::Circle );
emitDcode( pos_dev, 3 ); emitDcode( pos_dev, 3 );
break; break;
} }
} }
/**
* Filled oval flashes are handled as aperture in the 90 degree positions only
*/
void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient, void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
EDA_DRAW_MODE_T trace_mode ) EDA_DRAW_MODE_T trace_mode )
{ {
...@@ -462,9 +464,9 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub ...@@ -462,9 +464,9 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub
if( orient == 900 || orient == 2700 ) /* orientation turned 90 deg. */ if( orient == 900 || orient == 2700 ) /* orientation turned 90 deg. */
EXCHG( size.x, size.y ); EXCHG( size.x, size.y );
DPOINT pos_dev = userToDeviceCoordinates( pos ); DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Oval ); selectAperture( size, APERTURE::Oval );
emitDcode( pos_dev, 3 ); emitDcode( pos_dev, 3 );
} }
else /* Plot pad as a segment. */ else /* Plot pad as a segment. */
{ {
...@@ -501,9 +503,6 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub ...@@ -501,9 +503,6 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub
} }
/**
* Filled rect flashes are handled as aperture in the 90 degree positions only
*/
void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize, void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
double orient, EDA_DRAW_MODE_T trace_mode ) double orient, EDA_DRAW_MODE_T trace_mode )
...@@ -516,30 +515,30 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize, ...@@ -516,30 +515,30 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
{ {
case 900: case 900:
case 2700: // rotation of 90 degrees or 270 swaps sizes case 2700: // rotation of 90 degrees or 270 swaps sizes
EXCHG( size.x, size.y ); EXCHG( size.x, size.y );
// Pass through // Pass through
case 0: case 0:
case 1800: case 1800:
switch( trace_mode ) switch( trace_mode )
{ {
case LINE: case LINE:
case SKETCH: case SKETCH:
SetCurrentLineWidth( -1 ); SetCurrentLineWidth( -1 );
Rect( wxPoint( pos.x - (size.x - currentPenWidth) / 2, Rect( wxPoint( pos.x - (size.x - currentPenWidth) / 2,
pos.y - (size.y - currentPenWidth) / 2 ), pos.y - (size.y - currentPenWidth) / 2 ),
wxPoint( pos.x + (size.x - currentPenWidth) / 2, wxPoint( pos.x + (size.x - currentPenWidth) / 2,
pos.y + (size.y - currentPenWidth) / 2 ), pos.y + (size.y - currentPenWidth) / 2 ),
NO_FILL ); NO_FILL );
break; break;
case FILLED: case FILLED:
DPOINT pos_dev = userToDeviceCoordinates( pos ); DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Rect ); selectAperture( size, APERTURE::Rect );
emitDcode( pos_dev, 3 ); emitDcode( pos_dev, 3 );
break; break;
} }
break; break;
default: // plot pad shape as polygon default: // plot pad shape as polygon
{ {
...@@ -567,10 +566,6 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize, ...@@ -567,10 +566,6 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
} }
/**
* Trapezoidal pad at the moment are *never* handled as aperture, since
* they require aperture macros
*/
void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorners, void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorners,
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
...@@ -596,10 +591,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo ...@@ -596,10 +591,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
PlotPoly( cornerList, aTrace_Mode==FILLED ? FILLED_SHAPE : NO_FILL ); PlotPoly( cornerList, aTrace_Mode==FILLED ? FILLED_SHAPE : NO_FILL );
} }
/**
* Change the plot polarity and begin a new layer
* Used to 'scratch off' silk screen away from solder mask
*/
void GERBER_PLOTTER::SetLayerPolarity( bool aPositive ) void GERBER_PLOTTER::SetLayerPolarity( bool aPositive )
{ {
if( aPositive ) if( aPositive )
...@@ -607,4 +599,3 @@ void GERBER_PLOTTER::SetLayerPolarity( bool aPositive ) ...@@ -607,4 +599,3 @@ void GERBER_PLOTTER::SetLayerPolarity( bool aPositive )
else else
fprintf( outputFile, "%%LPC*%%\n" ); fprintf( outputFile, "%%LPC*%%\n" );
} }
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/** /**
* @file common_plotHPGL_functions.cpp * @file common_plotHPGL_functions.cpp
* @brief KiCad: Common plot HPGL Routines * @brief KiCad: Common plot HPGL Routines
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/** /**
* @file common_plotPS_functions.cpp * @file common_plotPS_functions.cpp
* @brief Kicad: Common plot Postscript Routines * @brief Kicad: Common plot Postscript Routines
...@@ -211,28 +235,30 @@ void PSLIKE_PLOTTER::fputsPostscriptString(FILE *fout, const wxString& txt) ...@@ -211,28 +235,30 @@ void PSLIKE_PLOTTER::fputsPostscriptString(FILE *fout, const wxString& txt)
putc( '(', fout ); putc( '(', fout );
for( unsigned i = 0; i < txt.length(); i++ ) for( unsigned i = 0; i < txt.length(); i++ )
{ {
// Lazyness made me use stdio buffering yet another time... // Lazyness made me use stdio buffering yet another time...
wchar_t ch = txt[i]; wchar_t ch = txt[i];
if( ch < 256 )
{ if( ch < 256 )
switch (ch)
{ {
// The ~ shouldn't reach the outside switch (ch)
case '~': {
break; // The ~ shouldn't reach the outside
// These characters must be escaped case '~':
case '(': break;
case ')': // These characters must be escaped
case '\\': case '(':
putc( '\\', fout ); case ')':
case '\\':
// FALLTHRU putc( '\\', fout );
default:
putc( ch, fout ); // FALLTHRU
break; default:
putc( ch, fout );
break;
}
} }
} }
}
putc( ')', fout ); putc( ')', fout );
} }
...@@ -354,31 +380,31 @@ void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos, ...@@ -354,31 +380,31 @@ void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
switch( aH_justify ) switch( aH_justify )
{ {
case GR_TEXT_HJUSTIFY_CENTER: case GR_TEXT_HJUSTIFY_CENTER:
dx = -tw / 2; dx = -tw / 2;
break; break;
case GR_TEXT_HJUSTIFY_RIGHT: case GR_TEXT_HJUSTIFY_RIGHT:
dx = -tw; dx = -tw;
break; break;
case GR_TEXT_HJUSTIFY_LEFT: case GR_TEXT_HJUSTIFY_LEFT:
dx = 0; dx = 0;
break; break;
} }
switch( aV_justify ) switch( aV_justify )
{ {
case GR_TEXT_VJUSTIFY_CENTER: case GR_TEXT_VJUSTIFY_CENTER:
dy = th / 2; dy = th / 2;
break; break;
case GR_TEXT_VJUSTIFY_TOP: case GR_TEXT_VJUSTIFY_TOP:
dy = th; dy = th;
break; break;
case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM:
dy = 0; dy = 0;
break; break;
} }
RotatePoint( &dx, &dy, aOrient ); RotatePoint( &dx, &dy, aOrient );
...@@ -421,12 +447,12 @@ void PS_PLOTTER::SetCurrentLineWidth( int width ) ...@@ -421,12 +447,12 @@ void PS_PLOTTER::SetCurrentLineWidth( int width )
pen_width = defaultPenWidth; pen_width = defaultPenWidth;
if( pen_width != currentPenWidth ) if( pen_width != currentPenWidth )
fprintf( outputFile, "%g setlinewidth\n", fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( pen_width ) );
userToDeviceSize( pen_width ) );
currentPenWidth = pen_width; currentPenWidth = pen_width;
} }
void PS_PLOTTER::emitSetRGBColor( double r, double g, double b ) void PS_PLOTTER::emitSetRGBColor( double r, double g, double b )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
...@@ -560,7 +586,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos, ...@@ -560,7 +586,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
// Map image size to device // Map image size to device
DPOINT end_dev = userToDeviceCoordinates( end ); DPOINT end_dev = userToDeviceCoordinates( end );
fprintf( outputFile, "%g %g scale\n", fprintf( outputFile, "%g %g scale\n",
std::abs(end_dev.x - start_dev.x), std::abs(end_dev.y - start_dev.y)); std::abs(end_dev.x - start_dev.x), std::abs(end_dev.y - start_dev.y));
// Dimensions of source image (in pixels // Dimensions of source image (in pixels
fprintf( outputFile, "%d %d 8", pix_size.x, pix_size.y ); fprintf( outputFile, "%d %d 8", pix_size.x, pix_size.y );
...@@ -568,6 +594,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos, ...@@ -568,6 +594,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
fprintf( outputFile, " [%d 0 0 %d 0 %d]\n", pix_size.x, -pix_size.y , pix_size.y); fprintf( outputFile, " [%d 0 0 %d 0 %d]\n", pix_size.x, -pix_size.y , pix_size.y);
// include image data in ps file // include image data in ps file
fprintf( outputFile, "{currentfile pix readhexstring pop}\n" ); fprintf( outputFile, "{currentfile pix readhexstring pop}\n" );
if( colorMode ) if( colorMode )
fputs( "false 3 colorimage\n", outputFile ); fputs( "false 3 colorimage\n", outputFile );
else else
...@@ -575,6 +602,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos, ...@@ -575,6 +602,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
// Single data source, 3 colors, Output RGB data (hexadecimal) // Single data source, 3 colors, Output RGB data (hexadecimal)
// (or the same downscaled to gray) // (or the same downscaled to gray)
int jj = 0; int jj = 0;
for( int yy = 0; yy < pix_size.y; yy ++ ) for( int yy = 0; yy < pix_size.y; yy ++ )
{ {
for( int xx = 0; xx < pix_size.x; xx++, jj++ ) for( int xx = 0; xx < pix_size.x; xx++, jj++ )
...@@ -584,16 +612,19 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos, ...@@ -584,16 +612,19 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
jj = 0; jj = 0;
fprintf( outputFile, "\n"); fprintf( outputFile, "\n");
} }
int red, green, blue; int red, green, blue;
red = aImage.GetRed( xx, yy) & 0xFF; red = aImage.GetRed( xx, yy) & 0xFF;
green = aImage.GetGreen( xx, yy) & 0xFF; green = aImage.GetGreen( xx, yy) & 0xFF;
blue = aImage.GetBlue( xx, yy) & 0xFF; blue = aImage.GetBlue( xx, yy) & 0xFF;
if( colorMode ) if( colorMode )
fprintf( outputFile, "%2.2X%2.2X%2.2X", red, green, blue ); fprintf( outputFile, "%2.2X%2.2X%2.2X", red, green, blue );
else else
fprintf( outputFile, "%2.2X", (red + green + blue) / 3 ); fprintf( outputFile, "%2.2X", (red + green + blue) / 3 );
} }
} }
fprintf( outputFile, "\n"); fprintf( outputFile, "\n");
fprintf( outputFile, "origstate restore\n" ); fprintf( outputFile, "origstate restore\n" );
} }
...@@ -602,6 +633,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos, ...@@ -602,6 +633,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
void PS_PLOTTER::PenTo( const wxPoint& pos, char plume ) void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
if( plume == 'Z' ) if( plume == 'Z' )
{ {
if( penState != 'Z' ) if( penState != 'Z' )
...@@ -611,6 +643,7 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume ) ...@@ -611,6 +643,7 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
penLastpos.x = -1; penLastpos.x = -1;
penLastpos.y = -1; penLastpos.y = -1;
} }
return; return;
} }
...@@ -618,13 +651,15 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume ) ...@@ -618,13 +651,15 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
{ {
fputs( "newpath\n", outputFile ); fputs( "newpath\n", outputFile );
} }
if( penState != plume || pos != penLastpos ) if( penState != plume || pos != penLastpos )
{ {
DPOINT pos_dev = userToDeviceCoordinates( pos ); DPOINT pos_dev = userToDeviceCoordinates( pos );
fprintf( outputFile, "%g %g %sto\n", fprintf( outputFile, "%g %g %sto\n",
pos_dev.x, pos_dev.y, pos_dev.x, pos_dev.y,
( plume=='D' ) ? "line" : "move" ); ( plume=='D' ) ? "line" : "move" );
} }
penState = plume; penState = plume;
penLastpos = pos; penLastpos = pos;
} }
...@@ -790,8 +825,7 @@ bool PS_PLOTTER::StartPlot() ...@@ -790,8 +825,7 @@ bool PS_PLOTTER::StartPlot()
plotScaleAdjX, plotScaleAdjY ); plotScaleAdjX, plotScaleAdjY );
// Set default line width // Set default line width
fprintf( outputFile, "%g setlinewidth\n", fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( defaultPenWidth ) );
userToDeviceSize( defaultPenWidth ) );
fputs( "%%EndPageSetup\n", outputFile ); fputs( "%%EndPageSetup\n", outputFile );
return true; return true;
...@@ -803,7 +837,7 @@ bool PS_PLOTTER::EndPlot() ...@@ -803,7 +837,7 @@ bool PS_PLOTTER::EndPlot()
wxASSERT( outputFile ); wxASSERT( outputFile );
fputs( "showpage\n" fputs( "showpage\n"
"grestore\n" "grestore\n"
"%%EOF\n", outputFile ); "%%EOF\n", outputFile );
fclose( outputFile ); fclose( outputFile );
outputFile = NULL; outputFile = NULL;
...@@ -863,12 +897,13 @@ void PS_PLOTTER::Text( const wxPoint& aPos, ...@@ -863,12 +897,13 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
std::vector<int> pos_pairs; std::vector<int> pos_pairs;
postscriptOverlinePositions( aText, aSize.x, aItalic, aBold, &pos_pairs ); postscriptOverlinePositions( aText, aSize.x, aItalic, aBold, &pos_pairs );
int overbar_y = KiROUND( aSize.y * 1.1 ); int overbar_y = KiROUND( aSize.y * 1.1 );
for( unsigned i = 0; i < pos_pairs.size(); i += 2) for( unsigned i = 0; i < pos_pairs.size(); i += 2)
{ {
DPOINT dev_from = userToDeviceSize( wxSize( pos_pairs[i], overbar_y ) ); DPOINT dev_from = userToDeviceSize( wxSize( pos_pairs[i], overbar_y ) );
DPOINT dev_to = userToDeviceSize( wxSize( pos_pairs[i + 1], overbar_y ) ); DPOINT dev_to = userToDeviceSize( wxSize( pos_pairs[i + 1], overbar_y ) );
fprintf( outputFile, "%g %g %g %g line ", fprintf( outputFile, "%g %g %g %g line ",
dev_from.x, dev_from.y, dev_to.x, dev_to.y ); dev_from.x, dev_from.y, dev_to.x, dev_to.y );
} }
// Restore the CTM // Restore the CTM
...@@ -880,15 +915,14 @@ void PS_PLOTTER::Text( const wxPoint& aPos, ...@@ -880,15 +915,14 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
{ {
fputsPostscriptString( outputFile, aText ); fputsPostscriptString( outputFile, aText );
DPOINT pos_dev = userToDeviceCoordinates( aPos ); DPOINT pos_dev = userToDeviceCoordinates( aPos );
fprintf( outputFile, " %g %g phantomshow\n", fprintf( outputFile, " %g %g phantomshow\n", pos_dev.x, pos_dev.y );
pos_dev.x, pos_dev.y );
} }
// Draw the stroked text (if requested) // Draw the stroked text (if requested)
if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed ) if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed )
{ {
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
aWidth, aItalic, aBold, aMultilineAllowed ); aWidth, aItalic, aBold, aMultilineAllowed );
} }
} }
...@@ -1044,4 +1078,3 @@ const double hvbo_widths[256] = { ...@@ -1044,4 +1078,3 @@ const double hvbo_widths[256] = {
0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584,
0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556 0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556
}; };
/*************************************************************** /*
* Name: AboutDialog_main.cpp * This program source code file is part of KiCad, a free EDA CAD application.
* Purpose: Code for Application Class *
* Author: Rafael Sokolowski (rafael.sokolowski@web.de) * Copyright (C) 2010 Rafael Sokolowski <Rafael.Sokolowski@web.de>
* Created: 2010-08-06 * Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright: Rafael Sokolowski () *
* License: * 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 <dialog_about.h> #include <dialog_about.h>
#include <aboutinfo.h> #include <aboutinfo.h>
#include <wx/aboutdlg.h> #include <wx/aboutdlg.h>
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Rafael Sokolowski <Rafael.Sokolowski@web.de>
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
#ifndef ABOUTAPPINFO_H #ifndef ABOUTAPPINFO_H
#define ABOUTAPPINFO_H #define ABOUTAPPINFO_H
......
This diff is collapsed.
/*************************************************************** /*
* Name: dialog_about.h * This program source code file is part of KiCad, a free EDA CAD application.
* Purpose: Defines Application Frame *
* Author: Rafael Sokolowski (rafael.sokolowski@web.de) * Copyright (C) 2010 Rafael Sokolowski <Rafael.Sokolowski@web.de>
* Created: 2010-08-06 * Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright: Rafael Sokolowski () *
* License: * 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
*/
#ifndef DIALOG_ABOUT_H #ifndef DIALOG_ABOUT_H
#define DIALOG_ABOUT_H #define DIALOG_ABOUT_H
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/** /**
* @file eda_dde.cpp * @file eda_dde.cpp
*/ */
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/** /**
* @file eda_doc.cpp * @file eda_doc.cpp
*/ */
......
...@@ -4,21 +4,21 @@ ...@@ -4,21 +4,21 @@
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* Contact information: E-mail: tor.dokken@sintef.no * Contact information: E-mail: tor.dokken@sintef.no
* SINTEF ICT, Department of Applied Mathematics, * SINTEF ICT, Department of Applied Mathematics,
* P.O. Box 124 Blindern, * P.O. Box 124 Blindern,
* 0314 Oslo, Norway. * 0314 Oslo, Norway.
* *
* This file is part of TTL. * This file is part of TTL.
* *
* TTL is free software: you can redistribute it and/or modify * TTL is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version. * License, or (at your option) any later version.
* *
* TTL is distributed in the hope that it will be useful, * TTL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public * You should have received a copy of the GNU Affero General Public
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* disclosing the source code of your own applications. * disclosing the source code of your own applications.
* *
* This file may be used in accordance with the terms contained in a * This file may be used in accordance with the terms contained in a
* written agreement between you and SINTEF ICT. * written agreement between you and SINTEF ICT.
*/ */
#include <ttl/halfedge/hetriang.h> #include <ttl/halfedge/hetriang.h>
...@@ -636,7 +636,7 @@ EDGE_PTR TRIANGULATION::GetInteriorNode() const ...@@ -636,7 +636,7 @@ EDGE_PTR TRIANGULATION::GetInteriorNode() const
{ {
const std::list<EDGE_PTR>& leadingEdges = GetLeadingEdges(); const std::list<EDGE_PTR>& leadingEdges = GetLeadingEdges();
std::list<EDGE_PTR>::const_iterator it; std::list<EDGE_PTR>::const_iterator it;
for( it = leadingEdges.begin(); it != leadingEdges.end(); ++it ) for( it = leadingEdges.begin(); it != leadingEdges.end(); ++it )
{ {
EDGE_PTR edge = *it; EDGE_PTR edge = *it;
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h> #include <fctsys.h>
#include <html_messagebox.h> #include <html_messagebox.h>
#include <macros.h> #include <macros.h>
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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 <wx/filename.h> #include <wx/filename.h>
#include <wx/snglinst.h> #include <wx/snglinst.h>
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* 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 <macros.h> #include <macros.h>
#include <fctsys.h> #include <fctsys.h>
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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 <macros.h> #include <macros.h>
#include <search_stack.h> #include <search_stack.h>
...@@ -5,9 +28,9 @@ ...@@ -5,9 +28,9 @@
#if defined(__MINGW32__) #if defined(__MINGW32__)
#define PATH_SEPS wxT(";\r\n") #define PATH_SEPS wxT( ";\r\n" )
#else #else
#define PATH_SEPS wxT(":;\r\n") // unix == linux | mac #define PATH_SEPS wxT( ":;\r\n" ) // unix == linux | mac
#endif #endif
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* 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 <pgm_base.h> #include <pgm_base.h>
#include <common.h> #include <common.h>
/** /**
* Function FindFileInSearchPaths * Function FindFileInSearchPaths
* looks in "this" for \a aFilename, but first modifies every search * looks in "this" for \a aFilename, but first modifies every search
......
/****************/ /*
/* SELCOLOR.CPP */ * This program source code file is part of KiCad, a free EDA CAD application.
/****************/ *
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/* Dialog for selecting color from the palette of available colors. /* Dialog for selecting color from the palette of available colors.
*/ */
...@@ -19,7 +40,6 @@ enum colors_id { ...@@ -19,7 +40,6 @@ enum colors_id {
class WinEDA_SelColorFrame : public wxDialog class WinEDA_SelColorFrame : public wxDialog
{ {
private:
public: public:
WinEDA_SelColorFrame( wxWindow* parent, WinEDA_SelColorFrame( wxWindow* parent,
const wxPoint& framepos, int OldColor ); const wxPoint& framepos, int OldColor );
...@@ -93,19 +113,24 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent, ...@@ -93,19 +113,24 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent,
windowPosition = GetPosition(); windowPosition = GetPosition();
wxRect freeScreenArea( wxGetClientDisplayRect( ) ); wxRect freeScreenArea( wxGetClientDisplayRect( ) );
if( freeScreenArea.GetRight() < endCornerPosition.x ) if( freeScreenArea.GetRight() < endCornerPosition.x )
{ {
windowPosition.x += freeScreenArea.GetRight() - endCornerPosition.x; windowPosition.x += freeScreenArea.GetRight() - endCornerPosition.x;
if( windowPosition.x < freeScreenArea.x ) if( windowPosition.x < freeScreenArea.x )
windowPosition.x = freeScreenArea.x; windowPosition.x = freeScreenArea.x;
// Sligly modify the vertical position to avoid the mouse to be // Sligly modify the vertical position to avoid the mouse to be
// exactly on the upper side of the window // exactly on the upper side of the window
windowPosition.y +=5; windowPosition.y +=5;
endCornerPosition.y += 5; endCornerPosition.y += 5;
} }
if( freeScreenArea.GetBottom() < endCornerPosition.y ) if( freeScreenArea.GetBottom() < endCornerPosition.y )
{ {
windowPosition.y += freeScreenArea.GetBottom() - endCornerPosition.y; windowPosition.y += freeScreenArea.GetBottom() - endCornerPosition.y;
if( windowPosition.y < freeScreenArea.y ) if( windowPosition.y < freeScreenArea.y )
windowPosition.y = freeScreenArea.y; windowPosition.y = freeScreenArea.y;
} }
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* 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 <wx/stdpaths.h> #include <wx/stdpaths.h>
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/** /**
* @file trigo.cpp * @file trigo.cpp
* @brief Trigonometric and geometric basic functions. * @brief Trigonometric and geometric basic functions.
...@@ -29,6 +53,7 @@ bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd, ...@@ -29,6 +53,7 @@ bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd,
return true; return true;
} }
// Returns true if the segment 1 intersectd the segment 2. // Returns true if the segment 1 intersectd the segment 2.
bool SegmentIntersectsSegment( const wxPoint &a_p1_l1, const wxPoint &a_p2_l1, bool SegmentIntersectsSegment( const wxPoint &a_p1_l1, const wxPoint &a_p2_l1,
const wxPoint &a_p1_l2, const wxPoint &a_p2_l2 ) const wxPoint &a_p1_l2, const wxPoint &a_p2_l2 )
...@@ -409,4 +434,3 @@ void RotatePoint( double* pX, double* pY, double angle ) ...@@ -409,4 +434,3 @@ void RotatePoint( double* pX, double* pY, double angle )
*pY = fpy; *pY = fpy;
} }
} }
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/** /**
* @file class_colors_design_settings.h * @file class_colors_design_settings.h
* @brief Handle colors used to draw all items or layers. * @brief Handle colors used to draw all items or layers.
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.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
*/
/** /**
* Common plot library \n * Common plot library \n
* Plot settings, and plotting engines (Postscript, Gerber, HPGL and DXF) * Plot settings, and plotting engines (Postscript, Gerber, HPGL and DXF)
...@@ -153,6 +177,10 @@ public: ...@@ -153,6 +177,10 @@ public:
int width = DEFAULT_LINE_WIDTH ) = 0; int width = DEFAULT_LINE_WIDTH ) = 0;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
int width = DEFAULT_LINE_WIDTH ) = 0; int width = DEFAULT_LINE_WIDTH ) = 0;
/**
* Generic fallback: arc rendered as a polyline
*/
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH );
...@@ -260,6 +288,13 @@ public: ...@@ -260,6 +288,13 @@ public:
* Draw a marker (used for the drill map) * Draw a marker (used for the drill map)
*/ */
static const unsigned MARKER_COUNT = 58; static const unsigned MARKER_COUNT = 58;
/**
* Draw a pattern shape number aShapeId, to coord x0, y0.
* x0, y0 = coordinates tables
* Diameter diameter = (coord table) hole
* AShapeId = index (used to generate forms characters)
*/
void Marker( const wxPoint& position, int diametre, unsigned aShapeId ); void Marker( const wxPoint& position, int diametre, unsigned aShapeId );
/** /**
...@@ -297,23 +332,70 @@ public: ...@@ -297,23 +332,70 @@ public:
protected: protected:
// These are marker subcomponents // These are marker subcomponents
/**
* Plot a circle centered on the position. Building block for markers
*/
void markerCircle( const wxPoint& pos, int radius ); void markerCircle( const wxPoint& pos, int radius );
/**
* Plot a - bar centered on the position. Building block for markers
*/
void markerHBar( const wxPoint& pos, int radius ); void markerHBar( const wxPoint& pos, int radius );
/**
* Plot a / bar centered on the position. Building block for markers
*/
void markerSlash( const wxPoint& pos, int radius ); void markerSlash( const wxPoint& pos, int radius );
/**
* Plot a \ bar centered on the position. Building block for markers
*/
void markerBackSlash( const wxPoint& pos, int radius ); void markerBackSlash( const wxPoint& pos, int radius );
/**
* Plot a | bar centered on the position. Building block for markers
*/
void markerVBar( const wxPoint& pos, int radius ); void markerVBar( const wxPoint& pos, int radius );
/**
* Plot a square centered on the position. Building block for markers
*/
void markerSquare( const wxPoint& position, int radius ); void markerSquare( const wxPoint& position, int radius );
/**
* Plot a lozenge centered on the position. Building block for markers
*/
void markerLozenge( const wxPoint& position, int radius ); void markerLozenge( const wxPoint& position, int radius );
// Helper function for sketched filler segment // Helper function for sketched filler segment
/**
* Cdonvert a thick segment and plot it as an oval
*/
void segmentAsOval( const wxPoint& start, const wxPoint& end, int width, void segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode ); EDA_DRAW_MODE_T tracemode );
void sketchOval( const wxPoint& pos, const wxSize& size, double orient,
int width ); void sketchOval( const wxPoint& pos, const wxSize& size, double orient, int width );
// Coordinate and scaling conversion functions // Coordinate and scaling conversion functions
/**
* Modifies coordinates according to the orientation,
* scale factor, and offsets trace. Also convert from a wxPoint to DPOINT,
* since some output engines needs floating point coordinates.
*/
virtual DPOINT userToDeviceCoordinates( const wxPoint& aCoordinate ); virtual DPOINT userToDeviceCoordinates( const wxPoint& aCoordinate );
/**
* Modifies size according to the plotter scale factors
* (wxSize version, returns a DPOINT)
*/
virtual DPOINT userToDeviceSize( const wxSize& size ); virtual DPOINT userToDeviceSize( const wxSize& size );
/**
* Modifies size according to the plotter scale factors
* (simple double version)
*/
virtual double userToDeviceSize( double size ); virtual double userToDeviceSize( double size );
/// Plot scale - chosen by the user (even implicitly with 'fit in a4') /// Plot scale - chosen by the user (even implicitly with 'fit in a4')
...@@ -786,6 +868,11 @@ public: ...@@ -786,6 +868,11 @@ public:
return wxString( wxT( "gbr" ) ); return wxString( wxT( "gbr" ) );
} }
/**
* Function StartPlot
* Write GERBER header to file
* initialize global variable g_Plot_PlotOutputFile
*/
virtual bool StartPlot(); virtual bool StartPlot();
virtual bool EndPlot(); virtual bool EndPlot();
virtual void SetCurrentLineWidth( int width ); virtual void SetCurrentLineWidth( int width );
...@@ -803,20 +890,45 @@ public: ...@@ -803,20 +890,45 @@ public:
int width = DEFAULT_LINE_WIDTH ); int width = DEFAULT_LINE_WIDTH );
virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle, virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
int aRadius, FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH ); int aRadius, FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH );
/**
* Gerber polygon: they can (and *should*) be filled with the
* appropriate G36/G37 sequence
*/
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH ); FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH );
virtual void PenTo( const wxPoint& pos, char plume ); virtual void PenTo( const wxPoint& pos, char plume );
/**
* Filled circular flashes are stored as apertures
*/
virtual void FlashPadCircle( const wxPoint& pos, int diametre, virtual void FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode ); EDA_DRAW_MODE_T trace_mode );
/**
* Filled oval flashes are handled as aperture in the 90 degree positions only
*/
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient, virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
EDA_DRAW_MODE_T trace_mode ); EDA_DRAW_MODE_T trace_mode );
/**
* Filled rect flashes are handled as aperture in the 90 degree positions only
*/
virtual void FlashPadRect( const wxPoint& pos, const wxSize& size, virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
double orient, EDA_DRAW_MODE_T trace_mode ); double orient, EDA_DRAW_MODE_T trace_mode );
/**
* Trapezoidal pad at the moment are *never* handled as aperture, since
* they require aperture macros
*/
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners, virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ); double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode );
/**
* Change the plot polarity and begin a new layer
* Used to 'scratch off' silk screen away from solder mask
*/
virtual void SetLayerPolarity( bool aPositive ); virtual void SetLayerPolarity( bool aPositive );
virtual void SetLayerAttribFunction( const wxString& function ) virtual void SetLayerAttribFunction( const wxString& function )
...@@ -838,6 +950,12 @@ public: ...@@ -838,6 +950,12 @@ public:
protected: protected:
void selectAperture( const wxSize& size, APERTURE::APERTURE_TYPE type ); void selectAperture( const wxSize& size, APERTURE::APERTURE_TYPE type );
/**
* Emit a D-Code record, using proper conversions
* to format a leading zero omitted gerber coordinate
* (for n decimal positions, see header generation in start_plot
*/
void emitDcode( const DPOINT& pt, int dcode ); void emitDcode( const DPOINT& pt, int dcode );
std::vector<APERTURE>::iterator std::vector<APERTURE>::iterator
...@@ -847,6 +965,9 @@ protected: ...@@ -847,6 +965,9 @@ protected:
FILE* finalFile; FILE* finalFile;
wxString m_workFilename; wxString m_workFilename;
/**
* Generate the table of D codes
*/
void writeApertureList(); void writeApertureList();
std::vector<APERTURE> apertures; std::vector<APERTURE> apertures;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment