diff --git a/common/bezier_curves.cpp b/common/bezier_curves.cpp index cfe64559b5..9dc67b6a93 100644 --- a/common/bezier_curves.cpp +++ b/common/bezier_curves.cpp @@ -1,3 +1,27 @@ +/* + * 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 */ /************************************/ diff --git a/common/bin_mod.cpp b/common/bin_mod.cpp index ca16c60fde..af3370de22 100644 --- a/common/bin_mod.cpp +++ b/common/bin_mod.cpp @@ -1,3 +1,26 @@ +/* + * 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 #include diff --git a/common/build_version.cpp b/common/build_version.cpp index 6ac1dc8c4a..77f401733d 100644 --- a/common/build_version.cpp +++ b/common/build_version.cpp @@ -1,3 +1,27 @@ +/* + * 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 diff --git a/common/class_colors_design_settings.cpp b/common/class_colors_design_settings.cpp index 19fa76ac4a..dbdd6ac6b5 100644 --- a/common/class_colors_design_settings.cpp +++ b/common/class_colors_design_settings.cpp @@ -1,3 +1,27 @@ +/* + * 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++ ) diff --git a/common/class_layer_box_selector.cpp b/common/class_layer_box_selector.cpp index 9bfdd84ac4..48e7fe05fb 100644 --- a/common/class_layer_box_selector.cpp +++ b/common/class_layer_box_selector.cpp @@ -1,3 +1,27 @@ +/* + * 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 #include #include diff --git a/common/class_marker_base.cpp b/common/class_marker_base.cpp index 358975ff8e..1f81d0a59f 100644 --- a/common/class_marker_base.cpp +++ b/common/class_marker_base.cpp @@ -1,3 +1,27 @@ +/* + * 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. diff --git a/common/class_plotter.cpp b/common/class_plotter.cpp index c9646710c8..ffa4615fd5 100644 --- a/common/class_plotter.cpp +++ b/common/class_plotter.cpp @@ -1,3 +1,27 @@ +/* + * 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; } - diff --git a/common/colors.cpp b/common/colors.cpp index 9016840865..e7b1ce4175 100644 --- a/common/colors.cpp +++ b/common/colors.cpp @@ -1,3 +1,26 @@ +/* + * 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 @@ -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 diff --git a/common/common_plotGERBER_functions.cpp b/common/common_plotGERBER_functions.cpp index 7b88679f80..614e78520b 100644 --- a/common/common_plotGERBER_functions.cpp +++ b/common/common_plotGERBER_functions.cpp @@ -1,3 +1,27 @@ +/* + * 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 + 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; + 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; + 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" ); } - diff --git a/common/common_plotHPGL_functions.cpp b/common/common_plotHPGL_functions.cpp index 8498b0491b..1e040b03b1 100644 --- a/common/common_plotHPGL_functions.cpp +++ b/common/common_plotHPGL_functions.cpp @@ -1,3 +1,27 @@ +/* + * 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 diff --git a/common/common_plotPS_functions.cpp b/common/common_plotPS_functions.cpp index 627f079088..c1ba968f2d 100644 --- a/common/common_plotPS_functions.cpp +++ b/common/common_plotPS_functions.cpp @@ -1,3 +1,27 @@ +/* + * 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) - { - // The ~ shouldn't reach the outside - case '~': - break; - // These characters must be escaped - case '(': - case ')': - case '\\': - putc( '\\', fout ); + // Lazyness made me use stdio buffering yet another time... + wchar_t ch = txt[i]; - // FALLTHRU - default: - putc( ch, fout ); - break; + if( ch < 256 ) + { + 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 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 }; - diff --git a/common/dialog_about/AboutDialog_main.cpp b/common/dialog_about/AboutDialog_main.cpp index 975abbd46f..eefd895b66 100644 --- a/common/dialog_about/AboutDialog_main.cpp +++ b/common/dialog_about/AboutDialog_main.cpp @@ -1,11 +1,27 @@ -/*************************************************************** - * 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 + * 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 #include #include diff --git a/common/dialog_about/aboutinfo.h b/common/dialog_about/aboutinfo.h index 04a78b2aaa..f9bd5efd7b 100644 --- a/common/dialog_about/aboutinfo.h +++ b/common/dialog_about/aboutinfo.h @@ -1,3 +1,27 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2014 Rafael Sokolowski + * 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 diff --git a/common/dialog_about/dialog_about.cpp b/common/dialog_about/dialog_about.cpp index d4deb7122f..001d8f0d94 100644 --- a/common/dialog_about/dialog_about.cpp +++ b/common/dialog_about/dialog_about.cpp @@ -1,11 +1,27 @@ -/*************************************************************** - * Name: dialog_about.cpp - * Purpose: Code for 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 + * 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 /////////////////////////////////////////////////////////////////////////////// @@ -32,16 +48,18 @@ dialog_about::dialog_about(wxWindow *parent, AboutAppInfo& appInfo) DeleteNotebooks(); CreateNotebooks(); - GetSizer()->SetSizeHints(this); + GetSizer()->SetSizeHints( this ); m_auiNotebook->Update(); SetFocus(); Centre(); } + dialog_about::~dialog_about() { } + wxFlexGridSizer* dialog_about::CreateFlexGridSizer() { // three colums with vertical and horizontal extra space of two pixels @@ -52,42 +70,50 @@ wxFlexGridSizer* dialog_about::CreateFlexGridSizer() return fgSizer1; } + void dialog_about::DeleteNotebooks() { for( size_t i=0; iGetPageCount(); ++i ) - m_auiNotebook->DeletePage(i); + m_auiNotebook->DeletePage( i ); } + void dialog_about::CreateNotebooks() { - CreateNotebookHtmlPage( m_auiNotebook, _("Information"), picInformation, info.GetDescription() ); + CreateNotebookHtmlPage( m_auiNotebook, _( "Information" ), picInformation, + info.GetDescription() ); - CreateNotebookPage( m_auiNotebook, _("Developers") , picDevelopers, info.GetDevelopers() ); - CreateNotebookPage( m_auiNotebook, _("Doc Writers"), picDocWriters, info.GetDocWriters() ); + CreateNotebookPage( m_auiNotebook, _( "Developers" ) , picDevelopers, info.GetDevelopers() ); + CreateNotebookPage( m_auiNotebook, _( "Doc Writers" ), picDocWriters, info.GetDocWriters() ); - CreateNotebookPageByCategory( m_auiNotebook, _("Artists") , picArtists, info.GetArtists() ); - CreateNotebookPageByCategory( m_auiNotebook, _("Translators"), picTranslators, info.GetTranslators() ); + CreateNotebookPageByCategory( m_auiNotebook, _( "Artists" ), picArtists, info.GetArtists() ); + CreateNotebookPageByCategory( m_auiNotebook, _( "Translators" ), picTranslators, + info.GetTranslators() ); - CreateNotebookHtmlPage( m_auiNotebook, _("License"), picLicense, info.GetLicense() ); + CreateNotebookHtmlPage( m_auiNotebook, _( "License" ), picLicense, info.GetLicense() ); } -void dialog_about::CreateNotebookPage(wxAuiNotebook* parent, const wxString& caption, const wxBitmap& icon, const Contributors& contributors) +void dialog_about::CreateNotebookPage( wxAuiNotebook* parent, const wxString& caption, + const wxBitmap& icon, const Contributors& contributors ) { wxBoxSizer* bSizer = new wxBoxSizer( wxHORIZONTAL ); - wxScrolledWindow* m_scrolledWindow1 = new wxScrolledWindow( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); + wxScrolledWindow* m_scrolledWindow1 = new wxScrolledWindow( parent, wxID_ANY, + wxDefaultPosition, + wxDefaultSize, + wxHSCROLL|wxVSCROLL ); m_scrolledWindow1->SetScrollRate( 5, 5 ); /* Panel for additional space at the left, * but can also be used to show an additional bitmap. */ - wxPanel* panel1 = new wxPanel(m_scrolledWindow1); + wxPanel* panel1 = new wxPanel( m_scrolledWindow1 ); wxFlexGridSizer* fgSizer1 = CreateFlexGridSizer(); - for ( size_t i=0; iGetIcon() ); @@ -96,21 +122,26 @@ void dialog_about::CreateNotebookPage(wxAuiNotebook* parent, const wxString& cap // Name of contributor at second column if ( contributor->GetName() != wxEmptyString ) { - wxStaticText* m_staticText1 = new wxStaticText( m_scrolledWindow1, wxID_ANY, contributor->GetName(), wxDefaultPosition, wxDefaultSize, 0 ); + wxStaticText* m_staticText1 = new wxStaticText( m_scrolledWindow1, wxID_ANY, + contributor->GetName(), + wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1->Wrap( -1 ); fgSizer1->Add( m_staticText1, 0, wxALIGN_LEFT|wxBOTTOM, 2 ); } - else { - fgSizer1->AddSpacer(5); + else + { + fgSizer1->AddSpacer( 5 ); } // Email address of contributor at third column if ( contributor->GetEMail() != wxEmptyString ) { - wxHyperlinkCtrl* hyperlink = CreateHyperlink( m_scrolledWindow1, contributor->GetEMail() ); + wxHyperlinkCtrl* hyperlink = CreateHyperlink( m_scrolledWindow1, + contributor->GetEMail() ); fgSizer1->Add( hyperlink, 0, wxALIGN_LEFT|wxBOTTOM, 2 ); } - else { + else + { fgSizer1->AddSpacer(5); } } @@ -120,27 +151,32 @@ void dialog_about::CreateNotebookPage(wxAuiNotebook* parent, const wxString& cap m_scrolledWindow1->SetSizer( bSizer ); m_scrolledWindow1->Layout(); bSizer->Fit( m_scrolledWindow1 ); - parent->AddPage( m_scrolledWindow1, caption, false, icon ); } -void dialog_about::CreateNotebookPageByCategory(wxAuiNotebook* parent, const wxString& caption, const wxBitmap& icon, const Contributors& contributors) + +void dialog_about::CreateNotebookPageByCategory(wxAuiNotebook* parent, const wxString& caption, + const wxBitmap& icon, + const Contributors& contributors) { wxBoxSizer* bSizer = new wxBoxSizer( wxHORIZONTAL ); - wxScrolledWindow* m_scrolledWindow1 = new wxScrolledWindow( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); + wxScrolledWindow* m_scrolledWindow1 = new wxScrolledWindow( parent, wxID_ANY, + wxDefaultPosition, + wxDefaultSize, + wxHSCROLL|wxVSCROLL ); m_scrolledWindow1->SetScrollRate( 5, 5 ); /* Panel for additional space at the left, * but can also be used to show an additional bitmap. */ - wxPanel* panel1 = new wxPanel(m_scrolledWindow1); + wxPanel* panel1 = new wxPanel( m_scrolledWindow1 ); wxFlexGridSizer* fgSizer1 = CreateFlexGridSizer(); - for ( size_t i=0; iGetIcon(); wxString category = contributor->GetCategory(); @@ -148,25 +184,28 @@ void dialog_about::CreateNotebookPageByCategory(wxAuiNotebook* parent, const wxS /* to construct the next row we expect to have * a category and a contributor that was not considered up to now */ - if ( ( category != wxEmptyString ) && !( contributor->IsChecked() ) ) + if( ( category != wxEmptyString ) && !( contributor->IsChecked() ) ) { // Icon at first column wxStaticBitmap* m_bitmap1 = CreateStaticBitmap( m_scrolledWindow1, icon ); fgSizer1->Add( m_bitmap1, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, 5 ); // Category name at second column - wxStaticText* m_staticText1 = new wxStaticText( m_scrolledWindow1, wxID_ANY, contributor->GetCategory() + wxT(":"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) ); // bold font + wxStaticText* m_staticText1 = new wxStaticText( m_scrolledWindow1, wxID_ANY, + contributor->GetCategory() + wxT( ":" ), + wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, + wxEmptyString ) ); // bold font m_staticText1->Wrap( -1 ); fgSizer1->Add( m_staticText1, 0, wxALIGN_LEFT|wxBOTTOM, 2 ); // Nothing at third column - fgSizer1->AddSpacer(5); + fgSizer1->AddSpacer( 5 ); // Now, all contributors of the same category will follow - for ( size_t j=0; jGetCategory() == category ) { @@ -174,18 +213,23 @@ void dialog_about::CreateNotebookPageByCategory(wxAuiNotebook* parent, const wxS fgSizer1->AddSpacer(5); // Name of contributor at second column - wxStaticText* m_staticText2 = new wxStaticText( m_scrolledWindow1, wxID_ANY, wxT(" • ") + contributor->GetName(), wxDefaultPosition, wxDefaultSize, 0 ); + wxStaticText* m_staticText2 = new wxStaticText( m_scrolledWindow1, wxID_ANY, + wxT(" • ") + contributor->GetName(), + wxDefaultPosition, + wxDefaultSize, 0 ); m_staticText1->Wrap( -1 ); fgSizer1->Add( m_staticText2, 0, wxALIGN_LEFT|wxBOTTOM, 2 ); // Email address of contributor at third column - if ( contributor->GetEMail() != wxEmptyString ) + if( contributor->GetEMail() != wxEmptyString ) { - wxHyperlinkCtrl* hyperlink = CreateHyperlink( m_scrolledWindow1, contributor->GetEMail() ); + wxHyperlinkCtrl* hyperlink = CreateHyperlink( m_scrolledWindow1, + contributor->GetEMail() ); fgSizer1->Add( hyperlink, 0, wxALIGN_LEFT|wxBOTTOM, 2 ); } - else { - fgSizer1->AddSpacer(5); + else + { + fgSizer1->AddSpacer( 5 ); } /* this contributor was added to the gui, @@ -195,7 +239,8 @@ void dialog_about::CreateNotebookPageByCategory(wxAuiNotebook* parent, const wxS } } } - else { + else + { continue; } } @@ -205,7 +250,7 @@ void dialog_about::CreateNotebookPageByCategory(wxAuiNotebook* parent, const wxS */ for ( size_t k=0; kIsChecked() ) continue; @@ -215,24 +260,29 @@ void dialog_about::CreateNotebookPageByCategory(wxAuiNotebook* parent, const wxS fgSizer1->Add( m_bitmap1, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, 5 ); // Name of contributor at second column - if ( contributor->GetName() != wxEmptyString ) + if( contributor->GetName() != wxEmptyString ) { - wxStaticText* m_staticText1 = new wxStaticText( m_scrolledWindow1, wxID_ANY, contributor->GetName(), wxDefaultPosition, wxDefaultSize, 0 ); + wxStaticText* m_staticText1 = new wxStaticText( m_scrolledWindow1, wxID_ANY, + contributor->GetName(), + wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1->Wrap( -1 ); fgSizer1->Add( m_staticText1, 0, wxALIGN_LEFT|wxBOTTOM, 2 ); } - else { - fgSizer1->AddSpacer(5); + else + { + fgSizer1->AddSpacer( 5 ); } // Email address of contributor at third column if ( contributor->GetEMail() != wxEmptyString ) { - wxHyperlinkCtrl* hyperlink = CreateHyperlink( m_scrolledWindow1, contributor->GetEMail() ); + wxHyperlinkCtrl* hyperlink = CreateHyperlink( m_scrolledWindow1, + contributor->GetEMail() ); fgSizer1->Add( hyperlink, 0, wxALIGN_LEFT|wxBOTTOM, 2 ); } - else { - fgSizer1->AddSpacer(5); + else + { + fgSizer1->AddSpacer( 5 ); } } @@ -241,66 +291,75 @@ void dialog_about::CreateNotebookPageByCategory(wxAuiNotebook* parent, const wxS m_scrolledWindow1->SetSizer( bSizer ); m_scrolledWindow1->Layout(); bSizer->Fit( m_scrolledWindow1 ); - parent->AddPage( m_scrolledWindow1, caption, false, icon ); } -void dialog_about::CreateNotebookHtmlPage(wxAuiNotebook* parent, const wxString& caption, const wxBitmap& icon, const wxString& html) + +void dialog_about::CreateNotebookHtmlPage( wxAuiNotebook* parent, const wxString& caption, + const wxBitmap& icon, const wxString& html ) { - wxPanel* panel = new wxPanel( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxPanel* panel = new wxPanel( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, + wxTAB_TRAVERSAL ); wxBoxSizer* bSizer = new wxBoxSizer( wxVERTICAL ); wxString htmlPage = wxEmptyString, htmlContent = html; - // to have a unique look background color for HTML pages is set to the default as it is used for all the other widgets + // to have a unique look background color for HTML pages is set to the default as it is + // used for all the other widgets wxString htmlColor = ( this->GetBackgroundColour() ).GetAsString( wxC2S_HTML_SYNTAX ); // beginning of html structure - htmlPage.Append( wxT("") ); + htmlPage.Append( wxT( "" ) ); htmlPage.Append( htmlContent ); // end of html structure indicated by closing tags - htmlPage.Append( wxT("") ); + htmlPage.Append( wxT( "" ) ); // the html page is going to be created with previously created html content - wxHtmlWindow* htmlWindow = new wxHtmlWindow( panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO|wxHW_NO_SELECTION ); + wxHtmlWindow* htmlWindow = new wxHtmlWindow( panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, + wxHW_SCROLLBAR_AUTO|wxHW_NO_SELECTION ); - // HTML font set to font properties as they are used for widgets to have an unique look under different platforms with HTML + // HTML font set to font properties as they are used for widgets to have an unique look + // under different platforms with HTML wxFont font = this->GetFont(); htmlWindow->SetStandardFonts( font.GetPointSize(), font.GetFaceName(), font.GetFaceName() ); htmlWindow->SetPage( htmlPage ); - // the HTML window shall not be used to open external links, thus this task is delegated to users default browser - htmlWindow->Connect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( dialog_about::OnHtmlLinkClicked ), NULL, this ); + // the HTML window shall not be used to open external links, thus this task is delegated + // to users default browser + htmlWindow->Connect( wxEVT_COMMAND_HTML_LINK_CLICKED, + wxHtmlLinkEventHandler( dialog_about::OnHtmlLinkClicked ), NULL, this ); // no additional space around the html window as it is also the case by the other notebook pages bSizer->Add( htmlWindow, 1, wxALL|wxEXPAND, 0 ); panel->SetSizer( bSizer ); panel->Layout(); bSizer->Fit( panel ); - parent->AddPage( panel, caption, false, icon ); } + wxHyperlinkCtrl* dialog_about::CreateHyperlink(wxScrolledWindow* parent, const wxString& email) { wxHyperlinkCtrl* hyperlink = new wxHyperlinkCtrl( parent, wxID_ANY, - wxT("<") + email + wxT(">"), /* the label */ - wxT("mailto:") + email - + wxT("?subject=KiCad - ") + wxT( "<" ) + email + wxT( ">" ), /* the label */ + wxT( "mailto:" ) + email + + wxT( "?subject=KiCad - " ) + info.GetBuildVersion() - + wxT( " , ") + info.GetLibVersion() + + wxT( " , " ) + info.GetLibVersion() ); /* the url */ return hyperlink; } + wxStaticBitmap* dialog_about::CreateStaticBitmap(wxScrolledWindow* parent, wxBitmap* icon) { - wxStaticBitmap* bitmap = new wxStaticBitmap( parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + wxStaticBitmap* bitmap = new wxStaticBitmap( parent, wxID_ANY, wxNullBitmap, + wxDefaultPosition, wxDefaultSize, 0 ); if( icon ) { @@ -310,23 +369,27 @@ wxStaticBitmap* dialog_about::CreateStaticBitmap(wxScrolledWindow* parent, wxBit { bitmap->SetBitmap( KiBitmap( right_xpm ) ); } + return bitmap; } + /////////////////////////////////////////////////////////////////////////////// /// Event handlers /////////////////////////////////////////////////////////////////////////////// -void dialog_about::OnClose(wxCloseEvent &event) +void dialog_about::OnClose( wxCloseEvent &event ) { Destroy(); } -void dialog_about::OnOkClick(wxCommandEvent &event) + +void dialog_about::OnOkClick( wxCommandEvent &event ) { Destroy(); } + void dialog_about::OnHtmlLinkClicked( wxHtmlLinkEvent& event ) { ::wxLaunchDefaultBrowser( event.GetLinkInfo().GetHref() ); diff --git a/common/dialog_about/dialog_about.h b/common/dialog_about/dialog_about.h index 651d3e64c0..91db074d13 100644 --- a/common/dialog_about/dialog_about.h +++ b/common/dialog_about/dialog_about.h @@ -1,11 +1,26 @@ -/*************************************************************** - * 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 + * 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 diff --git a/common/eda_dde.cpp b/common/eda_dde.cpp index b00cc11cad..92f965d3ce 100644 --- a/common/eda_dde.cpp +++ b/common/eda_dde.cpp @@ -1,3 +1,27 @@ +/* + * 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 */ diff --git a/common/eda_doc.cpp b/common/eda_doc.cpp index 717002e000..8431d75d4c 100644 --- a/common/eda_doc.cpp +++ b/common/eda_doc.cpp @@ -1,3 +1,27 @@ +/* + * 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 */ diff --git a/common/geometry/hetriang.cpp b/common/geometry/hetriang.cpp index 2172413966..d1e7fd0254 100644 --- a/common/geometry/hetriang.cpp +++ b/common/geometry/hetriang.cpp @@ -4,21 +4,21 @@ * Copyright (C) 2013 CERN * @author Maciej Suminski * - * 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 @@ -636,7 +636,7 @@ EDGE_PTR TRIANGULATION::GetInteriorNode() const { const std::list& leadingEdges = GetLeadingEdges(); std::list::const_iterator it; - + for( it = leadingEdges.begin(); it != leadingEdges.end(); ++it ) { EDGE_PTR edge = *it; diff --git a/common/html_messagebox.cpp b/common/html_messagebox.cpp index 25532fb1e8..56c9116209 100644 --- a/common/html_messagebox.cpp +++ b/common/html_messagebox.cpp @@ -1,3 +1,27 @@ +/* + * 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 #include #include diff --git a/common/lockfile.cpp b/common/lockfile.cpp index b3733e611e..ae0151211d 100644 --- a/common/lockfile.cpp +++ b/common/lockfile.cpp @@ -1,4 +1,26 @@ - +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck + * 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 #include diff --git a/common/prependpath.cpp b/common/prependpath.cpp index a7c80f6c69..258c74ddbf 100644 --- a/common/prependpath.cpp +++ b/common/prependpath.cpp @@ -1,3 +1,27 @@ +/* + * 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 + * + * 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 #include diff --git a/common/search_stack.cpp b/common/search_stack.cpp index e4cc11e572..e497b89099 100644 --- a/common/search_stack.cpp +++ b/common/search_stack.cpp @@ -1,3 +1,26 @@ +/* + * 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 #include @@ -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 diff --git a/common/searchhelpfilefullpath.cpp b/common/searchhelpfilefullpath.cpp index f41811323e..79e48fd665 100644 --- a/common/searchhelpfilefullpath.cpp +++ b/common/searchhelpfilefullpath.cpp @@ -1,9 +1,32 @@ +/* + * 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 + * + * 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 #include - /** * Function FindFileInSearchPaths * looks in "this" for \a aFilename, but first modifies every search diff --git a/common/selcolor.cpp b/common/selcolor.cpp index 9bbe557adb..ebcaad2a0f 100644 --- a/common/selcolor.cpp +++ b/common/selcolor.cpp @@ -1,6 +1,27 @@ -/****************/ -/* 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; } diff --git a/common/systemdirsappend.cpp b/common/systemdirsappend.cpp index 3ea88ad255..3cd1894258 100644 --- a/common/systemdirsappend.cpp +++ b/common/systemdirsappend.cpp @@ -1,3 +1,27 @@ +/* + * 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 + * + * 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 diff --git a/common/trigo.cpp b/common/trigo.cpp index 96d29d17c9..f814fd727d 100644 --- a/common/trigo.cpp +++ b/common/trigo.cpp @@ -1,3 +1,27 @@ +/* + * 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; } } - diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h index e1900baff3..0cbc76b3b3 100644 --- a/include/class_colors_design_settings.h +++ b/include/class_colors_design_settings.h @@ -1,3 +1,27 @@ +/* + * 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. diff --git a/include/plot_common.h b/include/plot_common.h index b6793962df..333953da48 100644 --- a/include/plot_common.h +++ b/include/plot_common.h @@ -1,3 +1,27 @@ +/* + * 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::iterator @@ -847,6 +965,9 @@ protected: FILE* finalFile; wxString m_workFilename; + /** + * Generate the table of D codes + */ void writeApertureList(); std::vector apertures;