diff --git a/include/footprint_info.h b/include/footprint_info.h index 19f133829a..1a195131c6 100644 --- a/include/footprint_info.h +++ b/include/footprint_info.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2011 Jean-Pierre Charras, - * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 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 @@ -167,12 +167,16 @@ protected: /// FOOTPRINT object list sort function. inline bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 ) { - int retv = StrNumCmp( item1.m_nickname, item2.m_nickname, true ); + int retv = StrNumCmp( item1.m_nickname, item2.m_nickname, false ); if( retv != 0 ) return retv < 0; - return StrNumCmp( item1.m_fpname, item2.m_fpname, true ) < 0; + // Technically footprint names are not case sensitive because the file name is used + // as the footprint name. On windows this would be problematic because windows does + // not support case sensitive file names by default. This should not cause any issues + // and allow for a future change to use the name defined in the footprint file. + return StrNumCmp( item1.m_fpname, item2.m_fpname, false ) < 0; } diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index 7f977751d5..38d7d57b33 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -288,7 +288,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList() m_libList->Append( nicknames[ii] ); // Search for a previous selection: - int index = m_libList->FindString( getCurNickname() ); + int index = m_libList->FindString( getCurNickname(), true ); if( index != wxNOT_FOUND ) { @@ -339,7 +339,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList() m_footprintList->Append( footprint->GetFootprintName() ); } - int index = m_footprintList->FindString( getCurFootprintName() ); + int index = m_footprintList->FindString( getCurFootprintName(), true ); if( index == wxNOT_FOUND ) setCurFootprintName( wxEmptyString ); @@ -491,7 +491,8 @@ void FOOTPRINT_VIEWER_FRAME::LoadSettings( wxConfigBase* aCfg ) if( aCfg->Read( footprintEditor + ShowGridEntryKeyword, &btmp ) ) SetGridVisibility( btmp ); - if( wtmp.SetFromWxString( aCfg->Read( footprintEditor + GridColorEntryKeyword, wxT( "NONE" ) ) ) ) + if( wtmp.SetFromWxString( aCfg->Read( footprintEditor + GridColorEntryKeyword, + wxT( "NONE" ) ) ) ) SetGridColor( wtmp ); // Grid shape, etc. @@ -683,7 +684,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event ) setCurNickname( fpid.GetLibNickname() ); setCurFootprintName( fpid.GetLibItemName() ); - int index = m_libList->FindString( fpid.GetLibNickname() ); + int index = m_libList->FindString( fpid.GetLibNickname(), true ); if( index != wxNOT_FOUND ) { @@ -703,7 +704,7 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode ) if( !getCurNickname() ) return; - int selection = m_footprintList->FindString( getCurFootprintName() ); + int selection = m_footprintList->FindString( getCurFootprintName(), true ); if( aMode == NEXT_PART ) { diff --git a/pcbnew/fp_tree_model_adapter.cpp b/pcbnew/fp_tree_model_adapter.cpp index 998de146b3..9896ea4b21 100644 --- a/pcbnew/fp_tree_model_adapter.cpp +++ b/pcbnew/fp_tree_model_adapter.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2019 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 @@ -68,7 +68,7 @@ std::vector FP_TREE_MODEL_ADAPTER::getFootprints( const wxString auto libBounds = std::equal_range( fullListStart, fullListEnd, dummy, []( const std::unique_ptr& a, const std::unique_ptr& b ) { - return StrNumCmp( a->GetLibNickname(), b->GetLibNickname(), true ) < 0; + return StrNumCmp( a->GetLibNickname(), b->GetLibNickname(), false ) < 0; } ); for( auto i = libBounds.first; i != libBounds.second; ++i ) diff --git a/pcbnew/fp_tree_synchronizing_adapter.cpp b/pcbnew/fp_tree_synchronizing_adapter.cpp index 9fbd31b4d0..fb1d927995 100644 --- a/pcbnew/fp_tree_synchronizing_adapter.cpp +++ b/pcbnew/fp_tree_synchronizing_adapter.cpp @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 CERN + * Copyright (C)-2019 KiCad Developers, see AUTHORS.txt for contributors. * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -117,7 +118,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary( LIB_TREE_NODE_LIB& aLibNode ) auto footprintIt = std::lower_bound( footprints.begin(), footprints.end(), &dummy, []( LIB_TREE_ITEM* a, LIB_TREE_ITEM* b ) { - return StrNumCmp( a->GetName(), b->GetName(), true ) < 0; + return StrNumCmp( a->GetName(), b->GetName(), false ) < 0; } ); if( footprintIt != footprints.end() && dummy.GetName() == (*footprintIt)->GetName() ) @@ -176,7 +177,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewIte wxString currentFPName = mod->GetFPID().GetLibItemName(); - // mark modified part with an asterix + // mark modified part with an asterisk if( m_frame->GetScreen()->IsModify() ) aVariant = currentFPName + " *"; else @@ -223,42 +224,42 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsign switch( node->Type ) { - case LIB_TREE_NODE::LIB: - if( node->Name == m_frame->GetLoadedFPID().GetLibNickname() ) - { + case LIB_TREE_NODE::LIB: + if( node->Name == m_frame->GetLoadedFPID().GetLibNickname() ) + { #ifdef __WXGTK__ - // The native wxGTK+ impl ignores background colour, so set the text colour - // instead. Works reasonably well in dark themes, less well in light ones.... - aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); + // The native wxGTK+ impl ignores background colour, so set the text colour + // instead. Works reasonably well in dark themes, less well in light ones.... + aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #else - aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); + aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #endif - // mark modified libs with bold font - if( m_frame->GetScreen()->IsModify() && !m_frame->IsCurrentFPFromBoard() ) - aAttr.SetBold( true ); - } - break; + // mark modified libs with bold font + if( m_frame->GetScreen()->IsModify() && !m_frame->IsCurrentFPFromBoard() ) + aAttr.SetBold( true ); + } + break; - case LIB_TREE_NODE::LIBID: - if( node->LibId == m_frame->GetLoadedFPID() ) - { + case LIB_TREE_NODE::LIBID: + if( node->LibId == m_frame->GetLoadedFPID() ) + { #ifdef __WXGTK__ - // The native wxGTK+ impl ignores background colour, so set the text colour - // instead. Works reasonably well in dark themes, less well in light ones.... - aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); + // The native wxGTK+ impl ignores background colour, so set the text colour + // instead. Works reasonably well in dark themes, less well in light ones.... + aAttr.SetColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #else - aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); + aAttr.SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); #endif - // mark modified part with bold font - if( m_frame->GetScreen()->IsModify() && !m_frame->IsCurrentFPFromBoard() ) - aAttr.SetBold( true ); - } - break; + // mark modified part with bold font + if( m_frame->GetScreen()->IsModify() && !m_frame->IsCurrentFPFromBoard() ) + aAttr.SetBold( true ); + } + break; - default: - return false; + default: + return false; } return true;