Commit 1edd8c8a authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Eeschema: remove the compil option KICAD_KEEPCASE. Eeschema is now always case...

Eeschema: remove the compil option KICAD_KEEPCASE. Eeschema is now always case sensitive when seraching components in libs.
However to be compatible with old versions of Eeschema, when a search in library fails, a case insensitive search is made.
Therefore, this version should be compatible with sch files created by previous Eeschema versions compiled with KICAD_KEEPCASE = OFF
parent aa9de21c
Loading
Loading
Loading
Loading
+0 −18
Original line number Diff line number Diff line
@@ -26,20 +26,6 @@ set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
#option( USE_KIWAY_DLLS "Build the major modules as KIFACE DLLs or DSOs, will soon be the norm." ON )
set( USE_KIWAY_DLLS true )  # this is now mandatory, the code is the same anyways, the old code is gone.


# The desire is to migrate designs *away from* case independence, and to create designs which use
# literally (case specific) interpreted component names.  But for backwards compatibility,
# you may turn OFF this option if you really must.  (Remember that with KiCad using text
# data files, typically you would be better off simply doctoring those files into
# a case literal state with a text editor and move forward into the brave new
# world of case specificity.  Also, BOM generators may not work properly when you
# have this option turned OFF, the xml export's referential integrity is broken
# on library part name.  Hence the default is ON now, as of 29-Jan-2014.
option( KICAD_KEEPCASE
    "ON= case specific string matching on component names, OFF= match names as if they were spelt using uppercase."
    ON
    )

option( USE_WX_GRAPHICS_CONTEXT
    "Use wxGraphicsContext for rendering ( default OFF). Warning, this is experimental" )

@@ -245,10 +231,6 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )

endif( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )

if( KICAD_KEEPCASE )
    add_definitions( -DKICAD_KEEPCASE )
endif()

if( USE_WX_OVERLAY OR APPLE )
    add_definitions( -DUSE_WX_OVERLAY )
endif()
+1 −6
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
 *
@@ -795,11 +795,6 @@ bool LIB_PART::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
    if( componentName[0] != '~' )
    {
        m_name = FROM_UTF8( componentName );

#ifndef KICAD_KEEPCASE
        m_name = m_name.MakeUpper();
#endif

        value.SetText( m_name );
    }
    else
+3 −3
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
 *
@@ -46,11 +46,11 @@ class LIB_FIELD;
/// Compiler controlled string compare function, either case independent or not:
inline int Cmp_KEEPCASE( const wxString& aString1, const wxString& aString2 )
{
#ifdef KICAD_KEEPCASE
#if 1
    // case specificity:
    return aString1.Cmp( aString2 );
#else
    // case independence:
    // case independence (no more in use)
    return aString1.CmpNoCase( aString2 );
#endif
}
+36 −1
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
 *
@@ -899,6 +899,41 @@ LIB_ALIAS* PART_LIBS::FindLibraryEntry( const wxString& aName, const wxString& a
    return entry;
}

/* searches all libraries in the list for an entry, using a case insensitive comparison.
 * Used to find an entry, when the normal (case sensitive) search fails.
  */
LIB_ALIAS* PART_LIBS::FindLibraryNearEntry( const wxString& aEntryName,
        const wxString& aLibraryName )
{
    BOOST_FOREACH( PART_LIB& lib, *this )
    {
        if( !!aLibraryName && lib.GetName() != aLibraryName )
            continue;

        LIB_ALIAS* entry = lib.GetFirstEntry();

        if( ! entry )
            continue;

        wxString first_entry_name = entry->GetName();
        wxString entry_name = first_entry_name;

        for( ;; )
        {
            if( entry_name.CmpNoCase( aEntryName ) == 0 )
                return entry;

            entry = lib.GetNextEntry( entry_name );
            entry_name = entry->GetName();

            if( first_entry_name == entry_name )
                break;
        }
    }

    return NULL;
}


int PART_LIBS::s_modify_generation = 1;     // starts at 1 and goes up

+26 −12
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
 *
@@ -209,13 +209,33 @@ public:
     *
     * The object can be either a part or an alias.
     *
     * @param aEntryName - Name of entry to search for.
     * @param aEntryName - Name of entry to search for (case sensitive).
     * @param aLibraryName - Name of the library to search.
     * @return The entry object if found, otherwise NULL.
     */
    LIB_ALIAS* FindLibraryEntry( const wxString& aEntryName,
            const wxString& aLibraryName = wxEmptyString );

    /**
     * Function FindLibraryNearEntry
     * Searches all libraries in the list for an entry, using a case insensitive comparison.
     * Used to find an entry, when the normal (case sensitive) search fails.
     * Needed because during a long time, eeschema was using a case insensitive search.
     * Therefore, for old schematics (<= 2013), or libs,
     * which mixed upper case and lower case entry names, for compatibility reasons, if
     * a normal search fails, this case insensitive search can be made.
     * Could be also usefull also in some dialogs, when searching parts in libs.
     * Remember this is a linear search, therefore slower than the normal binary search
     *
     * The object can be either a part or an alias.
     *
     * @param aEntryName - Name of entry to search for (case insensitive).
     * @param aLibraryName - Name of the library to search.
     * @return The entry object if found, otherwise NULL.
     */
    LIB_ALIAS* FindLibraryNearEntry( const wxString& aEntryName,
            const wxString& aLibraryName = wxEmptyString );

    /**
     * Function RemoveCacheLibrary
     * removes all cache libraries from library list.
@@ -332,13 +352,7 @@ public:
     * @param aMakeUpperCase - Force entry names to upper case.
     */
    void GetEntryNames( wxArrayString& aNames, bool aSort = true,
                        bool aMakeUpperCase =
#ifdef KICAD_KEEPCASE
                                              false
#else
                                              true
#endif
                        );
                        bool aMakeUpperCase = false );

    /**
     * Load string array with entry names matching name and/or key word.
@@ -377,7 +391,7 @@ public:
    /**
     * Find entry by name.
     *
     * @param aName - Name of entry, case insensitive.
     * @param aName - Name of entry, case sensitive.
     * @return Entry if found.  NULL if not found.
     */
    LIB_ALIAS* FindEntry( const wxString& aName );
@@ -388,7 +402,7 @@ public:
     * This is a helper for FindEntry so casting a LIB_ALIAS pointer to
     * a LIB_PART pointer is not required.
     *
     * @param aName - Name of part, case insensitive.
     * @param aName - Name of part, case sensitive.
     * @return LIB_PART* - part if found, else NULL.
     */
    LIB_PART* FindPart( const wxString& aName );
@@ -396,7 +410,7 @@ public:
    /**
     * Find alias by \a nName.
     *
     * @param aName - Name of alias, case insensitive.
     * @param aName - Name of alias, case sensitive.
     * @return Alias if found.  NULL if not found.
     */
    LIB_ALIAS* FindAlias( const wxString& aName )
Loading