From f5fd471dd95cf6b4d24c4c89aea22eeb2470bbe8 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 13 Nov 2014 09:00:28 +0100 Subject: [PATCH 01/12] Pcbnew: fix Bug #1392087 ( adhesive layer plot broken ). --- pcbnew/plot_board_layers.cpp | 41 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 865418f556..1efcd8ad06 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -198,6 +198,8 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_ID aLayer, break; + case B_Adhes: + case F_Adhes: case B_Paste: case F_Paste: plotOpt.SetSkipPlotNPTH_Pads( false ); @@ -237,9 +239,28 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_ID aLayer, } break; - default: + // These layers are plotted like silk screen layers. + // Mainly, pads on these layers are not filled. + // This is not necessary the best choice. + case Dwgs_User: + case Cmts_User: + case Eco1_User: + case Eco2_User: + case Edge_Cuts: + case Margin: + case F_CrtYd: + case B_CrtYd: + case F_Fab: + case B_Fab: PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt ); break; + + default: + if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) + PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); + else + PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt ); + break; } } } @@ -306,23 +327,6 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, if( ( aLayerMask & LSET::AllCuMask() ).any() ) width_adj = itemplotter.getFineWidthAdj(); -#if 0 // was: - switch( aLayerMask & - ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT | - SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT ) ) - { - case SOLDERMASK_LAYER_FRONT: - case SOLDERMASK_LAYER_BACK: - break; - - case SOLDERPASTE_LAYER_FRONT: - case SOLDERPASTE_LAYER_BACK: - break; - - default: - break; - } -#else static const LSET speed( 4, B_Mask, F_Mask, B_Paste, F_Paste ); LSET anded = ( speed & aLayerMask ); @@ -335,7 +339,6 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, { margin = pad->GetSolderPasteMargin(); } -#endif wxSize padPlotsSize; padPlotsSize.x = pad->GetSize().x + ( 2 * margin.x ) + width_adj; From d84567ae40bf1e4b0d41919b589567c7222c25bf Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 13 Nov 2014 11:06:41 +0100 Subject: [PATCH 02/12] pcbnew: fixes crash when a new part footprint is changed. --- pcbnew/class_board.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index b8db13989a..6bc0154677 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -2506,6 +2506,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, pad->SetNetCode( NETINFO_LIST::UNCONNECTED ); } + m_ratsnest->ProcessBoard(); + // Last step: Some tests: // verify all pads found in netlist: // They should exist in footprints, otherwise the footprint is wrong From d54675b56b8460f6913c728e1c814941e9c412bd Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Nov 2014 12:29:05 +0100 Subject: [PATCH 03/12] Fix bug in IDF export (plus minor cleaning up of IDF/VRML export) --- pcbnew/exporters/export_idf.cpp | 11 +++++++---- utils/idftools/idf_parser.cpp | 3 ++- utils/idftools/vrml_layer.cpp | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pcbnew/exporters/export_idf.cpp b/pcbnew/exporters/export_idf.cpp index d77e20d573..4d6debd5aa 100644 --- a/pcbnew/exporters/export_idf.cpp +++ b/pcbnew/exporters/export_idf.cpp @@ -439,10 +439,13 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, comp->SetPosition( aModule->GetPosition().x * scale + dx, -aModule->GetPosition().y * scale + dy, rotz, IDF3::LYR_TOP ); - else - comp->SetPosition( aModule->GetPosition().x * scale + dx, - -aModule->GetPosition().y * scale + dy, - rotz, IDF3::LYR_BOTTOM ); + else + comp->SetPosition( aModule->GetPosition().x * scale + dx, + -aModule->GetPosition().y * scale + dy, + rotz, IDF3::LYR_BOTTOM ); + + comp->SetPlacement( IDF3::PS_ECAD ); + } else { diff --git a/utils/idftools/idf_parser.cpp b/utils/idftools/idf_parser.cpp index 864f93a5ad..866c417d52 100644 --- a/utils/idftools/idf_parser.cpp +++ b/utils/idftools/idf_parser.cpp @@ -728,7 +728,8 @@ void IDF3_COMP_OUTLINE_DATA::writePlaceData( std::ofstream& aBoardFile, if( aPlacement == PS_INVALID ) { - ERROR_IDF << "placement invalid; defaulting to PLACED\n"; + ERROR_IDF << "placement invalid (" << aRefDes << ":"; + std::cerr << aPlacement << "); defaulting to PLACED\n"; aPlacement = PS_PLACED; } diff --git a/utils/idftools/vrml_layer.cpp b/utils/idftools/vrml_layer.cpp index 2aa1345d13..65188249f7 100644 --- a/utils/idftools/vrml_layer.cpp +++ b/utils/idftools/vrml_layer.cpp @@ -30,7 +30,7 @@ // a closed loop as assumed for all other outlines. // 3. a scheme is needed to tell a castellated edge from a plain board edge -#include + #include #include #include From 1855db54933bf6730a846e97dc3c0bce523f073b Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 13 Nov 2014 14:11:26 +0100 Subject: [PATCH 04/12] pcbnew: Fix persistent multiple items selection box that stays after selecting a polygon/line (GAL). --- pcbnew/tools/point_editor.cpp | 1 + pcbnew/tools/selection_tool.cpp | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp index 8951cb3f25..d409804b26 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -308,6 +308,7 @@ int POINT_EDITOR::OnSelectionChange( TOOL_EVENT& aEvent ) controls->SetAutoPan( false ); setAltConstraint( false ); modified = false; + m_toolMgr->PassEvent(); } else if( evt->IsCancel() ) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 8b6eac6b42..616b1c35fb 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -348,9 +348,6 @@ bool SELECTION_TOOL::selectMultiple() if( evt->IsMouseUp( BUT_LEFT ) ) { - // End drawing the selection box - m_selArea->ViewSetVisible( false ); - // Mark items within the selection box as selected std::vector selectedItems; BOX2I selectionBox = m_selArea->ViewBBox(); @@ -384,6 +381,8 @@ bool SELECTION_TOOL::selectMultiple() } } + // Stop drawing the selection box + m_selArea->ViewSetVisible( false ); view->Remove( m_selArea ); m_multiple = false; // Multiple selection mode is inactive getViewControls()->SetAutoPan( false ); From 1f8b77697fcb11d3f7efdc29c00752c491d513f6 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 13 Nov 2014 16:17:53 +0100 Subject: [PATCH 05/12] gal: Check maximum framebuffer size (OpenGL). --- common/gal/opengl/opengl_compositor.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/common/gal/opengl/opengl_compositor.cpp b/common/gal/opengl/opengl_compositor.cpp index 26b136bbbc..4aa967d960 100644 --- a/common/gal/opengl/opengl_compositor.cpp +++ b/common/gal/opengl/opengl_compositor.cpp @@ -55,7 +55,7 @@ void OPENGL_COMPOSITOR::Initialize() // We need framebuffer objects for drawing the screen contents // Generate framebuffer and a depth buffer glGenFramebuffersEXT( 1, &m_framebuffer ); - glBindFramebufferEXT( GL_FRAMEBUFFER, m_framebuffer ); + glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_framebuffer ); m_currentFbo = m_framebuffer; // Allocate memory for the depth buffer @@ -91,10 +91,12 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer() { wxASSERT( m_initialized ); - unsigned int maxBuffers; + unsigned int maxBuffers, maxWidth, maxHeight; - // Get the maximum number of buffers + // Get the maximum size & number of buffers glGetIntegerv( GL_MAX_COLOR_ATTACHMENTS, (GLint*) &maxBuffers ); + glGetIntegerv( GL_MAX_FRAMEBUFFER_WIDTH, (GLint*) &maxWidth ); + glGetIntegerv( GL_MAX_FRAMEBUFFER_HEIGHT, (GLint*) &maxHeight ); if( usedBuffers() >= maxBuffers ) { @@ -104,6 +106,14 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer() return 0; // Unfortunately we have no more free buffers left } + if( m_width > maxWidth || m_height > maxHeight ) { + DisplayError( NULL, wxString::Format( wxT( "Max handled framebuffer size is %d x %d," + " but %x x %x is required." ), + maxWidth, maxHeight, m_width, m_height ) ); + + return 0; + } + // GL_COLOR_ATTACHMENTn are consecutive integers GLuint attachmentPoint = GL_COLOR_ATTACHMENT0 + usedBuffers(); GLuint textureTarget; From 7de3aa9af2f33e83b30a61f644c766520d3290d0 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 13 Nov 2014 16:30:30 +0100 Subject: [PATCH 06/12] Reverted the last commit, apparently not every GLEW contains required definitions. --- common/gal/opengl/opengl_compositor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/gal/opengl/opengl_compositor.cpp b/common/gal/opengl/opengl_compositor.cpp index 4aa967d960..dd7c84aeb3 100644 --- a/common/gal/opengl/opengl_compositor.cpp +++ b/common/gal/opengl/opengl_compositor.cpp @@ -55,7 +55,7 @@ void OPENGL_COMPOSITOR::Initialize() // We need framebuffer objects for drawing the screen contents // Generate framebuffer and a depth buffer glGenFramebuffersEXT( 1, &m_framebuffer ); - glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_framebuffer ); + glBindFramebufferEXT( GL_FRAMEBUFFER, m_framebuffer ); m_currentFbo = m_framebuffer; // Allocate memory for the depth buffer From 90c7c72d817721972e16cc796838219f10e1276f Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 13 Nov 2014 16:37:15 +0100 Subject: [PATCH 07/12] Reverted missing changes. --- common/gal/opengl/opengl_compositor.cpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/common/gal/opengl/opengl_compositor.cpp b/common/gal/opengl/opengl_compositor.cpp index dd7c84aeb3..26b136bbbc 100644 --- a/common/gal/opengl/opengl_compositor.cpp +++ b/common/gal/opengl/opengl_compositor.cpp @@ -91,12 +91,10 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer() { wxASSERT( m_initialized ); - unsigned int maxBuffers, maxWidth, maxHeight; + unsigned int maxBuffers; - // Get the maximum size & number of buffers + // Get the maximum number of buffers glGetIntegerv( GL_MAX_COLOR_ATTACHMENTS, (GLint*) &maxBuffers ); - glGetIntegerv( GL_MAX_FRAMEBUFFER_WIDTH, (GLint*) &maxWidth ); - glGetIntegerv( GL_MAX_FRAMEBUFFER_HEIGHT, (GLint*) &maxHeight ); if( usedBuffers() >= maxBuffers ) { @@ -106,14 +104,6 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer() return 0; // Unfortunately we have no more free buffers left } - if( m_width > maxWidth || m_height > maxHeight ) { - DisplayError( NULL, wxString::Format( wxT( "Max handled framebuffer size is %d x %d," - " but %x x %x is required." ), - maxWidth, maxHeight, m_width, m_height ) ); - - return 0; - } - // GL_COLOR_ATTACHMENTn are consecutive integers GLuint attachmentPoint = GL_COLOR_ATTACHMENT0 + usedBuffers(); GLuint textureTarget; From 4eabe23104aa4a487c91f41046240d1a115cc584 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 13 Nov 2014 16:58:24 +0100 Subject: [PATCH 08/12] pcbnew: Allows selecting module edges in module editor, when they are covered with other items (GAL). --- pcbnew/tools/selection_tool.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 616b1c35fb..3ee9968fb4 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -252,7 +252,8 @@ bool SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere, bool aAllowDisambigua GENERAL_COLLECTOR collector; // Preferred types (they have the priority when if they are covered by a bigger item) - const KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, PCB_LINE_T, PCB_MODULE_TEXT_T, EOT }; + const KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, PCB_LINE_T, + PCB_MODULE_EDGE_T, PCB_MODULE_TEXT_T, EOT }; if( m_editModules ) collector.Collect( getModel(), GENERAL_COLLECTOR::ModuleItems, From 15aa24afe8bc8cf6f8f7cf38bbc200f0ed74c932 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 13 Nov 2014 17:32:59 +0100 Subject: [PATCH 09/12] pcbnew: Modules can be selected with block selection tool without including texts & references (GAL). --- pcbnew/class_module.cpp | 6 ++++++ pcbnew/class_module.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 7bf8af178f..d564b3f639 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -863,6 +863,12 @@ unsigned int MODULE::ViewGetLOD( int aLayer ) const return 30; } +const BOX2I MODULE::ViewBBox() const +{ + EDA_RECT fpRect = GetFootprintRect(); + + return BOX2I( VECTOR2I( fpRect.GetOrigin() ), VECTOR2I( fpRect.GetSize() ) ); +} /* Test for validity of the name in a library of the footprint * ( no spaces, dir separators ... ) diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 27b87ab889..a34e610784 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -491,6 +491,9 @@ public: /// @copydoc VIEW_ITEM::ViewGetLOD() virtual unsigned int ViewGetLOD( int aLayer ) const; + /// @copydoc VIEW_ITEM::ViewBBox() + virtual const BOX2I ViewBBox() const; + /** * Function CopyNetlistSettings * copies the netlist settings to \a aModule. From 35c591166f0357e714ff1ae28488a907a0d89012 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 14 Nov 2014 08:25:17 +0100 Subject: [PATCH 10/12] Pcbnew: fix Bug #1391561 (PCBNew segfaults on BOM creation). Does not happen on all platforms. Could be due to use of data just previoulsy deleted. Very minor other changes. --- pcbnew/build_BOM_from_board.cpp | 10 ++++++---- pcbnew/plot_board_layers.cpp | 15 ++++++++++++--- pcbnew/tool_pcb.cpp | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/pcbnew/build_BOM_from_board.cpp b/pcbnew/build_BOM_from_board.cpp index 3813ff36ea..6a7c2e71fe 100644 --- a/pcbnew/build_BOM_from_board.cpp +++ b/pcbnew/build_BOM_from_board.cpp @@ -163,20 +163,22 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent ) module = module->Next(); } - // Print list - for( iter = list.begin(); iter != list.end(); iter++ ) + // Print list. Also delete temporary created objects. + for( size_t ii = list.GetCount(); ii > 0; ii-- ) { - cmp* current = *iter; + cmp* current = *list.begin(); // Because the first object will be removed + // from list, all objects will be get here msg.Empty(); msg << current->m_Id << wxT( ";\"" ); msg << current->m_Ref << wxT( "\";\"" ); - msg << FROM_UTF8( current->m_fpid.Format().c_str() ) << wxT( "\";" ); + msg << FROM_UTF8( current->m_fpid.GetFootprintName().c_str() ) << wxT( "\";" ); msg << current->m_CmpCount << wxT( ";\"" ); msg << current->m_Val << wxT( "\";;;\n" ); fprintf( fp_bom, "%s", TO_UTF8( msg ) ); + // We do not need this object, now: remove it from list and delete it list.DeleteObject( current ); delete (current); } diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 1efcd8ad06..8e412f50f3 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -252,15 +252,24 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_ID aLayer, case B_CrtYd: case F_Fab: case B_Fab: - PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt ); - break; + plotOpt.SetSkipPlotNPTH_Pads( false ); + plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); - default: if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); else PlotSilkScreen( aBoard, aPlotter, layer_mask, plotOpt ); break; + + default: + plotOpt.SetSkipPlotNPTH_Pads( false ); + plotOpt.SetDrillMarksType( PCB_PLOT_PARAMS::NO_DRILL_SHAPE ); + + if( plotOpt.GetFormat() == PLOT_FORMAT_DXF ) + PlotLayerOutlines( aBoard, aPlotter, layer_mask, plotOpt ); + else + PlotStandardLayer( aBoard, aPlotter, layer_mask, plotOpt ); + break; } } } diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 4ec9569bef..6b02f5a597 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -306,7 +306,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() m_mainToolBar->AddSeparator(); m_mainToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString, KiBitmap( web_support_xpm ), - _( "Fast access to the Web Based FreeROUTE advanced router" ) ); + _( "Fast access to the FreeROUTE external advanced router" ) ); // Access to the scripting console #if defined(KICAD_SCRIPTING_WXPYTHON) From 030e4795f028c9ec7941b2890849c98bbab561b1 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Fri, 14 Nov 2014 09:30:52 +0100 Subject: [PATCH 11/12] Added an additional search path for GLEW (closing bug report 1247910). --- CMakeModules/FindGLEW.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeModules/FindGLEW.cmake b/CMakeModules/FindGLEW.cmake index 3517571134..621fe3b3f4 100644 --- a/CMakeModules/FindGLEW.cmake +++ b/CMakeModules/FindGLEW.cmake @@ -33,6 +33,7 @@ IF (WIN32) NAMES glew glew32 glew32s PATHS $ENV{GLEW_ROOT_PATH}/lib + $ENV{GLEW_ROOT_PATH}/lib/Release/Win32 ${OPENGL_LIBRARY_DIR} ) From 32eb568ec4d243c5c67c4e7ad9776119f8b95416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nick=20=C3=98stergaard?= Date: Fri, 14 Nov 2014 11:09:07 -0500 Subject: [PATCH 12/12] Pcbnew place track menu entry hot key text fix. --- pcbnew/menubar_pcbframe.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 1f699fcc13..52ef537574 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -370,7 +370,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() _( "Add footprints" ), KiBitmap( module_xpm ) ); text = AddHotkeyName( _( "&Track" ), g_Pcbnew_Editor_Hokeys_Descr, - HK_ADD_NEW_TRACK, IS_COMMENT ); + HK_ADD_NEW_TRACK ); AddMenuItem( placeMenu, ID_TRACK_BUTT, text, _( "Add tracks and vias" ), KiBitmap( add_tracks_xpm ) ); @@ -381,8 +381,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() _( "&Keepout Area" ), _( "Add keepout areas" ), KiBitmap( add_keepout_area_xpm ) ); AddMenuItem( placeMenu, ID_PCB_ADD_TEXT_BUTT, - _( "Te&xt" ), _( "Add text on copper layers or graphic text" ), - KiBitmap( add_text_xpm ) ); + _( "Te&xt" ), _( "Add text on copper layers or graphic text" ), + KiBitmap( add_text_xpm ) ); AddMenuItem( placeMenu, ID_PCB_ARC_BUTT, _( "&Arc" ), _( "Add graphic arc" ),KiBitmap( add_arc_xpm ) );