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 */
/************************************/
......
/*
* 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 <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 */
#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
* @brief Handle colors used to draw all items or layers.
......@@ -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
{
if( (unsigned) aLayer < DIM(m_LayersColors) )
......@@ -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 )
{
if( (unsigned) aLayer < DIM(m_LayersColors) )
......@@ -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
{
if( (unsigned) aItemIdx < DIM( m_ItemsColors ) )
......@@ -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 )
{
if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
......@@ -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 )
{
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 <colors_selection.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
* @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
* @brief KiCad: Base of all the plot routines
......@@ -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 )
{
filename = aFullFilename;
......@@ -71,11 +89,7 @@ bool PLOTTER::OpenFile( const wxString& aFullFilename )
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 )
{
wxPoint pos = aCoordinate - plotOffset;
......@@ -100,29 +114,20 @@ DPOINT PLOTTER::userToDeviceCoordinates( const wxPoint& aCoordinate )
return DPOINT( x, y );
}
/**
* Modifies size according to the plotter scale factors
* (wxSize version, returns a DPOINT)
*/
DPOINT PLOTTER::userToDeviceSize( const wxSize& size )
{
return DPOINT( size.x * plotScale * iuPerDeviceUnit,
size.y * plotScale * iuPerDeviceUnit );
}
/**
* Modifies size according to the plotter scale factors
* (simple double version)
*/
double PLOTTER::userToDeviceSize( double size )
{
return size * plotScale * iuPerDeviceUnit;
}
/**
* Generic fallback: arc rendered as a polyline
*/
void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
......@@ -149,11 +154,8 @@ void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int r
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,
aImage.GetHeight() * aScaleFactor );
......@@ -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 )
{
double r = KiROUND( radius / 1.4142 );
......@@ -197,17 +196,13 @@ void PLOTTER::markerSquare( const wxPoint& position, int radius )
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 )
{
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 )
{
std::vector< wxPoint > corner_list;
......@@ -231,48 +226,35 @@ void PLOTTER::markerLozenge( const wxPoint& position, int radius )
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 )
{
MoveTo( 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 )
{
MoveTo( 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 )
{
MoveTo( 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 )
{
MoveTo( 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 )
{
int radius = diametre / 2;
......@@ -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,
EDA_DRAW_MODE_T tracemode )
{
......@@ -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,
int width )
void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient, int width )
{
SetCurrentLineWidth( width );
width = currentPenWidth;
......@@ -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,
EDA_DRAW_MODE_T tracemode )
{
......@@ -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,
EDA_DRAW_MODE_T tracemode )
void PLOTTER::ThickCircle( const wxPoint& pos, int diametre, int width, EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
......@@ -556,4 +531,3 @@ void PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
wxASSERT( !outputFile );
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>
......@@ -97,6 +120,7 @@ EDA_COLOR_T ColorFindNearest( int aR, int aG, int aB )
int distance = (aR - c.m_Red) * (aR - c.m_Red) +
(aG - c.m_Green) * (aG - c.m_Green) +
(aB - c.m_Blue) * (aB - c.m_Blue);
if( distance < nearest_distance && c.m_Red >= aR &&
c.m_Green >= aG && c.m_Blue >= aB )
{
......@@ -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
* an answer */
EDA_COLOR_T candidate = mix_cache[aColor1][aColor2];
if( candidate != BLACK )
return candidate;
......@@ -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.
* Even theorically its not possible (with the current rules), but
* maybe the metric will change in the future */
if( candidate == BLACK)
if( candidate == BLACK )
candidate = DARKDARKGRAY;
// 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
* @brief Common GERBER plot routines.
......@@ -15,6 +39,7 @@
#include <build_version.h>
GERBER_PLOTTER::GERBER_PLOTTER()
{
workFile = 0;
......@@ -32,6 +57,7 @@ GERBER_PLOTTER::GERBER_PLOTTER()
m_gerberUnitFmt = 6;
}
void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror )
{
......@@ -54,6 +80,7 @@ void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
SetDefaultLineWidth( 100 * aIusPerDecimil ); // Arbitrary default
}
void GERBER_PLOTTER::SetGerberCoordinatesFormat( int aResolution, bool aUseInches )
{
m_gerberUnitInch = aUseInches;
......@@ -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 )
{
......@@ -78,11 +100,7 @@ void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int 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()
{
wxASSERT( outputFile );
......@@ -241,9 +259,6 @@ void GERBER_PLOTTER::selectAperture( const wxSize& size,
}
/**
* Generate the table of D codes
*/
void GERBER_PLOTTER::writeApertureList()
{
wxASSERT( outputFile );
......@@ -308,19 +323,18 @@ void GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume )
break;
case 'U':
emitDcode( pos_dev, 2 );
emitDcode( pos_dev, 2 );
break;
case 'D':
emitDcode( pos_dev, 1 );
emitDcode( pos_dev, 1 );
}
penState = plume;
}
void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill,
int width )
void GERBER_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
{
std::vector< wxPoint > cornerList;
......@@ -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,
int aWidth )
void GERBER_PLOTTER::Circle( const wxPoint& aCenter, int aDiameter, FILL_T aFill, int aWidth )
{
Arc( aCenter, 0, 3600, aDiameter / 2, aFill, aWidth );
}
......@@ -357,8 +370,7 @@ void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAn
end.x = aCenter.x + KiROUND( cosdecideg( aRadius, aEndAngle ) );
end.y = aCenter.y - KiROUND( sindecideg( aRadius, aEndAngle ) );
DPOINT devEnd = userToDeviceCoordinates( end );
DPOINT devCenter = userToDeviceCoordinates( aCenter )
- userToDeviceCoordinates( start );
DPOINT devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
fprintf( outputFile, "G75*\n" ); // Multiquadrant mode
......@@ -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,
FILL_T aFill, int aWidth )
{
......@@ -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 );
wxSize size( diametre, diametre );
......@@ -437,17 +442,14 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
break;
case FILLED:
DPOINT pos_dev = userToDeviceCoordinates( pos );
DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Circle );
emitDcode( pos_dev, 3 );
emitDcode( pos_dev, 3 );
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,
EDA_DRAW_MODE_T trace_mode )
{
......@@ -462,9 +464,9 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, doub
if( orient == 900 || orient == 2700 ) /* orientation turned 90 deg. */
EXCHG( size.x, size.y );
DPOINT pos_dev = userToDeviceCoordinates( pos );
DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Oval );
emitDcode( pos_dev, 3 );
emitDcode( pos_dev, 3 );
}
else /* Plot pad as a segment. */
{
......@@ -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,
double orient, EDA_DRAW_MODE_T trace_mode )
......@@ -516,30 +515,30 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
{
case 900:
case 2700: // rotation of 90 degrees or 270 swaps sizes
EXCHG( size.x, size.y );
EXCHG( size.x, size.y );
// Pass through
case 0:
case 1800:
switch( trace_mode )
{
case LINE:
case SKETCH:
SetCurrentLineWidth( -1 );
Rect( wxPoint( pos.x - (size.x - currentPenWidth) / 2,
pos.y - (size.y - currentPenWidth) / 2 ),
wxPoint( pos.x + (size.x - currentPenWidth) / 2,
pos.y + (size.y - currentPenWidth) / 2 ),
NO_FILL );
break;
case FILLED:
DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Rect );
emitDcode( pos_dev, 3 );
break;
}
break;
switch( trace_mode )
{
case LINE:
case SKETCH:
SetCurrentLineWidth( -1 );
Rect( wxPoint( pos.x - (size.x - currentPenWidth) / 2,
pos.y - (size.y - currentPenWidth) / 2 ),
wxPoint( pos.x + (size.x - currentPenWidth) / 2,
pos.y + (size.y - currentPenWidth) / 2 ),
NO_FILL );
break;
case FILLED:
DPOINT pos_dev = userToDeviceCoordinates( pos );
selectAperture( size, APERTURE::Rect );
emitDcode( pos_dev, 3 );
break;
}
break;
default: // plot pad shape as polygon
{
......@@ -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,
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
......@@ -596,10 +591,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
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 )
{
if( aPositive )
......@@ -607,4 +599,3 @@ void GERBER_PLOTTER::SetLayerPolarity( bool aPositive )
else
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
* @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
* @brief Kicad: Common plot Postscript Routines
......@@ -211,28 +235,30 @@ void PSLIKE_PLOTTER::fputsPostscriptString(FILE *fout, const wxString& txt)
putc( '(', fout );
for( unsigned i = 0; i < txt.length(); i++ )
{
// Lazyness made me use stdio buffering yet another time...
wchar_t ch = txt[i];
if( ch < 256 )
{
switch (ch)
// Lazyness made me use stdio buffering yet another time...
wchar_t ch = txt[i];
if( ch < 256 )
{
// The ~ shouldn't reach the outside
case '~':
break;
// These characters must be escaped
case '(':
case ')':
case '\\':
putc( '\\', fout );
// FALLTHRU
default:
putc( ch, fout );
break;
switch (ch)
{
// The ~ shouldn't reach the outside
case '~':
break;
// These characters must be escaped
case '(':
case ')':
case '\\':
putc( '\\', fout );
// FALLTHRU
default:
putc( ch, fout );
break;
}
}
}
}
putc( ')', fout );
}
......@@ -354,31 +380,31 @@ void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
switch( aH_justify )
{
case GR_TEXT_HJUSTIFY_CENTER:
dx = -tw / 2;
break;
dx = -tw / 2;
break;
case GR_TEXT_HJUSTIFY_RIGHT:
dx = -tw;
break;
dx = -tw;
break;
case GR_TEXT_HJUSTIFY_LEFT:
dx = 0;
break;
dx = 0;
break;
}
switch( aV_justify )
{
case GR_TEXT_VJUSTIFY_CENTER:
dy = th / 2;
break;
dy = th / 2;
break;
case GR_TEXT_VJUSTIFY_TOP:
dy = th;
break;
break;
case GR_TEXT_VJUSTIFY_BOTTOM:
dy = 0;
break;
dy = 0;
break;
}
RotatePoint( &dx, &dy, aOrient );
......@@ -421,12 +447,12 @@ void PS_PLOTTER::SetCurrentLineWidth( int width )
pen_width = defaultPenWidth;
if( pen_width != currentPenWidth )
fprintf( outputFile, "%g setlinewidth\n",
userToDeviceSize( pen_width ) );
fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( pen_width ) );
currentPenWidth = pen_width;
}
void PS_PLOTTER::emitSetRGBColor( double r, double g, double b )
{
wxASSERT( outputFile );
......@@ -560,7 +586,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
// Map image size to device
DPOINT end_dev = userToDeviceCoordinates( end );
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
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,
fprintf( outputFile, " [%d 0 0 %d 0 %d]\n", pix_size.x, -pix_size.y , pix_size.y);
// include image data in ps file
fprintf( outputFile, "{currentfile pix readhexstring pop}\n" );
if( colorMode )
fputs( "false 3 colorimage\n", outputFile );
else
......@@ -575,6 +602,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
// Single data source, 3 colors, Output RGB data (hexadecimal)
// (or the same downscaled to gray)
int jj = 0;
for( int yy = 0; yy < pix_size.y; yy ++ )
{
for( int xx = 0; xx < pix_size.x; xx++, jj++ )
......@@ -584,16 +612,19 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
jj = 0;
fprintf( outputFile, "\n");
}
int red, green, blue;
red = aImage.GetRed( xx, yy) & 0xFF;
green = aImage.GetGreen( xx, yy) & 0xFF;
blue = aImage.GetBlue( xx, yy) & 0xFF;
if( colorMode )
fprintf( outputFile, "%2.2X%2.2X%2.2X", red, green, blue );
else
fprintf( outputFile, "%2.2X", (red + green + blue) / 3 );
}
}
fprintf( outputFile, "\n");
fprintf( outputFile, "origstate restore\n" );
}
......@@ -602,6 +633,7 @@ void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
{
wxASSERT( outputFile );
if( plume == 'Z' )
{
if( penState != 'Z' )
......@@ -611,6 +643,7 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
penLastpos.x = -1;
penLastpos.y = -1;
}
return;
}
......@@ -618,13 +651,15 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
{
fputs( "newpath\n", outputFile );
}
if( penState != plume || pos != penLastpos )
{
DPOINT pos_dev = userToDeviceCoordinates( pos );
DPOINT pos_dev = userToDeviceCoordinates( pos );
fprintf( outputFile, "%g %g %sto\n",
pos_dev.x, pos_dev.y,
( plume=='D' ) ? "line" : "move" );
}
penState = plume;
penLastpos = pos;
}
......@@ -790,8 +825,7 @@ bool PS_PLOTTER::StartPlot()
plotScaleAdjX, plotScaleAdjY );
// Set default line width
fprintf( outputFile, "%g setlinewidth\n",
userToDeviceSize( defaultPenWidth ) );
fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( defaultPenWidth ) );
fputs( "%%EndPageSetup\n", outputFile );
return true;
......@@ -803,7 +837,7 @@ bool PS_PLOTTER::EndPlot()
wxASSERT( outputFile );
fputs( "showpage\n"
"grestore\n"
"%%EOF\n", outputFile );
"%%EOF\n", outputFile );
fclose( outputFile );
outputFile = NULL;
......@@ -863,12 +897,13 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
std::vector<int> pos_pairs;
postscriptOverlinePositions( aText, aSize.x, aItalic, aBold, &pos_pairs );
int overbar_y = KiROUND( aSize.y * 1.1 );
for( unsigned i = 0; i < pos_pairs.size(); i += 2)
{
DPOINT dev_from = userToDeviceSize( wxSize( pos_pairs[i], overbar_y ) );
DPOINT dev_to = userToDeviceSize( wxSize( pos_pairs[i + 1], overbar_y ) );
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
......@@ -880,15 +915,14 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
{
fputsPostscriptString( outputFile, aText );
DPOINT pos_dev = userToDeviceCoordinates( aPos );
fprintf( outputFile, " %g %g phantomshow\n",
pos_dev.x, pos_dev.y );
fprintf( outputFile, " %g %g phantomshow\n", pos_dev.x, pos_dev.y );
}
// Draw the stroked text (if requested)
if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed )
{
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] = {
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
};
/***************************************************************
* Name: AboutDialog_main.cpp
* Purpose: Code for Application Class
* Author: Rafael Sokolowski (rafael.sokolowski@web.de)
* Created: 2010-08-06
* Copyright: Rafael Sokolowski ()
* License:
**************************************************************/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 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
*/
#include <dialog_about.h>
#include <aboutinfo.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
#define ABOUTAPPINFO_H
......
This diff is collapsed.
/***************************************************************
* Name: dialog_about.h
* Purpose: Defines Application Frame
* Author: Rafael Sokolowski (rafael.sokolowski@web.de)
* Created: 2010-08-06
* Copyright: Rafael Sokolowski ()
* License:
**************************************************************/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 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 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
*/
......
/*
* 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
*/
......
......@@ -4,21 +4,21 @@
* Copyright (C) 2013 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* Contact information: E-mail: tor.dokken@sintef.no
* SINTEF ICT, Department of Applied Mathematics,
* P.O. Box 124 Blindern,
* 0314 Oslo, Norway.
* Contact information: E-mail: tor.dokken@sintef.no
* SINTEF ICT, Department of Applied Mathematics,
* P.O. Box 124 Blindern,
* 0314 Oslo, Norway.
*
* This file is part of TTL.
*
* TTL is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* 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,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* TTL 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public
......@@ -36,7 +36,7 @@
* disclosing the source code of your own applications.
*
* 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>
......@@ -636,7 +636,7 @@ EDGE_PTR TRIANGULATION::GetInteriorNode() const
{
const std::list<EDGE_PTR>& leadingEdges = GetLeadingEdges();
std::list<EDGE_PTR>::const_iterator it;
for( it = leadingEdges.begin(); it != leadingEdges.end(); ++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 <html_messagebox.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/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 <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 <search_stack.h>
......@@ -5,9 +28,9 @@
#if defined(__MINGW32__)
#define PATH_SEPS wxT(";\r\n")
#define PATH_SEPS wxT( ";\r\n" )
#else
#define PATH_SEPS wxT(":;\r\n") // unix == linux | mac
#define PATH_SEPS wxT( ":;\r\n" ) // unix == linux | mac
#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 <common.h>
/**
* Function FindFileInSearchPaths
* 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.
*/
......@@ -19,7 +40,6 @@ enum colors_id {
class WinEDA_SelColorFrame : public wxDialog
{
private:
public:
WinEDA_SelColorFrame( wxWindow* parent,
const wxPoint& framepos, int OldColor );
......@@ -93,19 +113,24 @@ WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent,
windowPosition = GetPosition();
wxRect freeScreenArea( wxGetClientDisplayRect( ) );
if( freeScreenArea.GetRight() < endCornerPosition.x )
{
windowPosition.x += freeScreenArea.GetRight() - endCornerPosition.x;
if( windowPosition.x < freeScreenArea.x )
windowPosition.x = freeScreenArea.x;
// Sligly modify the vertical position to avoid the mouse to be
// exactly on the upper side of the window
windowPosition.y +=5;
endCornerPosition.y += 5;
}
if( freeScreenArea.GetBottom() < endCornerPosition.y )
{
windowPosition.y += freeScreenArea.GetBottom() - endCornerPosition.y;
if( 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>
......
/*
* 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
* @brief Trigonometric and geometric basic functions.
......@@ -29,6 +53,7 @@ bool IsPointOnSegment( const wxPoint& aSegStart, const wxPoint& aSegEnd,
return true;
}
// Returns true if the segment 1 intersectd the segment 2.
bool SegmentIntersectsSegment( const wxPoint &a_p1_l1, const wxPoint &a_p2_l1,
const wxPoint &a_p1_l2, const wxPoint &a_p2_l2 )
......@@ -409,4 +434,3 @@ void RotatePoint( double* pX, double* pY, double angle )
*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
* @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
* Plot settings, and plotting engines (Postscript, Gerber, HPGL and DXF)
......@@ -153,6 +177,10 @@ public:
int width = DEFAULT_LINE_WIDTH ) = 0;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
int width = DEFAULT_LINE_WIDTH ) = 0;
/**
* Generic fallback: arc rendered as a polyline
*/
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH );
......@@ -260,6 +288,13 @@ public:
* Draw a marker (used for the drill map)
*/
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 );
/**
......@@ -297,23 +332,70 @@ public:
protected:
// These are marker subcomponents
/**
* Plot a circle centered on the position. Building block for markers
*/
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 );
/**
* Plot a / bar centered on the position. Building block for markers
*/
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 );
/**
* Plot a | bar centered on the position. Building block for markers
*/
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 );
/**
* Plot a lozenge centered on the position. Building block for markers
*/
void markerLozenge( const wxPoint& position, int radius );
// 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,
EDA_DRAW_MODE_T tracemode );
void sketchOval( const wxPoint& pos, const wxSize& size, double orient,
int width );
EDA_DRAW_MODE_T tracemode );
void sketchOval( const wxPoint& pos, const wxSize& size, double orient, int width );
// 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 );
/**
* Modifies size according to the plotter scale factors
* (wxSize version, returns a DPOINT)
*/
virtual DPOINT userToDeviceSize( const wxSize& size );
/**
* Modifies size according to the plotter scale factors
* (simple double version)
*/
virtual double userToDeviceSize( double size );
/// Plot scale - chosen by the user (even implicitly with 'fit in a4')
......@@ -786,6 +868,11 @@ public:
return wxString( wxT( "gbr" ) );
}
/**
* Function StartPlot
* Write GERBER header to file
* initialize global variable g_Plot_PlotOutputFile
*/
virtual bool StartPlot();
virtual bool EndPlot();
virtual void SetCurrentLineWidth( int width );
......@@ -803,20 +890,45 @@ public:
int width = DEFAULT_LINE_WIDTH );
virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
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,
FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH );
virtual void PenTo( const wxPoint& pos, char plume );
/**
* Filled circular flashes are stored as apertures
*/
virtual void FlashPadCircle( const wxPoint& pos, int diametre,
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,
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,
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,
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 SetLayerAttribFunction( const wxString& function )
......@@ -838,6 +950,12 @@ public:
protected:
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 );
std::vector<APERTURE>::iterator
......@@ -847,6 +965,9 @@ protected:
FILE* finalFile;
wxString m_workFilename;
/**
* Generate the table of D codes
*/
void writeApertureList();
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