diff --git a/common/common_plotPDF_functions.cpp b/common/common_plotPDF_functions.cpp index 09821b902e..4f76a24326 100644 --- a/common/common_plotPDF_functions.cpp +++ b/common/common_plotPDF_functions.cpp @@ -452,7 +452,8 @@ void PDF_PLOTTER::closePdfStream() { wxASSERT( workFile ); - int stream_len = ftell( workFile ); + long stream_len = ftell( workFile ); + wxASSERT( stream_len >= 0 ); // Rewind the file, read in the page stream and DEFLATE it fseek( workFile, 0, SEEK_SET ); @@ -468,7 +469,7 @@ void PDF_PLOTTER::closePdfStream() ::wxRemoveFile( workFilename ); // NULL means memos owns the memory, but provide a hint on optimum size needed. - wxMemoryOutputStream memos( NULL, std::max( 2000, stream_len ) ) ; + wxMemoryOutputStream memos( NULL, std::max( 2000l, stream_len ) ) ; { /* Somewhat standard parameters to compress in DEFLATE. The PDF spec is diff --git a/eeschema/viewlibs.cpp b/eeschema/viewlibs.cpp index 823d506e75..c71ea9d9a6 100644 --- a/eeschema/viewlibs.cpp +++ b/eeschema/viewlibs.cpp @@ -208,8 +208,6 @@ void LIB_VIEW_FRAME::SelectAndViewLibraryPart( int option ) void LIB_VIEW_FRAME::ViewOneLibraryContent( PART_LIB* Lib, int Flag ) { int NumOfParts = 0; - LIB_ALIAS* entry; - wxString CmpName; if( Lib ) NumOfParts = Lib->GetCount(); @@ -220,8 +218,8 @@ void LIB_VIEW_FRAME::ViewOneLibraryContent( PART_LIB* Lib, int Flag ) return; } - if( Lib == NULL ) - return; + LIB_ALIAS* entry; + wxString CmpName; if( Flag == NEW_PART ) DisplayListComponentsInLib( Lib, CmpName, m_entryName ); diff --git a/pcbnew/autorouter/rect_placement/rect_placement.h b/pcbnew/autorouter/rect_placement/rect_placement.h index c9d9585f5d..b89b538007 100644 --- a/pcbnew/autorouter/rect_placement/rect_placement.h +++ b/pcbnew/autorouter/rect_placement/rect_placement.h @@ -26,7 +26,7 @@ public: { int x, y; - TPos() { } + TPos() : x( 0 ), y( 0 ) { } TPos( int _x, int _y ) : x( _x ), y( _y ) { } bool operator ==( const TPos& p ) const { return x == p.x && y == p.y; } @@ -36,7 +36,7 @@ public: { int w, h; - TRect() { } + TRect() : w( 0 ), h( 0 ) { } TRect( int _x, int _y, int _w, int _h ) : TPos( _x, _y ), w( _w > 0 ? _w : 0 ), h( _h > 0 ? _h : 0 ) { } diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index 0eacf9f45d..c853df8e15 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -662,12 +662,12 @@ void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all ) if( !pad->IsSelected() && !force_all ) continue; - wxPoint pos = pad->GetPosition(); + wxPoint pos = pad->GetPos0(); ROTATE( pos ); - pad->SetPosition( pos ); - - pad->SetPos0( pad->GetPosition() ); + pad->SetPos0( pos ); pad->SetOrientation( pad->GetOrientation() + 900 ); + + pad->SetDrawCoord(); } for( EDA_ITEM* item = module->GraphicalItems(); item; item = item->Next() ) @@ -681,15 +681,15 @@ void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all ) { EDGE_MODULE* em = (EDGE_MODULE*) item; - wxPoint tmp = em->GetStart(); + wxPoint tmp = em->GetStart0(); ROTATE( tmp ); - em->SetStart( tmp ); em->SetStart0( tmp ); - tmp = em->GetEnd(); + tmp = em->GetEnd0(); ROTATE( tmp ); - em->SetEnd( tmp ); em->SetEnd0( tmp ); + + em->SetDrawCoord(); } break; diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index c943a087a6..455ccdf80e 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -233,7 +233,8 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, LSET aLayerMask, TRACK_PTRS* * if > 1 segment: * end of track (more than 2 segment connected at this location) */ - segment = m_Track; candidate = NULL; + segment = m_Track; + candidate = NULL; NbSegm = 0; while( ( segment = ::GetTrack( segment, NULL, aPosition, aLayerMask ) ) != NULL ) @@ -280,8 +281,6 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, LSET aLayerMask, TRACK_PTRS* aPosition = candidate->GetStart(); } - segment = m_Track; /* restart list of tracks to analyze */ - /* flag this item an push it in list of selected items */ aList->push_back( candidate ); candidate->SetState( BUSY, true ); diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index cda4b71afd..33e8958772 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -49,6 +49,7 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent ) : m_Width( Millimeter2iu( 0.2 ) ), m_Unit( INCHES ), m_Value( 0 ), m_Height( 0 ), m_Text( this ) { m_Layer = Dwgs_User; + m_Shape = 0; } diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 1ba2ddc390..7291c376ff 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -1055,7 +1055,7 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector ) for( D_PAD* pad = Pads(); pad; pad = pad->Next() ) { pad->SetPos0( pad->GetPos0() + moveVector ); - pad->SetPosition( pad->GetPos0() + footprintPos ); + pad->SetDrawCoord(); } // Update the draw element coordinates. @@ -1100,13 +1100,8 @@ void MODULE::SetOrientation( double newangle ) for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) { - pt = pad->GetPos0(); - pad->SetOrientation( pad->GetOrientation() + angleChange ); - - RotatePoint( &pt, m_Orient ); - - pad->SetPosition( GetPosition() + pt ); + pad->SetDrawCoord(); } // Update of the reference and value. diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 93b7c96988..bb6e2216ca 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -103,6 +103,9 @@ DRC::DRC( PCB_EDIT_FRAME* aPcbWindow ) m_doPad2PadTest = true; // enable pad to pad clearance tests m_doUnconnectedTest = true; // enable unconnected tests m_doZonesTest = true; // enable zone to items clearance tests + m_doKeepoutTest = true; // enable keepout areas to items clearance tests + m_abortDRC = false; + m_drcInProgress = false; m_doCreateRptFile = false; diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index c306aa8639..e892649a2a 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -132,6 +132,7 @@ GPCB_FPL_CACHE_ITEM::GPCB_FPL_CACHE_ITEM( MODULE* aModule, const wxFileName& aFi m_module( aModule ) { m_file_name = aFileName; + m_writable = true; // temporary init if( m_file_name.FileExists() ) m_mod_time = m_file_name.GetModificationTime(); diff --git a/pcbnew/import_dxf/dialog_dxf_import.cpp b/pcbnew/import_dxf/dialog_dxf_import.cpp index f0cf1486e2..724a9d2c64 100644 --- a/pcbnew/import_dxf/dialog_dxf_import.cpp +++ b/pcbnew/import_dxf/dialog_dxf_import.cpp @@ -116,7 +116,9 @@ void DIALOG_DXF_IMPORT::OnBrowseDxfFiles( wxCommandEvent& event ) path, filename, wxT( "dxf Files (*.dxf)|*.dxf" ), wxFD_OPEN|wxFD_FILE_MUST_EXIST ); - dlg.ShowModal(); + + if( dlg.ShowModal() != wxID_OK ) + return; wxString fileName = dlg.GetPath(); diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 8510540600..b381e3caf6 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -271,9 +271,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC // only the intercept will change, segment slopes does not change // because we are moving parallel with is initial state if( !s_MovingSegmentVertical ) - { s_MovingSegment_Yorg = ty1 - ( s_MovingSegmentSlope * tx1 ); - } if( ( !s_EndPointVertical ) && ( !s_MovingSegmentVertical ) ) { @@ -283,43 +281,29 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC else { if( !s_EndPointVertical ) - { xi2 = tx2; - } else { //P1=P2 if( !s_EndPointHorizontal ) - { xi2 = tx2 - dx; - } else - { update = false; - } } } if( !s_MovingSegmentVertical ) - { - yi2 = s_MovingSegmentSlope * ( xi2 ) + s_MovingSegment_Yorg; - } + yi2 = ( s_MovingSegmentSlope * xi2 ) + s_MovingSegment_Yorg; else { if( !s_EndPointVertical ) - { - yi2 = s_EndSegmentSlope * ( xi2 ) + s_EndSegment_Yorg; - } + yi2 = ( s_EndSegmentSlope * xi2 ) + s_EndSegment_Yorg; else { if( !s_EndPointHorizontal ) - { update = false; - } - else - { - yi2 = s_MovingSegmentSlope * ( xi2 ) + s_MovingSegment_Yorg; - } + else + yi2 = ( s_MovingSegmentSlope * xi2 ) + s_MovingSegment_Yorg; } } @@ -331,46 +315,32 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC else { if( !s_StartPointVertical ) - { xi1 = tx1; - } else { //P1=P2 if( !s_StartPointHorizontal ) - { xi1 = tx1 - dx; - } else { if( !s_StartPointHorizontal ) - { update = false; - } } } } if( !s_MovingSegmentVertical ) - { - yi1 = s_MovingSegmentSlope * ( xi1 ) + s_MovingSegment_Yorg; - } + yi1 = ( s_MovingSegmentSlope * xi1 ) + s_MovingSegment_Yorg; else { if( !s_StartPointVertical ) - { - yi1 = s_StartSegmentSlope * ( xi1 ) + s_StartSegment_Yorg; - } + yi1 = ( s_StartSegmentSlope * xi1 ) + s_StartSegment_Yorg; else { if( !s_StartPointHorizontal ) - { update = false; - } else - { - yi2 = s_MovingSegmentSlope * ( xi1 ) + s_MovingSegment_Yorg; - } + yi2 = ( s_MovingSegmentSlope * xi1 ) + s_MovingSegment_Yorg; } } @@ -703,7 +673,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC if( !track ) return; - // TODO: Use clenup functions to merge collinear segments if track + // TODO: Use cleanup functions to merge collinear segments if track // is connected to a collinear segment. s_StartSegmentPresent = s_EndSegmentPresent = true; diff --git a/polygon/PolyLine.cpp b/polygon/PolyLine.cpp index 4563b236a7..47d29e3843 100644 --- a/polygon/PolyLine.cpp +++ b/polygon/PolyLine.cpp @@ -985,6 +985,7 @@ void CPolyLine::Copy( const CPolyLine* src ) m_layer = src->m_layer; m_hatchStyle = src->m_hatchStyle; m_hatchPitch = src->m_hatchPitch; + m_flags = src->m_flags; m_CornersList.RemoveAllContours(); m_CornersList.Append( src->m_CornersList ); }