KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_library_query.cpp File Reference
#include "footprint_library_query.h"
#include <exception>
#include <kiface_ids.h>
#include <kiway.h>
#include <json_common.h>

Go to the source code of this file.

Functions

FOOTPRINT_MATCH_RESULT QueryMatchingFootprints (KIWAY &aKiway, const FOOTPRINT_MATCH_QUERY &aQuery)
 Ask the footprint libraries, for the footprints matching a query (over the Pcbnew kiface).
 
bool StartFootprintLibrariesLoad (KIWAY &aKiway)
 Start loading the footprint libraries in the background.
 
float GetFootprintLibrariesLoadProgress (KIWAY &aKiway)
 Return how far the background load of the footprint libraries has got.
 

Function Documentation

◆ GetFootprintLibrariesLoadProgress()

float GetFootprintLibrariesLoadProgress ( KIWAY & aKiway)

Return how far the background load of the footprint libraries has got.

Never blocks, so it can be polled while showing a loading indication.

Parameters
aKiwayis used to reach the pcbnew kiface.
Returns
the fraction of the queued libraries processed so far, or 1.0 when there is nothing to wait for (for example without the Pcbnew kiface).

Definition at line 172 of file footprint_library_query.cpp.

References KIWAY::FACE_PCB, KIWAY::KiFACE(), kiface(), and KIFACE_FOOTPRINTS_LOAD_PROGRESS.

Referenced by PANEL_FOOTPRINT_FILTERS::matchLibrariesReady().

◆ QueryMatchingFootprints()

FOOTPRINT_MATCH_RESULT QueryMatchingFootprints ( KIWAY & aKiway,
const FOOTPRINT_MATCH_QUERY & aQuery )

Ask the footprint libraries, for the footprints matching a query (over the Pcbnew kiface).

Parameters
aKiwayis used to reach the pcbnew kiface.
aQueryis the set of criteria to match.
Returns
the matching "library:footprint" IDs. On failure Success is false and MatchingNames is empty, which happens when the pcbnew kiface is unavailable (for example in a standalone tool without footprint support) or the query could not be performed.

Definition at line 89 of file footprint_library_query.cpp.

References KIWAY::FACE_PCB, filterFootprints(), filters, FOOTPRINT_MATCH_RESULT::FromJsonStr(), KIWAY::KiFACE(), kiface(), KIFACE_FILTER_FOOTPRINTS, FOOTPRINT_MATCH_QUERY::m_MaxResults, FOOTPRINT_MATCH_QUERY::m_Patterns, FOOTPRINT_MATCH_QUERY::m_PinCount, FOOTPRINT_MATCH_QUERY::m_ZeroFilters, and result.

Referenced by FP_FILTER_MATCHER::fetchMatches(), and FOOTPRINT_SELECT_WIDGET::UpdateList().

◆ StartFootprintLibrariesLoad()

bool StartFootprintLibrariesLoad ( KIWAY & aKiway)

Start loading the footprint libraries in the background.

This call does not block. It is a no-op if the libraries are already loaded, or a load is already running.

Returns
true if the background load was successfully started, false otherwise.

Definition at line 144 of file footprint_library_query.cpp.

References KIWAY::FACE_PCB, KIWAY::KiFACE(), kiface(), and KIFACE_TRIGGER_FOOTPRINTS_LOAD.