From 10352b1df5087de21a0b548e20755803c60c755a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 27 Jun 2013 21:12:01 +0200 Subject: [PATCH] Minor fixes. Gerbview: fix a collision name for GetLayout method. --- common/page_layout_default_description.cpp | 18 +++--- eeschema/dialogs/dialog_lib_edit_pin_base.cpp | 15 +++-- eeschema/dialogs/dialog_lib_edit_pin_base.fbp | 6 +- eeschema/dialogs/dialog_lib_edit_pin_base.h | 6 +- eeschema/lib_pin.cpp | 3 +- gerbview/class_GERBER.cpp | 6 +- gerbview/class_gbr_layout.h | 1 - gerbview/class_gbr_screen.cpp | 9 +-- gerbview/draw_gerber_screen.cpp | 12 ++-- gerbview/excellon_read_drill_file.cpp | 4 +- gerbview/gerbview_frame.cpp | 56 +++++++++---------- gerbview/gerbview_frame.h | 20 +++---- gerbview/initpcb.cpp | 12 ++-- gerbview/onleftclick.cpp | 4 -- gerbview/pcbplot.cpp | 5 -- gerbview/rs274d.cpp | 36 ++++++++++-- pcbnew/class_pad.h | 5 +- pcbnew/class_pad_draw_functions.cpp | 20 +++---- pcbnew/printout_controler.cpp | 2 +- template/pagelayout.kicad_wks | 18 +++--- template/pagelayout_logo.kicad_wks | 24 ++++---- 21 files changed, 151 insertions(+), 131 deletions(-) diff --git a/common/page_layout_default_description.cpp b/common/page_layout_default_description.cpp index 26a1b7a842..faced42fea 100644 --- a/common/page_layout_default_description.cpp +++ b/common/page_layout_default_description.cpp @@ -165,7 +165,7 @@ extern const char defaultPageLayout[]; // Default page layout (sizes are in mm) const char defaultPageLayout[] = "( page_layout\n" "(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15) )" - "(rect (comment rect around the title block) (linewidth 0.15) (start 110 34) (end 2 2) )\n" + "(rect (comment \"rect around the title block\") (linewidth 0.15) (start 110 34) (end 2 2) )\n" "(rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )\n" "(line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )\n" "(tbtext \"1\" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) )\n" @@ -177,21 +177,21 @@ const char defaultPageLayout[] = "( page_layout\n" "(tbtext \"A\" (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50) )\n" "(tbtext \"Date: %D\" (pos 87 6.9) )\n" "(line (start 110 5.5) end 2 5.5) )\n" - "(tbtext \"%K\" (pos 109 4.1) (comment Kicad version ) )\n" + "(tbtext \"%K\" (pos 109 4.1) (comment \"Kicad version\" ) )\n" "(line (start 110 8.5) end 2 8.5) )\n" "(tbtext \"Rev: %R\" (pos 24 6.9)(font bold)(justify left) )\n" - "(tbtext \"Size: %Z\" (comment Paper format name)(pos 109 6.9) )\n" - "(tbtext \"Id: %S/%N\" (comment Sheet id)(pos 24 4.1) )\n" + "(tbtext \"Size: %Z\" (comment \"Paper format name\")(pos 109 6.9) )\n" + "(tbtext \"Id: %S/%N\" (comment \"Sheet id\")(pos 24 4.1) )\n" "(line (start 110 12.5) end 2 12.5) )\n" "(tbtext \"Title: %T\" (pos 109 10.7)(font bold italic (size 2 2)) )\n" "(tbtext \"File: %F\" (pos 109 14.3) )\n" "(line (start 110 18.5) end 2 18.5) )\n" "(tbtext \"Sheet: %P\" (pos 109 17) )\n" - "(tbtext \"%Y\" (comment Company name) (pos 109 20)(font bold) )\n" - "(tbtext \"%C0\" (comment Comment 0) (pos 109 23) )\n" - "(tbtext \"%C1\" (comment Comment 0) (pos 109 26) )\n" - "(tbtext \"%C2\" (comment Comment 0) (pos 109 29) )\n" - "(tbtext \"%C3\" (comment Comment 0) (pos 109 32) )\n" + "(tbtext \"%Y\" (comment \"Company name\") (pos 109 20)(font bold) )\n" + "(tbtext \"%C0\" (comment \"Comment 0\") (pos 109 23) )\n" + "(tbtext \"%C1\" (comment \"Comment 1\") (pos 109 26) )\n" + "(tbtext \"%C2\" (comment \"Comment 2\") (pos 109 29) )\n" + "(tbtext \"%C3\" (comment \"Comment 3\") (pos 109 32) )\n" "(line (start 90 8.5) end 90 5.5) )\n" "(line (start 26 8.5) end 26 2) )\n" ")\n" diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.cpp b/eeschema/dialogs/dialog_lib_edit_pin_base.cpp index 42149d5a3b..e1990a9407 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_base.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_base.cpp @@ -1,10 +1,12 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 11 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// +#include "wx/bmpcbox.h" + #include "dialog_lib_edit_pin_base.h" /////////////////////////////////////////////////////////////////////////// @@ -33,6 +35,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID fgSizerPins->Add( m_staticTextPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_textPinName = new wxTextCtrl( this, ID_M_TEXTPINNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textPinName->SetMaxLength( 0 ); fgSizerPins->Add( m_textPinName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); m_staticTextPadName = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -42,13 +45,14 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID fgSizerPins->Add( m_staticTextPadName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_textPadName = new wxTextCtrl( this, ID_M_TEXTPADNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textPadName->SetMaxLength( 0 ); fgSizerPins->Add( m_textPadName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextOrient->Wrap( -1 ); fgSizerPins->Add( m_staticTextOrient, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); - m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); fgSizerPins->Add( m_choiceOrientation, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_staticTextEType = new wxStaticText( this, wxID_ANY, _("&Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -57,14 +61,14 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID fgSizerPins->Add( m_staticTextEType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); - m_choiceElectricalType = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + m_choiceElectricalType = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); fgSizerPins->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic &Style:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGstyle->Wrap( -1 ); fgSizerPins->Add( m_staticTextGstyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); - m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); fgSizerPins->Add( m_choiceStyle, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); @@ -115,6 +119,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID fgSizerTextsSizes->Add( m_staticTextNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_textPinNameTextSize = new wxTextCtrl( this, ID_M_TEXTPINNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textPinNameTextSize->SetMaxLength( 0 ); fgSizerTextsSizes->Add( m_textPinNameTextSize, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 ); m_staticNameTextSizeUnits = new wxStaticText( this, ID_M_STATICNAMETEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -126,6 +131,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID fgSizerTextsSizes->Add( m_staticTextPadNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); m_textPadNameTextSize = new wxTextCtrl( this, ID_M_TEXTPADNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textPadNameTextSize->SetMaxLength( 0 ); fgSizerTextsSizes->Add( m_textPadNameTextSize, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxEXPAND, 3 ); m_staticNumberTextSizeUnits = new wxStaticText( this, ID_M_STATICNUMBERTEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -137,6 +143,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID fgSizerTextsSizes->Add( m_staticTextPinLen, 0, wxALL, 5 ); m_textLength = new wxTextCtrl( this, ID_M_TEXTLENGTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_textLength->SetMaxLength( 0 ); fgSizerTextsSizes->Add( m_textLength, 0, wxTOP|wxBOTTOM|wxEXPAND, 5 ); m_staticLengthUnits = new wxStaticText( this, ID_M_STATICLENGTHUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.fbp b/eeschema/dialogs/dialog_lib_edit_pin_base.fbp index 58a8dd5367..268c5d0722 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_base.fbp +++ b/eeschema/dialogs/dialog_lib_edit_pin_base.fbp @@ -607,7 +607,7 @@ -1 1 - + wxCB_READONLY wxBitmapComboBox; wx/bmpcbox.h 0 @@ -781,7 +781,7 @@ -1 1 - + wxCB_READONLY wxBitmapComboBox; wx/bmpcbox.h 0 @@ -955,7 +955,7 @@ -1 1 - + wxCB_READONLY wxBitmapComboBox; wx/bmpcbox.h 0 diff --git a/eeschema/dialogs/dialog_lib_edit_pin_base.h b/eeschema/dialogs/dialog_lib_edit_pin_base.h index a48e0a5faa..191b055471 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_base.h +++ b/eeschema/dialogs/dialog_lib_edit_pin_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 11 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,7 +11,9 @@ #include #include #include -#include "wx/bmpcbox.h" +class DIALOG_SHIM; +class wxBitmapComboBox; + #include "dialog_shim.h" #include #include diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index f5b982fe2e..374717b83b 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -311,7 +311,8 @@ void LIB_PIN::SetOrientation( int orientation ) for( size_t i = 0; i < pinList.size(); i++ ) { - if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_orientation == orientation ) + if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || + pinList[i]->m_orientation == orientation ) continue; pinList[i]->m_orientation = orientation; diff --git a/gerbview/class_GERBER.cpp b/gerbview/class_GERBER.cpp index c4178640e3..9d7b7302ea 100644 --- a/gerbview/class_GERBER.cpp +++ b/gerbview/class_GERBER.cpp @@ -6,8 +6,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2010 - * Copyright (C) 1992-2010 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2013 Jean-Pierre Charras jp.charras at wanadoo.fr + * Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -308,7 +308,7 @@ void GERBER_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem ) move_vector.y = scaletoIU( jj * GetLayerParams().m_StepForRepeat.y, GetLayerParams().m_StepForRepeatMetric ); dupItem->MoveXY( move_vector ); - m_Parent->GetLayout()->m_Drawings.Append( dupItem ); + m_Parent->GetGerberLayout()->m_Drawings.Append( dupItem ); } } } diff --git a/gerbview/class_gbr_layout.h b/gerbview/class_gbr_layout.h index ea16415dff..c192fff890 100644 --- a/gerbview/class_gbr_layout.h +++ b/gerbview/class_gbr_layout.h @@ -9,7 +9,6 @@ #include -// #include #include #include // PAGE_INFO #include diff --git a/gerbview/class_gbr_screen.cpp b/gerbview/class_gbr_screen.cpp index 1deff7c3cf..aaf96275ff 100644 --- a/gerbview/class_gbr_screen.cpp +++ b/gerbview/class_gbr_screen.cpp @@ -7,13 +7,7 @@ #include #include #include - -#include -#include -#include - -#include - +#include #define DMIL_GRID( x ) wxRealPoint( x * IU_PER_DECIMILS,\ x * IU_PER_DECIMILS ) @@ -23,7 +17,6 @@ /** Default GerbView zoom values. - Limited to 19 values to keep a decent size to menus. Roughly a 1.5 progression. */ static const double gbrZoomList[] = diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index a05940b672..24b03fbd83 100644 --- a/gerbview/draw_gerber_screen.cpp +++ b/gerbview/draw_gerber_screen.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2013 Jean-Pierre Charras, jpierre.charras at wanadoo + * Copyright (C) 2013 Wayne Stambaugh + * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.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 @@ -59,7 +59,7 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer, m_canvas->SetPrintMirrored( aPrintMirrorMode ); // XXX -1 as drawmode? - GetLayout()->Draw( m_canvas, aDC, UNSPECIFIED_DRAWMODE, wxPoint( 0, 0 ) ); + GetGerberLayout()->Draw( m_canvas, aDC, UNSPECIFIED_DRAWMODE, wxPoint( 0, 0 ) ); m_canvas->SetPrintMirrored( false ); @@ -73,7 +73,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) { GBR_SCREEN* screen = (GBR_SCREEN*) GetScreen(); - if( !GetLayout() ) + if( !GetGerberLayout() ) return; wxBusyCursor dummy; @@ -96,7 +96,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) } // Draw according to the current setting. This needs to be GR_COPY or GR_OR. - GetLayout()->Draw( m_canvas, DC, drawMode, wxPoint( 0, 0 ) ); + GetGerberLayout()->Draw( m_canvas, DC, drawMode, wxPoint( 0, 0 ) ); // Draw the "background" now, i.e. grid and axis after gerber layers // because most of time the actual background is erased by successive drawings of each gerber diff --git a/gerbview/excellon_read_drill_file.cpp b/gerbview/excellon_read_drill_file.cpp index 2057432fae..e06f59f07b 100644 --- a/gerbview/excellon_read_drill_file.cpp +++ b/gerbview/excellon_read_drill_file.cpp @@ -487,8 +487,8 @@ bool EXCELLON_IMAGE::Execute_Drill_Command( char*& text ) ReportMessage( msg ); return false; } - gbritem = new GERBER_DRAW_ITEM( GetParent()->GetLayout(), this ); - GetParent()->GetLayout()->m_Drawings.Append( gbritem ); + gbritem = new GERBER_DRAW_ITEM( GetParent()->GetGerberLayout(), this ); + GetParent()->GetGerberLayout()->m_Drawings.Append( gbritem ); if( m_SlotOn ) // Oval hole { fillLineGBRITEM( gbritem, diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 550931d7f4..40580a1c84 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -70,7 +70,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* aParent, const wxString& aTitle, aStyle, GERBVIEW_FRAME_NAME ) { m_colorsSettings = &g_ColorsSettings; - m_Layout = NULL; + m_gerberLayout = NULL; m_FrameName = GERBVIEW_FRAME_NAME; m_show_layer_manager_tools = true; @@ -95,7 +95,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* aParent, const wxString& aTitle, SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible. - SetScreen( new GBR_SCREEN( GetLayout()->GetPageSettings().GetSizeIU() ) ); + SetScreen( new GBR_SCREEN( GetGerberLayout()->GetPageSettings().GetSizeIU() ) ); // Create the PCB_LAYER_WIDGET *after* SetLayout(): wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); @@ -112,10 +112,10 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* aParent, const wxString& aTitle, LoadSettings(); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); - if( m_LastGridSizeId < ID_POPUP_GRID_LEVEL_1000 ) - m_LastGridSizeId = m_LastGridSizeId; - if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_0_1MM ) - m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_0_1MM; + if( m_LastGridSizeId < 0 ) + m_LastGridSizeId = 0; + if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000 ) + m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000; GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); ReCreateMenuBar(); @@ -184,13 +184,13 @@ void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event ) double GERBVIEW_FRAME::BestZoom() { - GERBER_DRAW_ITEM* item = GetLayout()->m_Drawings; + GERBER_DRAW_ITEM* item = GetGerberLayout()->m_Drawings; // gives a minimal value to zoom, if no item in list if( item == NULL ) return ZOOM_FACTOR( 350.0 ); - EDA_RECT bbox = GetLayout()->ComputeBoundingBox(); + EDA_RECT bbox = GetGerberLayout()->ComputeBoundingBox(); wxSize size = m_canvas->GetClientSize(); @@ -552,7 +552,7 @@ LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const */ void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask ) { - GetLayout()->SetVisibleLayers( aLayerMask ); + GetGerberLayout()->SetVisibleLayers( aLayerMask ); } @@ -567,7 +567,7 @@ bool GERBVIEW_FRAME::IsLayerVisible( LAYER_NUM aLayer ) const if( ! m_DisplayOptions.m_IsPrinting ) return m_LayersManager->IsLayerVisible( aLayer ); else - return GetLayout()->IsLayerVisible( aLayer ); + return GetGerberLayout()->IsLayerVisible( aLayer ); } @@ -693,8 +693,8 @@ void GERBVIEW_FRAME::setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings ) { - wxASSERT( m_Layout ); - m_Layout->SetPageSettings( aPageSettings ); + wxASSERT( m_gerberLayout ); + m_gerberLayout->SetPageSettings( aPageSettings ); if( GetScreen() ) GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() ); @@ -703,47 +703,47 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings ) const PAGE_INFO& GERBVIEW_FRAME::GetPageSettings() const { - wxASSERT( m_Layout ); - return m_Layout->GetPageSettings(); + wxASSERT( m_gerberLayout ); + return m_gerberLayout->GetPageSettings(); } const wxSize GERBVIEW_FRAME::GetPageSizeIU() const { - wxASSERT( m_Layout ); + wxASSERT( m_gerberLayout ); // this function is only needed because EDA_DRAW_FRAME is not compiled // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route // into an application specific source file. - return m_Layout->GetPageSettings().GetSizeIU(); + return m_gerberLayout->GetPageSettings().GetSizeIU(); } const TITLE_BLOCK& GERBVIEW_FRAME::GetTitleBlock() const { - wxASSERT( m_Layout ); - return m_Layout->GetTitleBlock(); + wxASSERT( m_gerberLayout ); + return m_gerberLayout->GetTitleBlock(); } void GERBVIEW_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { - wxASSERT( m_Layout ); - m_Layout->SetTitleBlock( aTitleBlock ); + wxASSERT( m_gerberLayout ); + m_gerberLayout->SetTitleBlock( aTitleBlock ); } const wxPoint& GERBVIEW_FRAME::GetOriginAxisPosition() const { - wxASSERT( m_Layout ); - return m_Layout->GetOriginAxisPosition(); + wxASSERT( m_gerberLayout ); + return m_gerberLayout->GetOriginAxisPosition(); } void GERBVIEW_FRAME::SetOriginAxisPosition( const wxPoint& aPosition ) { - wxASSERT( m_Layout ); - m_Layout->SetOriginAxisPosition( aPosition ); + wxASSERT( m_gerberLayout ); + m_gerberLayout->SetOriginAxisPosition( aPosition ); } @@ -768,13 +768,13 @@ void GERBVIEW_FRAME::SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo ) /* - * Function GetLayoutBoundingBox + * Function GetGerberLayoutBoundingBox * returns the bounding box containing all gerber items. */ -EDA_RECT GERBVIEW_FRAME::GetLayoutBoundingBox() +EDA_RECT GERBVIEW_FRAME::GetGerberLayoutBoundingBox() { - GetLayout()->ComputeBoundingBox(); - return GetLayout()->GetBoundingBox(); + GetGerberLayout()->ComputeBoundingBox(); + return GetGerberLayout()->GetBoundingBox(); } /* diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index ba1f079c9d..d12e00d840 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -82,26 +82,26 @@ public: class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME { - GBR_LAYOUT* m_Layout; + GBR_LAYOUT* m_gerberLayout; public: GBR_DISPLAY_OPTIONS m_DisplayOptions; /** * Function SetLayout - * sets the m_Layout member in such as way as to ensure deleting any previous + * sets the m_gerberLayout member in such as way as to ensure deleting any previous * GBR_LAYOUT. * @param aLayout The GBR_LAYOUT to put into the frame. */ void SetLayout( GBR_LAYOUT* aLayout ) { - delete m_Layout; - m_Layout = aLayout; + delete m_gerberLayout; + m_gerberLayout = aLayout; } - GBR_LAYOUT* GetLayout() const + GBR_LAYOUT* GetGerberLayout() const { - wxASSERT( m_Layout ); - return m_Layout; + wxASSERT( m_gerberLayout ); + return m_gerberLayout; } /** @@ -110,17 +110,17 @@ public: */ GERBER_DRAW_ITEM* GetItemsList() { - GERBER_DRAW_ITEM* item = GetLayout()->m_Drawings; + GERBER_DRAW_ITEM* item = GetGerberLayout()->m_Drawings; return (GERBER_DRAW_ITEM*) item; } /** - * Function GetLayoutBoundingBox + * Function GetGerberLayoutBoundingBox * calculates the bounding box containing all gerber items. * @return EDA_RECT - the items bounding box */ - EDA_RECT GetLayoutBoundingBox(); + EDA_RECT GetGerberLayoutBoundingBox(); void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload const PAGE_INFO& GetPageSettings() const; // overload diff --git a/gerbview/initpcb.cpp b/gerbview/initpcb.cpp index 0efef5b750..1ae5090a3c 100644 --- a/gerbview/initpcb.cpp +++ b/gerbview/initpcb.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.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 @@ -41,7 +41,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) { LAYER_NUM layer; - if( GetLayout() == NULL ) + if( GetGerberLayout() == NULL ) return false; if( query && GetScreen()->IsModify() ) @@ -50,7 +50,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) return false; } - GetLayout()->m_Drawings.DeleteAll(); + GetGerberLayout()->m_Drawings.DeleteAll(); for( layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer ) { @@ -61,7 +61,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) } } - GetLayout()->SetBoundingBox( EDA_RECT() ); + GetGerberLayout()->SetBoundingBox( EDA_RECT() ); SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) ); @@ -84,7 +84,7 @@ void GERBVIEW_FRAME::Erase_Current_Layer( bool query ) SetCurItem( NULL ); - GERBER_DRAW_ITEM* item = GetLayout()->m_Drawings; + GERBER_DRAW_ITEM* item = GetGerberLayout()->m_Drawings; GERBER_DRAW_ITEM * next; for( ; item; item = next ) diff --git a/gerbview/onleftclick.cpp b/gerbview/onleftclick.cpp index 14f818220e..dc73fbac08 100644 --- a/gerbview/onleftclick.cpp +++ b/gerbview/onleftclick.cpp @@ -5,12 +5,8 @@ #include #include #include -//#include "gestfich.h" -//#include "appl_wxstruct.h" #include -//#include "pcbplot.h" -//#include "kicad_device_context.h" #include #include #include diff --git a/gerbview/pcbplot.cpp b/gerbview/pcbplot.cpp index b2f089e096..e13b1de974 100644 --- a/gerbview/pcbplot.cpp +++ b/gerbview/pcbplot.cpp @@ -8,11 +8,6 @@ #include #include - -/**************************************************************/ -/* void PCB_BASE_FRAME::ToPlotter(wxCommandEvent& event) */ -/***************************************************************/ - /** TODO */ void GERBVIEW_FRAME::ToPlotter(wxCommandEvent& event) { diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index f36e634829..838f1a9b39 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -1,6 +1,30 @@ -/********************/ -/**** rs274d.cpp ****/ -/********************/ +/** + * @file rs274d.cpp + * @brief functions to read the rs274d commands from a rs274d/rs274x file + */ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.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 @@ -511,9 +535,9 @@ bool GERBER_IMAGE::Execute_G_Command( char*& text, int G_command ) break; case GC_TURN_OFF_POLY_FILL: - if( m_Exposure && m_Parent->GetLayout()->m_Drawings ) // End of polygon + if( m_Exposure && m_Parent->GetGerberLayout()->m_Drawings ) // End of polygon { - GERBER_DRAW_ITEM * gbritem = m_Parent->GetLayout()->m_Drawings.GetLast(); + GERBER_DRAW_ITEM * gbritem = m_Parent->GetGerberLayout()->m_Drawings.GetLast(); StepAndRepeatItem( *gbritem ); } m_Exposure = false; @@ -542,7 +566,7 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande ) APERTURE_T aperture = APT_CIRCLE; GERBER_DRAW_ITEM* gbritem; - GBR_LAYOUT* layout = m_Parent->GetLayout(); + GBR_LAYOUT* layout = m_Parent->GetGerberLayout(); LAYER_NUM activeLayer = m_Parent->getActiveLayer(); diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index db1ba22ae5..5999c07d5b 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -345,9 +345,12 @@ public: * position. * @param aSegEnd = the ending point of the equivalent segment, relative to the shape position * @param aRotation = full rotation of the segment + * @param aRotation = full rotation of the segment + * @param aMargin = a margin around the shape (for instance mask margin) * @return the width of the segment */ - int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, double aRotation ) const; + int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, + double aRotation, const wxSize& aMargin ) const; void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 1619e599be..7d95403c03 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -340,8 +340,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) GRCircle( aClipBox, aDC, shape_pos.x, shape_pos.y, halfsize.x + aDrawInfo.m_PadClearance, - 0, - aDrawInfo.m_Color ); + 0, aDrawInfo.m_Color ); } break; @@ -349,7 +348,8 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) case PAD_OVAL: { wxPoint segStart, segEnd; - seg_width = BuildSegmentFromOvalShape(segStart, segEnd, angle); + seg_width = BuildSegmentFromOvalShape(segStart, segEnd, angle, + aDrawInfo.m_Mask_margin); segStart += shape_pos; segEnd += shape_pos; @@ -596,27 +596,27 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) * aRotation is the asked rotation of the segment (usually m_Orient) */ int D_PAD::BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd, - double aRotation) const + double aRotation, const wxSize& aMargin) const { int width; if( m_Size.y < m_Size.x ) // Build an horizontal equiv segment { int delta = ( m_Size.x - m_Size.y ) / 2; - aSegStart.x = -delta; + aSegStart.x = -delta - aMargin.x; aSegStart.y = 0; - aSegEnd.x = delta; + aSegEnd.x = delta + aMargin.x; aSegEnd.y = 0; - width = m_Size.y; + width = m_Size.y + ( aMargin.y * 2 ); } else // Vertical oval: build a vertical equiv segment { int delta = ( m_Size.y -m_Size.x ) / 2; aSegStart.x = 0; - aSegStart.y = -delta; + aSegStart.y = -delta - aMargin.y; aSegEnd.x = 0; - aSegEnd.y = delta; - width = m_Size.x; + aSegEnd.y = delta + aMargin.y; + width = m_Size.x + ( aMargin.x * 2 ); } if( aRotation ) diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index 1361e6785d..4376d40ef5 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -168,7 +168,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage() boardBoundingBox = brd->ComputeBoundingBox(); wxString titleblockFilename = brd->GetFileName(); #elif defined (GERBVIEW) - boardBoundingBox = ((GERBVIEW_FRAME*) m_Parent)->GetLayoutBoundingBox(); + boardBoundingBox = ((GERBVIEW_FRAME*) m_Parent)->GetGerberLayoutBoundingBox(); wxString titleblockFilename; // TODO see if we uses the gerber file name #else #error BOARD_PRINTOUT_CONTROLLER::DrawPage() works only for PCBNEW or GERBVIEW diff --git a/template/pagelayout.kicad_wks b/template/pagelayout.kicad_wks index 4a8d16b1ae..60c19735eb 100644 --- a/template/pagelayout.kicad_wks +++ b/template/pagelayout.kicad_wks @@ -1,6 +1,6 @@ ( page_layout ( setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15) ) - ( rect (comment rect around the title block) (linewidth 0.15) (start 110 34) (end 2 2) ) + ( rect (comment "rect around the title block") (linewidth 0.15) (start 110 34) (end 2 2) ) ( rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) ) ( line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) ) ( tbtext "1" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) ) @@ -14,21 +14,21 @@ (justify center) (repeat 100) (incry 50) ) ( tbtext "Date: %D" (pos 87 6.9) ) ( line (start 110 5.5) end 2 5.5) ) - ( tbtext "%K" (pos 109 4.1) (comment Kicad version ) ) + ( tbtext "%K" (pos 109 4.1) (comment "Kicad version" ) ) ( line (start 110 8.5) end 2 8.5) ) ( tbtext "Rev: %R" (pos 24 6.9)(font bold)(justify left) ) - ( tbtext "Size: %Z" (comment Paper format name)(pos 109 6.9) ) - ( tbtext "Id: %S/%N" (comment Sheet id)(pos 24 4.1) ) + ( tbtext "Size: %Z" (comment "Paper format name")(pos 109 6.9) ) + ( tbtext "Id: %S/%N" (comment "Sheet id")(pos 24 4.1) ) ( line (start 110 12.5) end 2 12.5) ) ( tbtext "Title: %T" (pos 109 10.7)(font bold (size 2 2)) ) ( tbtext "File: %F" (pos 109 14.3) ) ( line (start 110 18.5) end 2 18.5) ) ( tbtext "Sheet: %P" (pos 109 17) ) - ( tbtext "%Y" (comment Company name) (pos 109 20)(font bold) ) - ( tbtext "%C0" (comment Comment 0) (pos 109 23) ) - ( tbtext "%C1" (comment Comment 0) (pos 109 26) ) - ( tbtext "%C2" (comment Comment 0) (pos 109 29) ) - ( tbtext "%C3" (comment Comment 0) (pos 109 32) ) + ( tbtext "%Y" (comment "Company name") (pos 109 20)(font bold) ) + ( tbtext "%C0" (comment "Comment 0") (pos 109 23) ) + ( tbtext "%C1" (comment "Comment 1") (pos 109 26) ) + ( tbtext "%C2" (comment "Comment 2") (pos 109 29) ) + ( tbtext "%C3" (comment "Comment 3") (pos 109 32) ) ( line (start 90 8.5) end 90 5.5) ) ( line (start 26 8.5) end 26 2) ) ) diff --git a/template/pagelayout_logo.kicad_wks b/template/pagelayout_logo.kicad_wks index d60250570f..dd710966ec 100644 --- a/template/pagelayout_logo.kicad_wks +++ b/template/pagelayout_logo.kicad_wks @@ -1,6 +1,6 @@ ( page_layout ( setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15) ) - ( rect (comment rect around the title block) (linewidth 0.15) (start 110 34) (end 2 2) ) + ( rect (comment "rect around the title block") (linewidth 0.15) (start 110 34) (end 2 2) ) ( rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) ) ( line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) ) ( tbtext "1" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) ) @@ -14,25 +14,25 @@ (justify center) (repeat 100) (incry 50) ) ( tbtext "Date: %D" (pos 87 6.9) ) ( line (start 110 5.5) end 2 5.5) ) - ( tbtext "%K" (pos 109 4.1) (comment Kicad version ) ) + ( tbtext "%K" (pos 109 4.1) (comment "Kicad version" ) ) ( line (start 110 8.5) end 2 8.5) ) ( tbtext "Rev: %R" (pos 24 6.9)(font bold)(justify left) ) - ( tbtext "Size: %Z" (comment Paper format name)(pos 109 6.9) ) - ( tbtext "Id: %S/%N" (comment Sheet id)(pos 24 4.1) ) + ( tbtext "Size: %Z" (comment "Paper format name")(pos 109 6.9) ) + ( tbtext "Id: %S/%N" (comment "Sheet id")(pos 24 4.1) ) ( line (start 110 12.5) end 2 12.5) ) ( tbtext "Title: %T" (pos 109 10.7)(font bold (size 2 2)) ) ( tbtext "File: %F" (pos 109 14.3) ) ( line (start 110 18.5) end 2 18.5) ) ( tbtext "Sheet: %P" (pos 109 17) ) - ( tbtext "%Y" (comment Company name) (pos 109 20)(font bold) ) - ( tbtext "%C0" (comment Comment 0) (pos 109 23) ) - ( tbtext "%C1" (comment Comment 0) (pos 109 26) ) - ( tbtext "%C2" (comment Comment 0) (pos 109 29) ) - ( tbtext "%C3" (comment Comment 0) (pos 109 32) ) - ( line (start 90 8.5) end 90 5.5) ) - ( line (start 26 8.5) end 26 2) ) + ( tbtext "%Y" (comment "Company name") (pos 109 20)(font bold) ) + ( tbtext "%C0" (comment "Comment 0") (pos 109 23) ) + ( tbtext "%C1" (comment "Comment 1") (pos 109 26) ) + ( tbtext "%C2" (comment "Comment 2") (pos 109 29) ) + ( tbtext "%C3" (comment "Comment 3") (pos 109 32) ) + ( line (start 90 8.5) (end 90 5.5) ) + ( line (start 26 8.5) (end 26 2) ) - ( rect (comment rect around the logo) (linewidth 0.15) (start 157 34) (end 110 2) ) + ( rect (comment "rect around the logo") (linewidth 0.15) (start 157 34) (end 110 2) ) (polygon (pos 134 18 rbcorner) (rotate 20) (linewidth 0.00254) (pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932) (xy 19.71802 5.92328) (xy 19.69262 5.83946) (xy 19.66976 5.72262) (xy 19.65198 5.56006)