KiCad PCB EDA Suite
Loading...
Searching...
No Matches
panel_snapping.h File Reference
#include <functional>
#include <vector>
#include <frame_type.h>
#include <panel_snapping_base.h>
#include <settings/snap_settings.h>

Go to the source code of this file.

Classes

class  PANEL_SNAPPING
 The snapping preferences page. More...
 
struct  PANEL_SNAPPING::VALUES
 One editor's snapping settings by value, so the page can also be filled from a settings object that isn't the live one. More...
 

Functions

std::vector< MAGNETIC_OPTIONSMagneticSnapOptions (bool aRouting)
 The object snapping modes an editor offers.
 
int MagneticSnapIndex (const std::vector< MAGNETIC_OPTIONS > &aOptions, MAGNETIC_OPTIONS aValue)
 The position of aValue in aOptions, falling back to the "never" entry for a value the editor does not offer.
 
MAGNETIC_OPTIONS MagneticSnapValue (const std::vector< MAGNETIC_OPTIONS > &aOptions, int aIndex)
 The mode at aIndex, or "never" if the index is out of range.
 
template<typename SETTINGS_T>
PANEL_SNAPPINGCreateSnappingPanel (wxWindow *aParent, SETTINGS_T *aCfg, FRAME_T aFrameType, SNAP_INFERENCE_SETTINGS SETTINGS_T::*aInference=nullptr, MAGNETIC_SETTINGS SETTINGS_T::*aMagnetics=nullptr)
 Build the snapping page for an editor.
 

Function Documentation

◆ CreateSnappingPanel()

template<typename SETTINGS_T>
PANEL_SNAPPING * CreateSnappingPanel ( wxWindow * aParent,
SETTINGS_T * aCfg,
FRAME_T aFrameType,
SNAP_INFERENCE_SETTINGS SETTINGS_T::* aInference = nullptr,
MAGNETIC_SETTINGS SETTINGS_T::* aMagnetics = nullptr )

Build the snapping page for an editor.

The settings members are named explicitly so that an editor which grows or loses a snapping setting fails to compile rather than silently dropping a group from its preferences.

Definition at line 109 of file panel_snapping.h.

References PANEL_SNAPPING::VALUES::gridSnap, PANEL_SNAPPING::VALUES::inference, and PANEL_SNAPPING::VALUES::magnetics.

◆ MagneticSnapIndex()

int MagneticSnapIndex ( const std::vector< MAGNETIC_OPTIONS > & aOptions,
MAGNETIC_OPTIONS aValue )

The position of aValue in aOptions, falling back to the "never" entry for a value the editor does not offer.

The grid helpers ignore modes an editor can't reach, so reading one back as "never" matches what the user actually gets.

Definition at line 37 of file panel_snapping.cpp.

References NO_EFFECT.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PANEL_SNAPPING::load().

◆ MagneticSnapOptions()

std::vector< MAGNETIC_OPTIONS > MagneticSnapOptions ( bool aRouting)

The object snapping modes an editor offers.

Only editors that route tracks have a mode that applies to the router alone; elsewhere the choice is between never and always.

Definition at line 25 of file panel_snapping.cpp.

References CAPTURE_ALWAYS, CAPTURE_CURSOR_IN_TRACK_TOOL, and NO_EFFECT.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PANEL_SNAPPING::PANEL_SNAPPING().

◆ MagneticSnapValue()

MAGNETIC_OPTIONS MagneticSnapValue ( const std::vector< MAGNETIC_OPTIONS > & aOptions,
int aIndex )

The mode at aIndex, or "never" if the index is out of range.

Definition at line 48 of file panel_snapping.cpp.

References NO_EFFECT.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PANEL_SNAPPING::TransferDataFromWindow().