diff --git a/common/eagle_parser.cpp b/common/eagle_parser.cpp index f25213ef42..dd2d10d1ea 100644 --- a/common/eagle_parser.cpp +++ b/common/eagle_parser.cpp @@ -934,10 +934,6 @@ ECONNECT::ECONNECT( wxXmlNode* aConnect ) gate = parseRequiredAttribute( aConnect, "gate" ); pin = parseRequiredAttribute( aConnect, "pin" ); pad = parseRequiredAttribute( aConnect, "pad" ); - - //TODO: - //int contactroute; - }; diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index ad485bb57e..f52969c6c5 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -69,7 +69,8 @@ OPENGL_GAL::OPENGL_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions, wxWindow* aParent, GAL( aDisplayOptions ), wxGLCanvas( aParent, wxID_ANY, (int*) glAttributes, wxDefaultPosition, wxDefaultSize, wxEXPAND, aName ), - mouseListener( aMouseListener ), paintListener( aPaintListener ) + mouseListener( aMouseListener ), paintListener( aPaintListener ), currentManager( nullptr ), + cachedManager( nullptr ), nonCachedManager( nullptr ), overlayManager( nullptr ) { if( glMainContext == NULL ) { @@ -1537,6 +1538,7 @@ int OPENGL_GAL::drawBitmapChar( unsigned long aChar ) const float TEX_Y = font_image.height; const FONT_GLYPH_TYPE* glyph = LookupGlyph(aChar); + wxASSERT( glyph ); if( !glyph ) return 0; @@ -1592,6 +1594,11 @@ void OPENGL_GAL::drawBitmapOverbar( double aLength, double aHeight ) { // To draw an overbar, simply draw an overbar const FONT_GLYPH_TYPE* glyph = LookupGlyph( '_' ); + wxASSERT( glyph ); + + if( !glyph ) + return; + const float H = glyph->maxy - glyph->miny; Save(); @@ -1642,6 +1649,7 @@ std::pair OPENGL_GAL::computeBitmapTextSize( const wxString& aT unsigned int c = aText[i]; const FONT_GLYPH_TYPE* glyph = LookupGlyph( c ); + wxASSERT( glyph ); // a few chars if( !glyph || // Not coded in font diff --git a/common/widgets/widget_net_selector.cpp b/common/widgets/widget_net_selector.cpp index 48a26ff52d..65eedebb29 100644 --- a/common/widgets/widget_net_selector.cpp +++ b/common/widgets/widget_net_selector.cpp @@ -30,16 +30,17 @@ WIDGET_NET_SELECTOR::WIDGET_NET_SELECTOR (wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], long style, const wxValidator &validator, const wxString &name ) : - wxComboBox ( parent, id, value, pos, size, n, choices, style, validator, name ) + wxComboBox( parent, id, value, pos, size, n, choices, style, validator, name ), + m_multiple( false ) { - } + WIDGET_NET_SELECTOR::~WIDGET_NET_SELECTOR() { - } + void WIDGET_NET_SELECTOR::SetMultiple( bool aMultiple ) { if ( aMultiple ) @@ -51,6 +52,7 @@ void WIDGET_NET_SELECTOR::SetMultiple( bool aMultiple ) } } + void WIDGET_NET_SELECTOR::SetSelectedNet ( int aNetcode ) { for( const auto& n : m_nets ) @@ -63,9 +65,11 @@ void WIDGET_NET_SELECTOR::SetSelectedNet ( int aNetcode ) } } + int WIDGET_NET_SELECTOR::GetSelectedNet() { int pos = GetSelection(); + for( const auto& n : m_nets ) { if( n.pos == pos ) @@ -75,6 +79,7 @@ int WIDGET_NET_SELECTOR::GetSelectedNet() return 0; } + bool WIDGET_NET_SELECTOR::IsUniqueNetSelected() const { if( m_multiple && ( GetSelection() == ( (int)GetCount() - 1 ) ) ) @@ -83,16 +88,17 @@ bool WIDGET_NET_SELECTOR::IsUniqueNetSelected() const return true; } + void WIDGET_NET_SELECTOR::SetBoard( BOARD* aBoard ) { auto& netinfo = aBoard->GetNetInfo(); - Append( wxT( "" )); + Append( wxT( "" ) ); - for(unsigned i = 1; i < netinfo.GetNetCount(); i++) + for( unsigned i = 1; i < netinfo.GetNetCount(); i++ ) { - NETINFO_ITEM *ni = netinfo.GetNetItem(i); - NET n; + NETINFO_ITEM* ni = netinfo.GetNetItem( i ); + NET n; n.name = ni->GetNetname(); n.code = i; m_nets.push_back( n ); @@ -100,7 +106,7 @@ void WIDGET_NET_SELECTOR::SetBoard( BOARD* aBoard ) std::sort( m_nets.begin(), m_nets.end() ); - for ( auto& n : m_nets ) + for( auto& n : m_nets ) { n.pos = Append( n.name ); } diff --git a/common/wx_unit_binder.cpp b/common/wx_unit_binder.cpp index c1f0fef500..82dbfa6f0b 100644 --- a/common/wx_unit_binder.cpp +++ b/common/wx_unit_binder.cpp @@ -81,8 +81,14 @@ bool WX_UNIT_BINDER::Valid() const void WX_UNIT_BINDER::Enable( bool aEnable ) { - wxWindow* wxWin = dynamic_cast ( m_textEntry ); - wxWin->Enable( aEnable ); + wxWindow* wxWin = dynamic_cast( m_textEntry ); + wxASSERT( wxWin ); + + // Most text input entry widgets inherit from wxTextEntry and wxWindow, so it should be fine. + // Still, it is better to be safe than sorry. + if( wxWin ) + wxWin->Enable( aEnable ); + m_unitLabel->Enable( aEnable ); } diff --git a/eeschema/sch_eagle_plugin.cpp b/eeschema/sch_eagle_plugin.cpp index 3a82439d89..6142aeaf9b 100644 --- a/eeschema/sch_eagle_plugin.cpp +++ b/eeschema/sch_eagle_plugin.cpp @@ -278,7 +278,10 @@ static void eagleToKicadAlignment( EDA_TEXT* aText, int aEagleAlignment, SCH_EAGLE_PLUGIN::SCH_EAGLE_PLUGIN() { + m_kiway = nullptr; m_rootSheet = nullptr; + m_currentSheet = nullptr; + m_partlib = nullptr; } @@ -480,7 +483,6 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) int sheet_count = countChildren( schematicChildren["sheets"], "sheet" ); // If eagle schematic has multiple sheets. - if( sheet_count > 1 ) { int x, y, i; @@ -497,20 +499,19 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) sheet->SetTimeStamp( GetNewTimeStamp() - i ); // minus the sheet index to make it unique. sheet->SetParent( m_rootSheet->GetScreen() ); sheet->SetScreen( screen ); + sheet->GetScreen()->SetFileName( sheet->GetFileName() ); m_currentSheet = sheet.get(); - sheet->GetScreen()->SetFileName( sheet->GetFileName() ); - m_rootSheet->GetScreen()->Append( sheet.release() ); loadSheet( sheetNode, i ); - + m_rootSheet->GetScreen()->Append( sheet.release() ); sheetNode = sheetNode->GetNext(); x += 2; - if( x > 10 ) + if( x > 10 ) // start next row { - x = 1; - y += 2; + x = 1; + y += 2; } i++; diff --git a/gerbview/class_am_param.cpp b/gerbview/class_am_param.cpp index 666e8a063e..adf2c47e88 100644 --- a/gerbview/class_am_param.cpp +++ b/gerbview/class_am_param.cpp @@ -128,7 +128,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const default: wxLogDebug( "AM_PARAM::GetValue(): dcode %d prm %d/%d: unexpected type %d", - aDcode->m_Num_Dcode, ii, m_paramStack.size(), item.GetType() ); + aDcode ? aDcode->m_Num_Dcode : -1, ii, m_paramStack.size(), item.GetType() ); break; } } diff --git a/include/eagle_parser.h b/include/eagle_parser.h index c5724b7f16..10207900c6 100644 --- a/include/eagle_parser.h +++ b/include/eagle_parser.h @@ -981,7 +981,7 @@ struct ECONNECT string gate; string pin; string pad; - int contactroute; + //int contactroute; // TODO ECONNECT( wxXmlNode* aConnect ); }; diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 899a69ac7b..33c517c10a 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -69,6 +69,11 @@ void TEXTE_PCB::SetTextAngle( double aAngle ) void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE DrawMode, const wxPoint& offset ) { + wxASSERT( panel ); + + if( !panel ) + return; + BOARD* brd = GetBoard(); if( brd->IsLayerVisible( m_Layer ) == false ) @@ -78,8 +83,7 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, auto color = frame->Settings().Colors().GetLayerColor( m_Layer ); EDA_DRAW_MODE_T fillmode = FILLED; - DISPLAY_OPTIONS* displ_opts = - panel ? (DISPLAY_OPTIONS*)panel->GetDisplayOptions() : NULL; + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); if( displ_opts && displ_opts->m_DisplayDrawItemsFill == SKETCH ) fillmode = SKETCH; diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 38b59cfdd5..07a621f741 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -41,7 +41,10 @@ CLIPBOARD_IO::CLIPBOARD_IO(): } -CLIPBOARD_IO::~CLIPBOARD_IO(){} +CLIPBOARD_IO::~CLIPBOARD_IO() +{ + delete m_parser; +} STRING_FORMATTER* CLIPBOARD_IO::GetFormatter() @@ -303,6 +306,7 @@ BOARD* CLIPBOARD_IO::Load( const wxString& aFileName, { board = dynamic_cast( item ); } + // Give the filename to the board if it's new if( !aAppendToMe ) board->SetFileName( aFileName ); diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp index cb404bdae5..c3dacdb701 100644 --- a/pcbnew/router/pns_dragger.cpp +++ b/pcbnew/router/pns_dragger.cpp @@ -37,6 +37,7 @@ DRAGGER::DRAGGER( ROUTER* aRouter ) : m_dragStatus = false; m_currentMode = RM_MarkObstacles; m_initialVia = NULL; + m_freeAngleMode = false; }