diff --git a/common/project.cpp b/common/project.cpp index b555d31a81..e44290b5bc 100644 --- a/common/project.cpp +++ b/common/project.cpp @@ -463,29 +463,25 @@ FP_LIB_TABLE* PROJECT::PcbFootprintLibs( KIWAY& aKiway ) // This is a lazy loading function, it loads the project specific table when // that table is asked for, not before. - FP_LIB_TABLE* tbl = (FP_LIB_TABLE*) GetElem( ELEM_FPTBL ); + FP_LIB_TABLE* tbl = (FP_LIB_TABLE*) GetElem( ELEM_FPTBL ); - // its gotta be NULL or a FP_LIB_TABLE, or a bug. - wxASSERT( !tbl || tbl->Type() == FP_LIB_TABLE_T ); - - if( !tbl ) + if( tbl ) + { + wxASSERT( tbl->Type() == FP_LIB_TABLE_T ); + } + else { - // Build a new project specific FP_LIB_TABLE with the global table as a fallback. - // ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may - // stack this way, all using the same global fallback table. - KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB ); - - if( kiface ) - tbl = (FP_LIB_TABLE*) kiface->IfaceOrAddress( KIFACE_NEW_FOOTPRINT_TABLE ); - - wxASSERT( tbl ); - SetElem( ELEM_FPTBL, tbl ); - - wxString projectFpLibTableFileName = FootprintLibTblName(); - try { - tbl->Load( projectFpLibTableFileName ); + // Build a new project specific FP_LIB_TABLE with the global table as a fallback. + // ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may + // stack this way, all using the same global fallback table. + KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB ); + + tbl = (FP_LIB_TABLE*) kiface->IfaceOrAddress( KIFACE_NEW_FOOTPRINT_TABLE ); + tbl->Load( FootprintLibTblName() ); + + SetElem( ELEM_FPTBL, tbl ); } catch( const IO_ERROR& ioe ) { diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp index d4ef2e4abb..b301dd95ef 100644 --- a/common/widgets/mathplot.cpp +++ b/common/widgets/mathplot.cpp @@ -1580,23 +1580,7 @@ void mpScaleY::Plot( wxDC& dc, mpWindow& w ) m_pen.SetStyle( wxPENSTYLE_DOT ); dc.SetPen( m_pen ); - if( (m_flags == mpALIGN_LEFT) && !m_drawOutsideMargins ) - { - dc.DrawLine( orgx - 4, p, endPx, p ); - } - else - { - if( (m_flags == mpALIGN_RIGHT) && !m_drawOutsideMargins ) - { - // dc.DrawLine( orgX-4, p, orgx+4, p); - dc.DrawLine( orgx - 4, p, endPx, p ); - } - else - { - dc.DrawLine( orgx - 4, p, endPx, p ); - // dc.DrawLine( orgx-4/*-w.GetScrX()*/, p, w.GetScrX(), p); - } - } + dc.DrawLine( orgx - 4, p, endPx, p ); m_pen.SetStyle( wxPENSTYLE_SOLID ); dc.SetPen( m_pen ); diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index ea166d6323..2be6ed4f5c 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -584,7 +584,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType segment = startSegments( aType, VECTOR2D( cursorPos ) ); } // Create a new segment if we're out of previously-created ones - else if( !segment->IsNull() || ( forceHV && !m_wires.end()[-2]->IsNull() ) ) + else if( !segment->IsNull() || ( forceHV && !m_wires[ m_wires.size() - 2 ]->IsNull() ) ) { // Terminate the command if the end point is on a pin, junction, or another // wire or bus. @@ -611,7 +611,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType if( evt->IsDblClick( BUT_LEFT ) && segment ) { if( forceHV && m_wires.size() >= 2 ) - computeBreakPoint( { m_wires.end()[-2], segment }, cursorPos ); + computeBreakPoint( { m_wires[ m_wires.size() - 2 ], segment }, cursorPos ); finishSegments(); segment = nullptr; @@ -665,7 +665,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType { // Coerce the line to vertical or horizontal if necessary if( forceHV && m_wires.size() >= 2 ) - computeBreakPoint( { m_wires.end()[-2], segment }, cursorPos ); + computeBreakPoint( { m_wires[ m_wires.size() - 2 ], segment }, cursorPos ); else segment->SetEndPoint( cursorPos ); }