Header clean up round 3.
This commit is contained in:
parent
46314f6483
commit
f06a5894b3
|
@ -71,11 +71,11 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, double aI
|
|||
DIALOG_PAGES_SETTINGS_BASE( aParent ),
|
||||
m_parent( aParent ),
|
||||
m_screen( m_parent->GetScreen() ),
|
||||
m_pageBitmap( nullptr ),
|
||||
m_initialized( false ),
|
||||
m_pageBitmap( nullptr ),
|
||||
m_iuPerMils( aIuPerMils ),
|
||||
m_customSizeX( aParent, m_userSizeXLabel, m_userSizeXCtrl, m_userSizeXUnits, false ),
|
||||
m_customSizeY( aParent, m_userSizeYLabel, m_userSizeYCtrl, m_userSizeYUnits, false ),
|
||||
m_iuPerMils( aIuPerMils )
|
||||
m_customSizeY( aParent, m_userSizeYLabel, m_userSizeYCtrl, m_userSizeYUnits, false )
|
||||
{
|
||||
m_projectPath = Prj().GetProjectPath();
|
||||
m_maxPageSizeMils = aMaxUserSizeMils;
|
||||
|
|
|
@ -81,8 +81,8 @@ public:
|
|||
* @param aId is the string to populate the #LIB_ID object.
|
||||
* @param aFix indicates invalid chars should be replaced with '_'.
|
||||
*
|
||||
* @return int - minus 1 (i.e. -1) means success, >= 0 indicates the character offset into
|
||||
* aId at which an error was detected.
|
||||
* @return minus 1 (i.e. -1) means success, >= 0 indicates the character offset into
|
||||
* aId at which an error was detected.
|
||||
*/
|
||||
int Parse( const UTF8& aId, bool aFix = false );
|
||||
|
||||
|
@ -106,9 +106,12 @@ public:
|
|||
const UTF8& GetLibItemName() const { return m_itemName; }
|
||||
|
||||
/**
|
||||
* Get strings for display messages in dialogs.
|
||||
*
|
||||
* Equivalent to m_itemName.wx_str(), but more explicit when building a Unicode string
|
||||
* in messages.
|
||||
*
|
||||
* @return the library item name, i.e. footprintName in a wxString (UTF16 or 32).
|
||||
* useful to display messages in dialogs
|
||||
* Equivalent to m_itemName.wx_str(), but more explicit when building a Unicode string in messages.
|
||||
*/
|
||||
const wxString GetUniStringLibItemName() const { return m_itemName.wx_str(); }
|
||||
|
||||
|
@ -134,8 +137,7 @@ public:
|
|||
|
||||
/**
|
||||
* @return the fully formatted text of the LIB_ID in a wxString (UTF16 or UTF32),
|
||||
* suitable to display the LIB_ID in dialogs.
|
||||
* Equivalent to Format().wx_str(), but more explicit when building a Unicode string in messages.
|
||||
* suitable to display the LIB_ID in dialogs.
|
||||
*/
|
||||
wxString GetUniStringLibId() const
|
||||
{
|
||||
|
@ -152,13 +154,16 @@ public:
|
|||
const UTF8& aRevision = "" );
|
||||
|
||||
/**
|
||||
* @return true is the #LIB_ID is valid.
|
||||
* Check if this LID_ID is valid.
|
||||
*
|
||||
* A valid #LIB_ID must have both the library nickname and the library item name defined.
|
||||
* The revision field is optional.
|
||||
*
|
||||
* @note A return value of true does not indicated that the #LIB_ID is a valid #LIB_TABLE
|
||||
* entry.
|
||||
*
|
||||
* @return true is the #LIB_ID is valid.
|
||||
*
|
||||
*/
|
||||
bool IsValid() const
|
||||
{
|
||||
|
@ -191,7 +196,6 @@ public:
|
|||
* library nickname, library entry name, and revision strings respectively.
|
||||
*
|
||||
* @param aLibId is the LIB_ID to compare against.
|
||||
*
|
||||
* @return -1 if less than \a aLibId, 1 if greater than \a aLibId, and 0 if equal to \a aLibId.
|
||||
*/
|
||||
int compare( const LIB_ID& aLibId ) const;
|
||||
|
@ -228,7 +232,7 @@ public:
|
|||
|
||||
protected:
|
||||
/**
|
||||
* Tests whether a unicode character is a legal LIB_ID item name character.
|
||||
* Tests whether a Unicode character is a legal LIB_ID item name character.
|
||||
*
|
||||
* The criteria for legal LIB_ID character is as follows:
|
||||
* - For both symbol and footprint names, neither '/' or ':' are legal. They are
|
||||
|
@ -247,16 +251,16 @@ protected:
|
|||
* name is not the file name.
|
||||
*
|
||||
*
|
||||
* @note @a aUniChar is expected to be a 32 bit unicode character, not a UTF8 char, that use
|
||||
* a variable length coding value.
|
||||
* @note @a aUniChar is expected to be a 32 bit Unicode character, not a UTF8 char, that use
|
||||
* a variable length coding value.
|
||||
*/
|
||||
static bool isLegalChar( unsigned aUniChar );
|
||||
|
||||
/**
|
||||
* Tests whether a unicode character is a legal LIB_ID library nickname character
|
||||
* Tests whether a Unicode character is a legal LIB_ID library nickname character
|
||||
*
|
||||
* @note @a aUniChar is expected to be a 32 bit unicode character, not a UTF8 char, that use
|
||||
* a variable length coding value.
|
||||
* @note @a aUniChar is expected to be a 32 bit Unicode character, not a UTF8 char, that use
|
||||
* a variable length coding value.
|
||||
*/
|
||||
static bool isLegalLibraryNameChar( unsigned aUniChar );
|
||||
|
||||
|
|
|
@ -276,11 +276,7 @@ private:
|
|||
*/
|
||||
class LIB_TABLE : public PROJECT::_ELEM
|
||||
{
|
||||
friend class PANEL_FP_LIB_TABLE;
|
||||
friend class LIB_TABLE_GRID;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Parse the #LIB_TABLE_LEXER s-expression library table format into the appropriate
|
||||
* #LIB_TABLE_ROW objects.
|
||||
|
@ -493,7 +489,6 @@ public:
|
|||
static UTF8 FormatOptions( const PROPERTIES* aProperties );
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Return a #LIB_TABLE_ROW if \a aNickname is found in this table or in any chained
|
||||
* fallBack table fragment, else NULL.
|
||||
|
@ -517,6 +512,11 @@ protected:
|
|||
reindex();
|
||||
}
|
||||
|
||||
private:
|
||||
friend class PANEL_FP_LIB_TABLE;
|
||||
friend class LIB_TABLE_GRID;
|
||||
|
||||
protected:
|
||||
LIB_TABLE_ROWS rows;
|
||||
|
||||
/// this is a non-owning index into the LIB_TABLE_ROWS table
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2017 Chris Pavlina <pavlina.chris@gmail.com>
|
||||
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
|
||||
* Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2014-2020 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
|
||||
|
@ -75,37 +75,6 @@ class EDA_COMBINED_MATCHER;
|
|||
class LIB_TREE_NODE
|
||||
{
|
||||
public:
|
||||
enum TYPE {
|
||||
ROOT, LIB, LIBID, UNIT, INVALID
|
||||
};
|
||||
|
||||
typedef std::vector<std::unique_ptr<LIB_TREE_NODE>> PTR_VECTOR;
|
||||
|
||||
LIB_TREE_NODE* m_Parent; // Parent node or null
|
||||
PTR_VECTOR m_Children; // List of child nodes
|
||||
enum TYPE m_Type; // Node type
|
||||
|
||||
/**
|
||||
* The rank of the item before any search terms are applied. This is
|
||||
* a fairly expensive sort (involving string compares) so it helps to
|
||||
* store the result of that sort.
|
||||
*/
|
||||
int m_IntrinsicRank;
|
||||
|
||||
int m_Score; // The score of an item resulting from the search algorithm.
|
||||
bool m_Pinned; // Item should appear at top when there is no search string
|
||||
|
||||
wxString m_Name; // Actual name of the part
|
||||
wxString m_Desc; // Description to be displayed
|
||||
wxString m_MatchName; // Normalized name for matching
|
||||
wxString m_SearchText; // Descriptive text to search
|
||||
bool m_Normalized; // Support for lazy normalization.
|
||||
|
||||
|
||||
LIB_ID m_LibId; // LIB_ID determined by the parent library nickname and alias name.
|
||||
int m_Unit; // Actual unit, or zero
|
||||
bool m_IsRoot; // Indicates if the symbol is a root symbol instead of an alias.
|
||||
|
||||
/**
|
||||
* Update the score for this part. This is accumulative - it will be
|
||||
* called once per search term.
|
||||
|
@ -138,6 +107,37 @@ public:
|
|||
|
||||
LIB_TREE_NODE();
|
||||
virtual ~LIB_TREE_NODE() {}
|
||||
|
||||
enum TYPE {
|
||||
ROOT, LIB, LIBID, UNIT, INVALID
|
||||
};
|
||||
|
||||
typedef std::vector<std::unique_ptr<LIB_TREE_NODE>> PTR_VECTOR;
|
||||
|
||||
LIB_TREE_NODE* m_Parent; // Parent node or null
|
||||
PTR_VECTOR m_Children; // List of child nodes
|
||||
enum TYPE m_Type; // Node type
|
||||
|
||||
/**
|
||||
* The rank of the item before any search terms are applied. This is
|
||||
* a fairly expensive sort (involving string compares) so it helps to
|
||||
* store the result of that sort.
|
||||
*/
|
||||
int m_IntrinsicRank;
|
||||
|
||||
int m_Score; // The score of an item resulting from the search algorithm.
|
||||
bool m_Pinned; // Item should appear at top when there is no search string
|
||||
|
||||
wxString m_Name; // Actual name of the part
|
||||
wxString m_Desc; // Description to be displayed
|
||||
wxString m_MatchName; // Normalized name for matching
|
||||
wxString m_SearchText; // Descriptive text to search
|
||||
bool m_Normalized; // Support for lazy normalization.
|
||||
|
||||
|
||||
LIB_ID m_LibId; // LIB_ID determined by the parent library nickname and alias name.
|
||||
int m_Unit; // Actual unit, or zero
|
||||
bool m_IsRoot; // Indicates if the symbol is a root symbol instead of an alias.
|
||||
};
|
||||
|
||||
|
||||
|
@ -146,7 +146,6 @@ public:
|
|||
*/
|
||||
class LIB_TREE_NODE_UNIT: public LIB_TREE_NODE
|
||||
{
|
||||
|
||||
public:
|
||||
/**
|
||||
* The addresses of CMP_TREE_NODEs are used as unique IDs for the
|
||||
|
@ -155,7 +154,6 @@ public:
|
|||
LIB_TREE_NODE_UNIT( LIB_TREE_NODE_UNIT const& _ ) = delete;
|
||||
void operator=( LIB_TREE_NODE_UNIT const& _ ) = delete;
|
||||
|
||||
|
||||
/**
|
||||
* Construct a unit node.
|
||||
*
|
||||
|
@ -189,7 +187,6 @@ public:
|
|||
LIB_TREE_NODE_LIB_ID( LIB_TREE_NODE_LIB_ID const& _ ) = delete;
|
||||
void operator=( LIB_TREE_NODE_LIB_ID const& _ ) = delete;
|
||||
|
||||
|
||||
/**
|
||||
* Construct a #LIB_ID node.
|
||||
*
|
||||
|
@ -237,7 +234,6 @@ public:
|
|||
LIB_TREE_NODE_LIB( LIB_TREE_NODE_LIB const& _ ) = delete;
|
||||
void operator=( LIB_TREE_NODE_LIB const& _ ) = delete;
|
||||
|
||||
|
||||
/**
|
||||
* Construct an empty library node.
|
||||
*
|
||||
|
|
|
@ -271,8 +271,6 @@ protected:
|
|||
static LIB_TREE_NODE* ToNode( wxDataViewItem aItem );
|
||||
static unsigned int IntoArray( LIB_TREE_NODE const& aNode, wxDataViewItemArray& aChildren );
|
||||
|
||||
LIB_TREE_NODE_ROOT m_tree;
|
||||
|
||||
/**
|
||||
* Creates the adapter
|
||||
* @param aParent is the parent frame
|
||||
|
@ -331,7 +329,7 @@ protected:
|
|||
* @param aItem item to get formatting for
|
||||
* @param aCol column number of interest
|
||||
* @param aAttr receiver for attributes
|
||||
* @return true iff the item has non-default attributes
|
||||
* @return true if the item has non-default attributes
|
||||
*/
|
||||
bool GetAttr( wxDataViewItem const& aItem,
|
||||
unsigned int aCol,
|
||||
|
@ -340,7 +338,7 @@ protected:
|
|||
/**
|
||||
* @return a unicode string to mark a node name like
|
||||
* a pinned library name
|
||||
* This is not an ascii7 char, but a unicode char
|
||||
* This is not an ASCII7 char, but a unicode char
|
||||
*/
|
||||
const wxString GetPinningSymbol() const
|
||||
{
|
||||
|
@ -348,22 +346,6 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
EDA_BASE_FRAME* m_parent;
|
||||
|
||||
CMP_FILTER_TYPE m_filter;
|
||||
bool m_show_units;
|
||||
LIB_ID m_preselect_lib_id;
|
||||
int m_preselect_unit;
|
||||
int m_freeze;
|
||||
|
||||
wxDataViewColumn* m_col_part;
|
||||
wxDataViewColumn* m_col_desc;
|
||||
wxDataViewCtrl* m_widget;
|
||||
|
||||
int m_colWidths[NUM_COLS];
|
||||
wxArrayString m_pinnedLibs;
|
||||
wxString m_pinnedKey;
|
||||
|
||||
/**
|
||||
* Find any results worth highlighting and expand them, according to given criteria
|
||||
* The highest-scoring node is written to aHighScore
|
||||
|
@ -385,6 +367,26 @@ private:
|
|||
* Find and expand a library if there is only one. Return the best match (if any).
|
||||
*/
|
||||
LIB_TREE_NODE* ShowSingleLibrary();
|
||||
|
||||
protected:
|
||||
LIB_TREE_NODE_ROOT m_tree;
|
||||
|
||||
private:
|
||||
EDA_BASE_FRAME* m_parent;
|
||||
|
||||
CMP_FILTER_TYPE m_filter;
|
||||
bool m_show_units;
|
||||
LIB_ID m_preselect_lib_id;
|
||||
int m_preselect_unit;
|
||||
int m_freeze;
|
||||
|
||||
wxDataViewColumn* m_col_part;
|
||||
wxDataViewColumn* m_col_desc;
|
||||
wxDataViewCtrl* m_widget;
|
||||
|
||||
int m_colWidths[NUM_COLS];
|
||||
wxArrayString m_pinnedLibs;
|
||||
wxString m_pinnedKey;
|
||||
};
|
||||
|
||||
#endif // LIB_TREE_MODEL_ADAPTER_H
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-2020 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
|
||||
|
@ -35,15 +35,13 @@
|
|||
class wxSingleInstanceChecker;
|
||||
|
||||
/**
|
||||
* Function LockFile
|
||||
* tests to see if aFileName can be locked (is not already locked) and only then
|
||||
* Test to see if \a aFileName can be locked (is not already locked) and only then
|
||||
* returns a wxSingleInstanceChecker protecting aFileName.
|
||||
*/
|
||||
std::unique_ptr<wxSingleInstanceChecker> LockFile( const wxString& aFileName );
|
||||
|
||||
/**
|
||||
* Function GetKicadLockFilePath
|
||||
* @return A wxString containing the path for lockfiles in Kicad
|
||||
* @return A wxString containing the path for lockfiles in Kicad.
|
||||
*/
|
||||
wxString GetKicadLockFilePath();
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
void DoLogRecord( wxLogLevel aLevel, const wxString& aMsg, const wxLogRecordInfo& aInfo ) override
|
||||
void DoLogRecord( wxLogLevel aLevel, const wxString& aMsg,
|
||||
const wxLogRecordInfo& aInfo ) override
|
||||
{
|
||||
// Only forward the message if it is a trace message
|
||||
if( aLevel == wxLOG_Trace )
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
#define KI_FALLTHROUGH [[clang::fallthrough]]
|
||||
|
||||
#elif KI_HAS_CPP_ATTRIBUTE( gnu::fallthrough )
|
||||
// GNU-specific C++ attribute to sliencing the warning
|
||||
// GNU-specific C++ attribute to silencing the warning
|
||||
#define KI_FALLTHROUGH [[gnu::fallthrough]]
|
||||
|
||||
#elif defined( __GNUC__ ) && __GNUC__ >= 7
|
||||
|
@ -85,17 +85,19 @@
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Macro TO_UTF8
|
||||
* converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
|
||||
* Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
|
||||
*
|
||||
* wxstring is a wxString, not a wxT() or _(). The scope of the return value
|
||||
* is very limited and volatile, but can be used with printf() style functions well.
|
||||
* NOTE: Trying to convert it to a function is tricky because of the
|
||||
* type of the parameter!
|
||||
*
|
||||
* @note Trying to convert it to a function is tricky because of the type of the
|
||||
* parameter!
|
||||
*/
|
||||
#define TO_UTF8( wxstring ) ( (const char*) (wxstring).utf8_str() )
|
||||
|
||||
/**
|
||||
* Stringifies the given parameter by placing in quotes
|
||||
* Stringifies the given parameter by placing in quotes.
|
||||
*
|
||||
* @param cstring STRING (no spaces)
|
||||
* @return "STRING"
|
||||
*/
|
||||
|
@ -103,8 +105,7 @@
|
|||
#define TO_STR(x) TO_STR2(x)
|
||||
|
||||
/**
|
||||
* function FROM_UTF8
|
||||
* converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
|
||||
* Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
|
||||
*/
|
||||
static inline wxString FROM_UTF8( const char* cstring )
|
||||
{
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
#define MAIL_TYPE_H_
|
||||
|
||||
/**
|
||||
* Enum MAIL_T
|
||||
* is the set of mail types sendable via KIWAY::ExpressMail() and supplied as
|
||||
* the @a aCommand parameter to that function. Such mail will be received in
|
||||
* KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent ) and aEvent.Command() will
|
||||
* match aCommand to KIWAY::ExpressMail().
|
||||
* The set of mail types sendable via #KIWAY::ExpressMail() and supplied as
|
||||
* the @a aCommand parameter to that function.
|
||||
*
|
||||
* Such mail will be received in KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent ) and
|
||||
* aEvent.Command() will match aCommand to KIWAY::ExpressMail().
|
||||
*/
|
||||
enum MAIL_T
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2014 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 2009-2020 KiCad Developers, see CHANGELOG.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
|
||||
|
@ -46,8 +46,6 @@ using KIGFX::RENDER_SETTINGS;
|
|||
/*
|
||||
* Marker are mainly used to show a DRC or ERC error or warning
|
||||
*/
|
||||
|
||||
|
||||
class MARKER_BASE
|
||||
{
|
||||
public:
|
||||
|
@ -58,50 +56,37 @@ public:
|
|||
MARKER_SIMUL
|
||||
};
|
||||
|
||||
wxPoint m_Pos; ///< position of the marker
|
||||
|
||||
protected:
|
||||
TYPEMARKER m_markerType; // The type of marker (useful to filter markers)
|
||||
bool m_excluded; // User has excluded this specific error
|
||||
std::shared_ptr<RC_ITEM> m_rcItem;
|
||||
|
||||
int m_scalingFactor; // Scaling factor to convert corners coordinates
|
||||
// to internat units coordinates
|
||||
EDA_RECT m_shapeBoundingBox; // Bounding box of the graphic symbol, relative
|
||||
// to the position of the shape, in marker shape
|
||||
// units
|
||||
|
||||
public:
|
||||
|
||||
MARKER_BASE( int aScalingFactor, std::shared_ptr<RC_ITEM> aItem, TYPEMARKER aType = MARKER_UNSPEC );
|
||||
MARKER_BASE( int aScalingFactor, std::shared_ptr<RC_ITEM> aItem,
|
||||
TYPEMARKER aType = MARKER_UNSPEC );
|
||||
virtual ~MARKER_BASE();
|
||||
|
||||
/** The scaling factor to convert polygonal shape coordinates to internal units
|
||||
/**
|
||||
* The scaling factor to convert polygonal shape coordinates to internal units.
|
||||
*/
|
||||
int MarkerScale() const { return m_scalingFactor; }
|
||||
|
||||
/** Returns the shape polygon in internal units in a SHAPE_LINE_CHAIN
|
||||
* the coordinates are relatives to the marker position (are not absolute)
|
||||
* @param aPolygon is the SHAPE_LINE_CHAIN to fill with the shape
|
||||
/**
|
||||
* Return the shape polygon in internal units in a #SHAPE_LINE_CHAIN the coordinates
|
||||
* are relatives to the marker position (are not absolute).
|
||||
*
|
||||
* @param aPolygon is the #SHAPE_LINE_CHAIN to fill with the shape.
|
||||
*/
|
||||
void ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon, int aScale = -1 ) const;
|
||||
|
||||
/**
|
||||
* Function PrintMarker
|
||||
* Prints the shape is the polygon defined in m_Corners (array of wxPoints).
|
||||
* Print the shape is the polygon defined in m_Corners (array of wxPoints).
|
||||
*/
|
||||
void PrintMarker( RENDER_SETTINGS* aSettings, const wxPoint& aOffset );
|
||||
|
||||
/**
|
||||
* Function GetPos
|
||||
* @return the position of this MARKER in internal units.
|
||||
* @return the position of this marker in internal units.
|
||||
*/
|
||||
const wxPoint& GetPos() const { return m_Pos; }
|
||||
|
||||
virtual const KIID GetUUID() const = 0;
|
||||
|
||||
/**
|
||||
* accessors to set/get marker type (DRC, ERC, or other)
|
||||
* Accessors to set/get marker type (DRC, ERC, or other)
|
||||
*/
|
||||
void SetMarkerType( enum TYPEMARKER aMarkerType ) { m_markerType = aMarkerType; }
|
||||
enum TYPEMARKER GetMarkerType() const { return m_markerType; }
|
||||
|
@ -110,25 +95,21 @@ public:
|
|||
void SetExcluded( bool aExcluded ) { m_excluded = aExcluded; }
|
||||
|
||||
/**
|
||||
* Function GetReporter
|
||||
* returns the DRC_ITEM held within this MARKER so that its
|
||||
* interface may be used.
|
||||
* @return const& DRC_ITEM
|
||||
* @return the #RC_ITEM held within this marker so that its interface may be used.
|
||||
*/
|
||||
|
||||
// fixme: use shared_ptr
|
||||
std::shared_ptr<RC_ITEM> GetRCItem() const { return m_rcItem; }
|
||||
|
||||
/**
|
||||
* Tests if the given wxPoint is within the bounds of this object.
|
||||
* @param aHitPosition is the wxPoint to test (in internal units)
|
||||
* @return bool - true if a hit, else false
|
||||
* Test if the given wxPoint is within the bounds of this object.
|
||||
*
|
||||
* @param aHitPosition is the wxPoint to test (in internal units).
|
||||
* @return true if a hit, else false.
|
||||
*/
|
||||
bool HitTestMarker( const wxPoint& aHitPosition, int aAccuracy ) const;
|
||||
|
||||
/**
|
||||
* Function GetBoundingBoxMarker
|
||||
* returns the orthogonal, bounding box of this object for display purposes.
|
||||
* Return the orthogonal, bounding box of this object for display purposes.
|
||||
*
|
||||
* This box should be an enclosing perimeter for visible components of this
|
||||
* object, and the units should be in the pcb or schematic coordinate system.
|
||||
* It is OK to overestimate the size by a few counts.
|
||||
|
@ -137,6 +118,20 @@ public:
|
|||
|
||||
protected:
|
||||
virtual KIGFX::COLOR4D getColor() const = 0;
|
||||
|
||||
public:
|
||||
wxPoint m_Pos; ///< position of the marker
|
||||
|
||||
protected:
|
||||
TYPEMARKER m_markerType; // The type of marker (useful to filter markers)
|
||||
bool m_excluded; // User has excluded this specific error
|
||||
std::shared_ptr<RC_ITEM> m_rcItem;
|
||||
|
||||
int m_scalingFactor; // Scaling factor to convert corners coordinates
|
||||
// to internal units coordinates
|
||||
EDA_RECT m_shapeBoundingBox; // Bounding box of the graphic symbol, relative
|
||||
// to the position of the shape, in marker shape
|
||||
// units
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004-2017 KiCad Developers.
|
||||
* Copyright (C) 2004-2020 KiCad Developers.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -26,8 +26,7 @@
|
|||
|
||||
/**
|
||||
* @file menus_helpers.h
|
||||
* @brief Usefull macros and inline functions to create menus items
|
||||
* in menubars or popup menus
|
||||
* @brief Macros and inline functions to create menus items in menubars or popup menus.
|
||||
*/
|
||||
|
||||
|
||||
|
@ -41,36 +40,34 @@ class TOOL_INTERACTIVE;
|
|||
void AddMenuLanguageList( ACTION_MENU* aMasterMenu, TOOL_INTERACTIVE* aControlTool );
|
||||
|
||||
/**
|
||||
* Add a bitmap to a menuitem
|
||||
* Add a bitmap to a menuitem.
|
||||
*
|
||||
* It is added only if use images in menus config option allows it. For wxITEM_CHECK
|
||||
* or wxITEM_RADIO menuitems, the bitmap is added only on Windows, other platforms do
|
||||
* not support it
|
||||
*
|
||||
* @param aMenu is the menuitem.
|
||||
* @param aImage is the icon to add to aMenu.
|
||||
* It is added only if use images in menus config option allows it.
|
||||
* For wxITEM_CHECK or wxITEM_RADIO menuitems, the bitmap is added only
|
||||
* on Windows, other platforms do not support it
|
||||
*/
|
||||
void AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmap& aImage );
|
||||
|
||||
|
||||
/**
|
||||
* Function AddMenuItem
|
||||
* is an inline helper function to create and insert a menu item with an icon
|
||||
* into \a aMenu
|
||||
* Create and insert a menu item with an icon into \a aMenu.
|
||||
*
|
||||
* @param aMenu is the menu to add the new item.
|
||||
* @param aId is the command ID for the new menu item.
|
||||
* @param aText is the string for the new menu item.
|
||||
* @param aImage is the icon to add to the new menu item.
|
||||
* @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
|
||||
* @return a pointer to the new created wxMenuItem
|
||||
* @return a pointer to the new created wxMenuItem.
|
||||
*/
|
||||
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
|
||||
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
|
||||
const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL );
|
||||
|
||||
|
||||
/**
|
||||
* Function AddMenuItem
|
||||
* is an inline helper function to create and insert a menu item with an icon
|
||||
* and a help message string into \a aMenu
|
||||
* Create and insert a menu item with an icon and a help message string into \a aMenu.
|
||||
*
|
||||
* @param aMenu is the menu to add the new item.
|
||||
* @param aId is the command ID for the new menu item.
|
||||
|
@ -78,33 +75,30 @@ wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
|
|||
* @param aHelpText is the help message string for the new menu item.
|
||||
* @param aImage is the icon to add to the new menu item.
|
||||
* @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
|
||||
* @return a pointer to the new created wxMenuItem
|
||||
* @return a pointer to the new created wxMenuItem.
|
||||
*/
|
||||
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
|
||||
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
|
||||
const wxString& aHelpText, const wxBitmap& aImage,
|
||||
wxItemKind aType = wxITEM_NORMAL );
|
||||
|
||||
|
||||
/**
|
||||
* Function AddMenuItem
|
||||
* is an inline helper function to create and insert a menu item with an icon
|
||||
* into \a aSubMenu in \a aMenu
|
||||
* Create and insert a menu item with an icon into \a aSubMenu in \a aMenu.
|
||||
*
|
||||
* @param aMenu is the menu to add the new submenu item.
|
||||
* @param aSubMenu is the submenu to add the new menu.
|
||||
* @param aId is the command ID for the new menu item.
|
||||
* @param aText is the string for the new menu item.
|
||||
* @param aImage is the icon to add to the new menu item.
|
||||
* @return a pointer to the new created wxMenuItem
|
||||
* @return a pointer to the new created wxMenuItem,
|
||||
*/
|
||||
wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
|
||||
const wxString& aText, const wxBitmap& aImage );
|
||||
|
||||
|
||||
/**
|
||||
* Function AddMenuItem
|
||||
* is an inline helper function to create and insert a menu item with an icon
|
||||
* and a help message string into \a aSubMenu in \a aMenu
|
||||
* Create and insert a menu item with an icon and a help message string into
|
||||
* \a aSubMenu in \a aMenu.
|
||||
*
|
||||
* @param aMenu is the menu to add the new submenu item.
|
||||
* @param aSubMenu is the submenu to add the new menu.
|
||||
|
@ -112,7 +106,7 @@ wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
|
|||
* @param aText is the string for the new menu item.
|
||||
* @param aHelpText is the help message string for the new menu item.
|
||||
* @param aImage is the icon to add to the new menu item.
|
||||
* @return a pointer to the new created wxMenuItem
|
||||
* @return a pointer to the new created wxMenuItem.
|
||||
*/
|
||||
wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
|
||||
const wxString& aText, const wxString& aHelpText,
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright 2017 CERN
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
* @author Bernhard Stegmaier <stegmaier@sw-systems.de>
|
||||
*
|
||||
|
@ -48,14 +50,16 @@ public:
|
|||
* or to return data for the whole container.
|
||||
*/
|
||||
static constexpr int UNDEFINED_TYPE = 0;
|
||||
static_assert( FIRST_TYPE_VAL > UNDEFINED_TYPE, "FIRST_TYPE_VAL has to be greater than UNDEFINED_TYPE" );
|
||||
static_assert( FIRST_TYPE_VAL < LAST_TYPE_VAL, "FIRST_TYPE_VAL has to be greater than LAST_TYPE_VAL" );
|
||||
static_assert( FIRST_TYPE_VAL > UNDEFINED_TYPE,
|
||||
"FIRST_TYPE_VAL has to be greater than UNDEFINED_TYPE" );
|
||||
static_assert( FIRST_TYPE_VAL < LAST_TYPE_VAL,
|
||||
"FIRST_TYPE_VAL has to be greater than LAST_TYPE_VAL" );
|
||||
|
||||
/**
|
||||
* Helper for defining a list of library draw object pointers. The Boost
|
||||
* pointer containers are responsible for deleting object pointers placed
|
||||
* in them. If you access a object pointer from the list, do not delete
|
||||
* it directly.
|
||||
* Helper for defining a list of library draw object pointers.
|
||||
*
|
||||
* The Boost pointer containers are responsible for deleting object pointers placed
|
||||
* in them. If you access a object pointer from the list, do not delete it directly.
|
||||
*/
|
||||
typedef boost::ptr_vector<T> ITEM_PTR_VECTOR;
|
||||
|
||||
|
@ -157,9 +161,11 @@ public:
|
|||
};
|
||||
|
||||
///> The non-const iterator
|
||||
typedef ITERATOR_BASE<T, MULTIVECTOR<T, FIRST_TYPE_VAL, LAST_TYPE_VAL>, typename ITEM_PTR_VECTOR::iterator> ITERATOR;
|
||||
typedef ITERATOR_BASE<T, MULTIVECTOR<T, FIRST_TYPE_VAL, LAST_TYPE_VAL>,
|
||||
typename ITEM_PTR_VECTOR::iterator> ITERATOR;
|
||||
///> The const iterator
|
||||
typedef ITERATOR_BASE<const T, const MULTIVECTOR<T, FIRST_TYPE_VAL, LAST_TYPE_VAL>, typename ITEM_PTR_VECTOR::const_iterator> CONST_ITERATOR;
|
||||
typedef ITERATOR_BASE<const T, const MULTIVECTOR<T, FIRST_TYPE_VAL, LAST_TYPE_VAL>,
|
||||
typename ITEM_PTR_VECTOR::const_iterator> CONST_ITERATOR;
|
||||
|
||||
|
||||
MULTIVECTOR()
|
||||
|
|
|
@ -41,48 +41,17 @@ DECL_SET_FOR_SWIG( STRINGSET, wxString )
|
|||
|
||||
|
||||
/**
|
||||
* NETCLASS
|
||||
* handles a collection of nets and the parameters used to route or
|
||||
* test these nets.
|
||||
* A collection of nets and the parameters used to route or test these nets.
|
||||
*/
|
||||
|
||||
class NETCLASS
|
||||
{
|
||||
protected:
|
||||
wxString m_Name; ///< Name of the net class
|
||||
wxString m_Description; ///< what this NETCLASS is for.
|
||||
|
||||
STRINGSET m_Members; ///< names of NET members of this class
|
||||
|
||||
/// The units on these parameters is Internal Units (1 nm)
|
||||
|
||||
OPT<int> m_Clearance; ///< clearance when routing
|
||||
|
||||
OPT<int> m_TrackWidth; ///< track width used to route NETs in this NETCLASS
|
||||
OPT<int> m_ViaDia; ///< via diameter
|
||||
OPT<int> m_ViaDrill; ///< via drill hole diameter
|
||||
|
||||
OPT<int> m_uViaDia; ///< microvia diameter
|
||||
OPT<int> m_uViaDrill; ///< microvia drill hole diameter
|
||||
|
||||
OPT<int> m_diffPairWidth;
|
||||
OPT<int> m_diffPairGap;
|
||||
OPT<int> m_diffPairViaGap;
|
||||
|
||||
int m_wireWidth;
|
||||
int m_busWidth;
|
||||
COLOR4D m_schematicColor;
|
||||
int m_lineStyle;
|
||||
|
||||
COLOR4D m_PcbColor; ///< Optional color override for this netclass (PCB context)
|
||||
|
||||
public:
|
||||
static const char Default[]; ///< the name of the default NETCLASS
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* stuffs a NETCLASS instance with aParent, aName, and optionally the initialParameters
|
||||
* @param aName = the name of this new netclass
|
||||
* Create a NETCLASS instance with \a aName.
|
||||
*
|
||||
* @param aName is the name of this new netclass.
|
||||
*/
|
||||
NETCLASS( const wxString& aName );
|
||||
|
||||
|
@ -97,8 +66,7 @@ public:
|
|||
void SetName( const wxString& aName ) { m_Name = aName; }
|
||||
|
||||
/**
|
||||
* Function GetCount
|
||||
* returns the number of nets in this NETCLASS, i.e. using these rules.
|
||||
* Return the number of nets in this NETCLASS, i.e. using these rules.
|
||||
*/
|
||||
unsigned GetCount() const
|
||||
{
|
||||
|
@ -106,8 +74,7 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function Clear
|
||||
* empties the collection of members.
|
||||
* Empties the collection of members.
|
||||
*/
|
||||
void Clear()
|
||||
{
|
||||
|
@ -115,8 +82,8 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function Add
|
||||
* adds \a aNetname to this NETCLASS if it is not already in this NETCLASS.
|
||||
* Adds \a aNetname to this NETCLASS if it is not already in this NETCLASS.
|
||||
*
|
||||
* It is harmless to try and add a second identical name.
|
||||
*/
|
||||
void Add( const wxString& aNetname )
|
||||
|
@ -133,8 +100,7 @@ public:
|
|||
const_iterator end() const { return m_Members.end(); }
|
||||
|
||||
/**
|
||||
* Function Remove
|
||||
* will remove NET name \a aName from the collection of members.
|
||||
* Remove NET \a aName from the collection of members.
|
||||
*/
|
||||
void Remove( iterator aName )
|
||||
{
|
||||
|
@ -142,8 +108,7 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function Remove
|
||||
* will remove NET name \a aName from the collection of members.
|
||||
* Remove NET \a aName from the collection of members.
|
||||
*/
|
||||
void Remove( const wxString& aName )
|
||||
{
|
||||
|
@ -209,6 +174,34 @@ public:
|
|||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
wxString m_Name; ///< Name of the net class
|
||||
wxString m_Description; ///< what this NETCLASS is for.
|
||||
|
||||
STRINGSET m_Members; ///< names of NET members of this class
|
||||
|
||||
/// The units on these parameters is Internal Units (1 nm)
|
||||
|
||||
OPT<int> m_Clearance; ///< clearance when routing
|
||||
|
||||
OPT<int> m_TrackWidth; ///< track width used to route NETs in this NETCLASS
|
||||
OPT<int> m_ViaDia; ///< via diameter
|
||||
OPT<int> m_ViaDrill; ///< via drill hole diameter
|
||||
|
||||
OPT<int> m_uViaDia; ///< microvia diameter
|
||||
OPT<int> m_uViaDrill; ///< microvia drill hole diameter
|
||||
|
||||
OPT<int> m_diffPairWidth;
|
||||
OPT<int> m_diffPairGap;
|
||||
OPT<int> m_diffPairViaGap;
|
||||
|
||||
int m_wireWidth;
|
||||
int m_busWidth;
|
||||
COLOR4D m_schematicColor;
|
||||
int m_lineStyle;
|
||||
|
||||
COLOR4D m_PcbColor; ///< Optional color override for this netclass (PCB context)
|
||||
};
|
||||
|
||||
|
||||
|
@ -217,24 +210,20 @@ DECL_MAP_FOR_SWIG( NETCLASS_MAP, wxString, NETCLASSPTR )
|
|||
|
||||
|
||||
/**
|
||||
* NETCLASSES
|
||||
* is a container for NETCLASS instances. It owns all its NETCLASSes. This container will
|
||||
* always have a default NETCLASS with the name given by const NETCLASS::Default.
|
||||
* A container for NETCLASS instances.
|
||||
*
|
||||
* It owns all its NETCLASSes. This container will always have a default NETCLASS with the
|
||||
* name given by const NETCLASS::Default.
|
||||
*/
|
||||
class NETCLASSES
|
||||
{
|
||||
private:
|
||||
NETCLASS_MAP m_NetClasses; // All the netclasses EXCEPT the default one
|
||||
NETCLASSPTR m_default;
|
||||
|
||||
public:
|
||||
NETCLASSES();
|
||||
~NETCLASSES();
|
||||
|
||||
/**
|
||||
* Function Clear
|
||||
* destroys any contained NETCLASS instances except the Default one, and clears any
|
||||
* members from the Default one.
|
||||
* Destroy any contained NETCLASS instances except the default one, and clears any
|
||||
* members from the default one.
|
||||
*/
|
||||
void Clear()
|
||||
{
|
||||
|
@ -251,8 +240,7 @@ public:
|
|||
const_iterator end() const { return m_NetClasses.end(); }
|
||||
|
||||
/**
|
||||
* Function GetCount
|
||||
* @return the number of netclasses, excluding the default one.
|
||||
* @return the number of netclasses excluding the default one.
|
||||
*/
|
||||
unsigned GetCount() const
|
||||
{
|
||||
|
@ -260,7 +248,6 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function GetDefault
|
||||
* @return the default net class.
|
||||
*/
|
||||
NETCLASSPTR GetDefault() const
|
||||
|
@ -274,32 +261,37 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function Add
|
||||
* takes \a aNetclass and puts it into this NETCLASSES container.
|
||||
* Add \a aNetclass and puts it into this NETCLASSES container.
|
||||
*
|
||||
* @param aNetclass is netclass to add
|
||||
* @return true if the name within aNetclass is unique and it could be inserted OK,
|
||||
* else false because the name was not unique.
|
||||
* else false because the name was not unique.
|
||||
*/
|
||||
bool Add( const NETCLASSPTR& aNetclass );
|
||||
|
||||
/**
|
||||
* Function Remove
|
||||
* removes a NETCLASS from this container but does not destroy/delete it.
|
||||
* Remove a #NETCLASS from this container but does not destroy/delete it.
|
||||
*
|
||||
* @param aNetName is the name of the net to delete, and it may not be NETCLASS::Default.
|
||||
* @return NETCLASSPTR - the NETCLASS associated with aNetName if found and removed, else NULL.
|
||||
* @return a pointer to the #NETCLASS associated with \a aNetName if found and removed,
|
||||
* else NULL.
|
||||
*/
|
||||
NETCLASSPTR Remove( const wxString& aNetName );
|
||||
|
||||
/**
|
||||
* Function Find
|
||||
* searches this container for a NETCLASS given by \a aName.
|
||||
* @param aName is the name of the NETCLASS to search for.
|
||||
* @return NETCLASSPTR - if found, else NULL.
|
||||
* Search this container for a NETCLASS given by \a aName.
|
||||
*
|
||||
* @param aName is the name of the #NETCLASS to search for.
|
||||
* @return a pointer to the #NETCLASS if found, else NULL.
|
||||
*/
|
||||
NETCLASSPTR Find( const wxString& aName ) const;
|
||||
|
||||
/// Provide public access to m_NetClasses so it gets swigged.
|
||||
NETCLASS_MAP& NetClasses() { return m_NetClasses; }
|
||||
|
||||
private:
|
||||
NETCLASS_MAP m_NetClasses; // All the netclasses EXCEPT the default one
|
||||
NETCLASSPTR m_default;
|
||||
};
|
||||
|
||||
#endif // CLASS_NETCLASS_H
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Kicad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2016-20 Kicad Developers, see change_log.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
|
||||
|
@ -29,224 +29,223 @@
|
|||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
/*
|
||||
model subscriber implementation using links to represent connections.
|
||||
subscribers can be removed during notification.
|
||||
if no observers are registered, size is the size of a shared_ptr.
|
||||
*/
|
||||
/**
|
||||
* A model subscriber implementation using links to represent connections. Subscribers
|
||||
* can be removed during notification. If no observers are registered, size is the size
|
||||
* of a shared_ptr.
|
||||
*/
|
||||
namespace UTIL
|
||||
{
|
||||
class LINK;
|
||||
|
||||
namespace UTIL {
|
||||
namespace DETAIL
|
||||
{
|
||||
struct OBSERVABLE_BASE
|
||||
{
|
||||
public:
|
||||
OBSERVABLE_BASE();
|
||||
OBSERVABLE_BASE( OBSERVABLE_BASE& other );
|
||||
|
||||
class LINK;
|
||||
~OBSERVABLE_BASE();
|
||||
|
||||
namespace DETAIL {
|
||||
size_t size() const;
|
||||
|
||||
struct OBSERVABLE_BASE {
|
||||
public:
|
||||
OBSERVABLE_BASE();
|
||||
OBSERVABLE_BASE( OBSERVABLE_BASE& other );
|
||||
private:
|
||||
friend class UTIL::LINK;
|
||||
|
||||
~OBSERVABLE_BASE();
|
||||
struct IMPL
|
||||
{
|
||||
IMPL( OBSERVABLE_BASE* owned_by = nullptr );
|
||||
bool is_shared() const;
|
||||
void set_shared();
|
||||
~IMPL();
|
||||
|
||||
size_t size() const;
|
||||
void add_observer( void* observer );
|
||||
void remove_observer( void* observer );
|
||||
void collect();
|
||||
|
||||
private:
|
||||
friend class UTIL::LINK;
|
||||
|
||||
struct IMPL
|
||||
{
|
||||
IMPL( OBSERVABLE_BASE* owned_by = nullptr );
|
||||
bool is_shared() const;
|
||||
void set_shared();
|
||||
~IMPL();
|
||||
|
||||
void add_observer( void* observer );
|
||||
void remove_observer( void* observer );
|
||||
void collect();
|
||||
|
||||
bool is_iterating() const;
|
||||
|
||||
void enter_iteration();
|
||||
void leave_iteration();
|
||||
|
||||
std::vector<void*> observers_;
|
||||
unsigned int iteration_count_;
|
||||
OBSERVABLE_BASE* owned_by_;
|
||||
};
|
||||
|
||||
void allocate_impl();
|
||||
void allocate_shared_impl();
|
||||
|
||||
void deallocate_impl();
|
||||
|
||||
std::shared_ptr<IMPL> get_shared_impl();
|
||||
|
||||
protected:
|
||||
void on_observers_empty();
|
||||
bool is_iterating() const;
|
||||
|
||||
void enter_iteration();
|
||||
void leave_iteration();
|
||||
|
||||
void add_observer( void* observer );
|
||||
void remove_observer( void* observer );
|
||||
|
||||
std::shared_ptr<IMPL> impl_;
|
||||
std::vector<void*> observers_;
|
||||
unsigned int iteration_count_;
|
||||
OBSERVABLE_BASE* owned_by_;
|
||||
};
|
||||
|
||||
void allocate_impl();
|
||||
void allocate_shared_impl();
|
||||
|
||||
void deallocate_impl();
|
||||
|
||||
std::shared_ptr<IMPL> get_shared_impl();
|
||||
|
||||
protected:
|
||||
void on_observers_empty();
|
||||
|
||||
void enter_iteration();
|
||||
void leave_iteration();
|
||||
|
||||
void add_observer( void* observer );
|
||||
void remove_observer( void* observer );
|
||||
|
||||
std::shared_ptr<IMPL> impl_;
|
||||
};
|
||||
|
||||
} // namespace DETAIL
|
||||
|
||||
|
||||
/**
|
||||
* Simple RAII-handle to a subscription.
|
||||
*/
|
||||
class LINK
|
||||
{
|
||||
public:
|
||||
LINK();
|
||||
LINK( std::shared_ptr<DETAIL::OBSERVABLE_BASE::IMPL> token, void* observer );
|
||||
LINK( LINK&& other );
|
||||
LINK( const LINK& ) = delete;
|
||||
|
||||
void operator=( const LINK& ) = delete;
|
||||
LINK& operator=( LINK&& other );
|
||||
|
||||
void reset();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
~LINK();
|
||||
|
||||
private:
|
||||
std::shared_ptr<DETAIL::OBSERVABLE_BASE::IMPL> token_;
|
||||
void* observer_;
|
||||
};
|
||||
|
||||
|
||||
template <typename ObserverInterface>
|
||||
class OBSERVABLE : public DETAIL::OBSERVABLE_BASE
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct an observable with empty non-shared subscription list.
|
||||
*/
|
||||
OBSERVABLE() {}
|
||||
|
||||
/**
|
||||
* Construct an observable with a shared subscription list.
|
||||
*
|
||||
* @param aInherit Observable to share the subscription list with.
|
||||
*/
|
||||
OBSERVABLE( OBSERVABLE& aInherit ) : OBSERVABLE_BASE( aInherit ) {}
|
||||
|
||||
/**
|
||||
* Add a subscription without RAII link.
|
||||
*
|
||||
* @param aObserver Observer to subscribe.
|
||||
*/
|
||||
void SubscribeUnmanaged( ObserverInterface* aObserver )
|
||||
{
|
||||
OBSERVABLE_BASE::add_observer( static_cast<void*>( aObserver ) );
|
||||
}
|
||||
|
||||
//
|
||||
// Simple RAII-handle to a subscription.
|
||||
//
|
||||
class LINK {
|
||||
public:
|
||||
LINK();
|
||||
LINK( std::shared_ptr<DETAIL::OBSERVABLE_BASE::IMPL> token, void* observer );
|
||||
LINK( LINK&& other );
|
||||
LINK( const LINK& ) = delete;
|
||||
|
||||
void operator=( const LINK& ) = delete;
|
||||
LINK& operator=( LINK&& other );
|
||||
|
||||
void reset();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
~LINK();
|
||||
|
||||
private:
|
||||
std::shared_ptr<DETAIL::OBSERVABLE_BASE::IMPL> token_;
|
||||
void* observer_;
|
||||
};
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
template<typename ObserverInterface>
|
||||
class OBSERVABLE :
|
||||
public DETAIL::OBSERVABLE_BASE
|
||||
/**
|
||||
* Add a subscription returning an RAII link.
|
||||
*
|
||||
* @param aObserver observer to subscribe
|
||||
* @return RAII link controlling the lifetime of the subscription
|
||||
*/
|
||||
LINK Subscribe( ObserverInterface* aObserver )
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Function Observable()
|
||||
* Constructor. Constructs an observable with empty non-shared subscription list.
|
||||
*/
|
||||
OBSERVABLE() {}
|
||||
OBSERVABLE_BASE::add_observer( static_cast<void*>( aObserver ) );
|
||||
return LINK( impl_, static_cast<void*>( aObserver ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Observable(OBSERVABLE&)
|
||||
* Constructor. Constructs an observable with a shared subscription list.
|
||||
* @param aInherit Observable to share the subscription list with.
|
||||
*/
|
||||
OBSERVABLE( OBSERVABLE& aInherit )
|
||||
: OBSERVABLE_BASE( aInherit )
|
||||
{}
|
||||
/**
|
||||
* Cancel the subscription of a subscriber.
|
||||
*
|
||||
* This can be called during notification calls.
|
||||
*
|
||||
* @param aObserver observer to remove from the subscription list.
|
||||
*/
|
||||
void Unsubscribe( ObserverInterface* aObserver )
|
||||
{
|
||||
OBSERVABLE_BASE::remove_observer( static_cast<void*>( aObserver ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SubscribeUnmanaged
|
||||
* adds a subscription without RAII link.
|
||||
* @param aObserver Observer to subscribe
|
||||
*/
|
||||
void SubscribeUnmanaged( ObserverInterface* aObserver )
|
||||
/**
|
||||
* Notify event to all subscribed observers.
|
||||
*
|
||||
* @param Ptr is a pointer to method of the observer interface.
|
||||
* @param aArgs is a list of arguments to each notification call, will be perfectly forwarded.
|
||||
*/
|
||||
template <typename... Args1, typename... Args2>
|
||||
void Notify( void ( ObserverInterface::*Ptr )( Args1... ), Args2&&... aArgs )
|
||||
{
|
||||
static_assert( sizeof...( Args1 ) == sizeof...( Args2 ), "argument counts don't match" );
|
||||
|
||||
if( impl_ )
|
||||
{
|
||||
OBSERVABLE_BASE::add_observer( static_cast<void*>(aObserver) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Subscribe
|
||||
* adds a subscription returning an RAII link
|
||||
* @param aObserver observer to subscribe
|
||||
* @return RAII link controlling the lifetime of the subscription
|
||||
*/
|
||||
LINK Subscribe( ObserverInterface* aObserver ) {
|
||||
OBSERVABLE_BASE::add_observer( static_cast<void*>(aObserver) );
|
||||
return LINK( impl_, static_cast<void*>(aObserver) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Unsubscribe
|
||||
* cancels the subscription of a subscriber. Can be called during notification calls.
|
||||
* @param aObserver observer to remove from the subscription list
|
||||
*/
|
||||
void Unsubscribe( ObserverInterface* aObserver )
|
||||
{
|
||||
OBSERVABLE_BASE::remove_observer( static_cast<void*>(aObserver) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Notify
|
||||
* Notifies event to all subscribed observers.
|
||||
* @param Ptr pointer to method of the Observer-interface
|
||||
* @param aArgs list of arguments to each notification call, will be perfectly forwarded.
|
||||
*/
|
||||
template< typename... Args1, typename... Args2 >
|
||||
void Notify( void(ObserverInterface::*Ptr)(Args1...), Args2&&... aArgs )
|
||||
{
|
||||
static_assert(sizeof...(Args1) == sizeof...(Args2), "argument counts don't match");
|
||||
|
||||
if( impl_ )
|
||||
enter_iteration();
|
||||
try
|
||||
{
|
||||
enter_iteration();
|
||||
try {
|
||||
for( auto* void_ptr : impl_->observers_ )
|
||||
for( auto* void_ptr : impl_->observers_ )
|
||||
{
|
||||
if( void_ptr )
|
||||
{
|
||||
if( void_ptr )
|
||||
{
|
||||
auto* typed_ptr = static_cast<ObserverInterface*>(void_ptr);
|
||||
(typed_ptr->*Ptr)(std::forward<Args2>( aArgs )...);
|
||||
}
|
||||
auto* typed_ptr = static_cast<ObserverInterface*>( void_ptr );
|
||||
( typed_ptr->*Ptr )( std::forward<Args2>( aArgs )... );
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
leave_iteration();
|
||||
throw;
|
||||
}
|
||||
|
||||
leave_iteration();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Notify
|
||||
* Notifies event to all subscribed observers but one to be ignore.
|
||||
* @param Ptr pointer to method of the Observer-interface
|
||||
* @param aIgnore observer to ignore during this notification
|
||||
* @param aArgs list of arguments to each notification call, will be perfectly forwarded.
|
||||
*/
|
||||
template< typename... Args1, typename... Args2 >
|
||||
void NotifyIgnore( void(ObserverInterface::*Ptr)(Args1...), ObserverInterface* aIgnore,
|
||||
Args2&&... aArgs )
|
||||
{
|
||||
static_assert(sizeof...(Args1) == sizeof...(Args2), "argument counts don't match");
|
||||
|
||||
if( impl_ )
|
||||
catch( ... )
|
||||
{
|
||||
enter_iteration();
|
||||
leave_iteration();
|
||||
throw;
|
||||
}
|
||||
|
||||
try
|
||||
leave_iteration();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify event to all subscribed observers but one to be ignore.
|
||||
*
|
||||
* @param Ptr is a pointer to method of the observer interface.
|
||||
* @param aIgnore is an observer to ignore during this notification.
|
||||
* @param aArgs is a list of arguments to each notification call, will be perfectly forwarded.
|
||||
*/
|
||||
template <typename... Args1, typename... Args2>
|
||||
void NotifyIgnore( void ( ObserverInterface::*Ptr )( Args1... ), ObserverInterface* aIgnore,
|
||||
Args2&&... aArgs )
|
||||
{
|
||||
static_assert( sizeof...( Args1 ) == sizeof...( Args2 ), "argument counts don't match" );
|
||||
|
||||
if( impl_ )
|
||||
{
|
||||
enter_iteration();
|
||||
|
||||
try
|
||||
{
|
||||
for( auto* void_ptr : impl_->observers_ )
|
||||
{
|
||||
for(auto* void_ptr : impl_->observers_)
|
||||
if( void_ptr && void_ptr != aIgnore )
|
||||
{
|
||||
if( void_ptr && void_ptr != aIgnore )
|
||||
{
|
||||
auto* typed_ptr = static_cast<ObserverInterface*>(void_ptr);
|
||||
(typed_ptr->*Ptr)(std::forward<Args2>( aArgs )...);
|
||||
}
|
||||
auto* typed_ptr = static_cast<ObserverInterface*>( void_ptr );
|
||||
( typed_ptr->*Ptr )( std::forward<Args2>( aArgs )... );
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
leave_iteration();
|
||||
throw;
|
||||
}
|
||||
|
||||
leave_iteration();
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
leave_iteration();
|
||||
throw;
|
||||
}
|
||||
|
||||
leave_iteration();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace UTIL
|
||||
|
||||
#endif
|
||||
|
|
|
@ -36,7 +36,8 @@
|
|||
* The functions are templated to allow use with any size scalar
|
||||
* parameter: an int, a long long int, or a double.
|
||||
*/
|
||||
class ORIGIN_TRANSFORMS {
|
||||
class ORIGIN_TRANSFORMS
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* The supported Display Origin Transform types
|
||||
|
@ -52,14 +53,10 @@ public:
|
|||
REL_Y_COORD, //< A relative Y coordinate
|
||||
};
|
||||
|
||||
public:
|
||||
ORIGIN_TRANSFORMS();
|
||||
|
||||
virtual ~ORIGIN_TRANSFORMS();
|
||||
|
||||
|
||||
// =============== Single-axis Transforms ===============
|
||||
|
||||
virtual int ToDisplay( int aValue,
|
||||
COORD_TYPES_T aCoordType ) const;
|
||||
|
||||
|
@ -79,8 +76,6 @@ public:
|
|||
COORD_TYPES_T aCoordType ) const;
|
||||
|
||||
|
||||
// =============== Two-axis Transforms ===============
|
||||
|
||||
template<class T>
|
||||
T ToDisplayAbs( const T& aValue ) const
|
||||
{
|
||||
|
@ -124,9 +119,6 @@ public:
|
|||
|
||||
|
||||
protected:
|
||||
|
||||
// =============== Generic Relative Transforms ===============
|
||||
|
||||
template<class T> inline static
|
||||
T ToDisplayRel( T aInternalValue,
|
||||
bool aInvertAxis )
|
||||
|
@ -154,9 +146,6 @@ protected:
|
|||
return internalValue;
|
||||
}
|
||||
|
||||
|
||||
// =============== Generic Absolute Transforms ===============
|
||||
|
||||
template<class T> inline static
|
||||
T ToDisplayAbs( T aInternalValue,
|
||||
int aUserOrigin,
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
class EDA_ITEM;
|
||||
|
||||
/**
|
||||
* ORIGIN_VIEWITEM
|
||||
*
|
||||
* View item to draw an origin marker.
|
||||
*/
|
||||
namespace KIGFX {
|
||||
|
@ -73,8 +71,10 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
/** Get class name
|
||||
* @return string "ORIGIN_VIEWITEM"
|
||||
/**
|
||||
* Get class name.
|
||||
*
|
||||
* @return string "ORIGIN_VIEWITEM"
|
||||
*/
|
||||
wxString GetClass() const override
|
||||
{
|
||||
|
@ -82,10 +82,12 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function SetDrawAtZero()
|
||||
* Set the draw at zero flag. When set the marker will be drawn when it's position is 0,0.
|
||||
* Otherwise it will not be drawn when its position is 0,0
|
||||
* @param aDrawFlag The value to set the draw at zero flag
|
||||
* Set the draw at zero flag.
|
||||
*
|
||||
* When set the marker will be drawn when it's position is 0,0. Otherwise it will not
|
||||
* be drawn when its position is 0,0.
|
||||
*
|
||||
* @param aDrawFlag The value to set the draw at zero flag.
|
||||
*/
|
||||
inline void SetDrawAtZero( bool aDrawFlag )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2016 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 1992-2020 KiCad Developers, see CHANGELOG.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
|
||||
|
@ -27,8 +27,7 @@
|
|||
#include <string>
|
||||
|
||||
/**
|
||||
* Enum PAD_SHAPE_T
|
||||
* is the set of pad shapes, used with PAD::{Set,Get}Shape()
|
||||
* The set of pad shapes, used with PAD::{Set,Get}Shape()
|
||||
*/
|
||||
enum PAD_SHAPE_T
|
||||
{
|
||||
|
@ -37,9 +36,11 @@ enum PAD_SHAPE_T
|
|||
PAD_SHAPE_OVAL,
|
||||
PAD_SHAPE_TRAPEZOID,
|
||||
PAD_SHAPE_ROUNDRECT,
|
||||
PAD_SHAPE_CHAMFERED_RECT, // Rectangle with a champered corner ( and with rounded other corners)
|
||||
|
||||
// Rectangle with a chamfered corner ( and with rounded other corners).
|
||||
PAD_SHAPE_CHAMFERED_RECT,
|
||||
PAD_SHAPE_CUSTOM // A shape defined by user, using a set of basic shapes
|
||||
// (thick segments, circles, arcs, polygons
|
||||
// (thick segments, circles, arcs, polygons.
|
||||
};
|
||||
|
||||
static inline std::string PAD_SHAPE_T_asString( PAD_SHAPE_T a )
|
||||
|
@ -60,8 +61,7 @@ static inline std::string PAD_SHAPE_T_asString( PAD_SHAPE_T a )
|
|||
|
||||
|
||||
/**
|
||||
* Enum PAD_DRILL_SHAPE_T
|
||||
* is the set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
|
||||
* The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
|
||||
*/
|
||||
enum PAD_DRILL_SHAPE_T
|
||||
{
|
||||
|
@ -71,8 +71,8 @@ enum PAD_DRILL_SHAPE_T
|
|||
|
||||
|
||||
/**
|
||||
* Enum PAD_ATTR_T
|
||||
* is the set of pad shapes, used with PAD::{Set,Get}Attribute()
|
||||
* The set of pad shapes, used with PAD::{Set,Get}Attribute().
|
||||
*
|
||||
* The double name is for convenience of Python devs
|
||||
*/
|
||||
enum PAD_ATTR_T
|
||||
|
@ -88,9 +88,8 @@ enum PAD_ATTR_T
|
|||
|
||||
|
||||
/**
|
||||
* Enum PAD_PROP_T
|
||||
* is the set of pad properties used in Gerber files (Draw files, and P&P files)
|
||||
* to define some properties in fabrication or test files
|
||||
* Ghe set of pad properties used in Gerber files (Draw files, and P&P files)
|
||||
* to define some properties in fabrication or test files.
|
||||
*/
|
||||
enum PAD_PROP_T
|
||||
{
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2007-2020 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
|
||||
|
@ -42,19 +42,17 @@
|
|||
|
||||
|
||||
/**
|
||||
* PAGE_INFO
|
||||
* describes the page size and margins of a paper page on which to
|
||||
* eventually print or plot. Paper sizes are often described in inches.
|
||||
* Here paper is described in 1/1000th of an inch (mils). For convenience
|
||||
* there are some read only accessors for internal units (IU), which is a compile
|
||||
* time calculation, not runtime.
|
||||
* Describe the page size and margins of a paper page on which to eventually print or plot.
|
||||
*
|
||||
* Paper sizes are often described in inches. Here paper is described in 1/1000th of an
|
||||
* inch (mils). For convenience there are some read only accessors for internal units
|
||||
* which is a compile time calculation, not runtime.
|
||||
*
|
||||
* @author Dick Hollenbeck
|
||||
*/
|
||||
class PAGE_INFO
|
||||
{
|
||||
public:
|
||||
|
||||
PAGE_INFO( const wxString& aType = PAGE_INFO::A3, bool IsPortrait = false );
|
||||
|
||||
// paper size names which are part of the public API, pass to SetType() or
|
||||
|
@ -80,9 +78,8 @@ public:
|
|||
|
||||
|
||||
/**
|
||||
* Function SetType
|
||||
* sets the name of the page type and also the sizes and margins
|
||||
* commonly associated with that type name.
|
||||
* Set the name of the page type and also the sizes and margins commonly associated with
|
||||
* that type name.
|
||||
*
|
||||
* @param aStandardPageDescriptionName is a wxString constant giving one of:
|
||||
* "A5" "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "GERBER", "USLetter", "USLegal",
|
||||
|
@ -91,46 +88,41 @@ public:
|
|||
* static PAGE_INFO::SetUserWidthMils() and
|
||||
* static PAGE_INFO::SetUserHeightMils();
|
||||
* @param aIsPortrait Set to true to set page orientation to portrait mode.
|
||||
*
|
||||
* @return bool - true if @a aStandarePageDescription was a recognized type.
|
||||
* @return true if @a aStandarePageDescription was a recognized type.
|
||||
*/
|
||||
bool SetType( const wxString& aStandardPageDescriptionName, bool aIsPortrait = false );
|
||||
const wxString& GetType() const { return m_type; }
|
||||
|
||||
/**
|
||||
* Function IsDefault
|
||||
* @return True if the object has the default page settings which are A3, landscape.
|
||||
*/
|
||||
bool IsDefault() const { return m_type == PAGE_INFO::A3 && !m_portrait; }
|
||||
|
||||
/**
|
||||
* Function IsCustom
|
||||
* returns true if the type is Custom
|
||||
* @return true if the type is Custom.
|
||||
*/
|
||||
bool IsCustom() const;
|
||||
|
||||
/**
|
||||
* Function SetPortrait
|
||||
* will rotate the paper page 90 degrees. This PAGE_INFO may either be in
|
||||
* portrait or landscape mode. Use this function to change from one to the
|
||||
* other mode.
|
||||
* @param aIsPortrait if true and not already in portrait mode, will change
|
||||
* this PAGE_INFO to portrait mode. Or if false and not already in landscape mode,
|
||||
* will change this PAGE_INFO to landscape mode.
|
||||
* Rotate the paper page 90 degrees.
|
||||
*
|
||||
* This PAGE_INFO may either be in portrait or landscape mode. Use this function to
|
||||
* change from one mode to the other mode.
|
||||
*
|
||||
* @param aIsPortrait if true and not already in portrait mode, will change this
|
||||
* PAGE_INFO to portrait mode. Or if false and not already in
|
||||
* landscape mode, will change this PAGE_INFO to landscape mode.
|
||||
*/
|
||||
void SetPortrait( bool aIsPortrait );
|
||||
bool IsPortrait() const { return m_portrait; }
|
||||
|
||||
/**
|
||||
* Function GetWxOrientation.
|
||||
* @return ws' style printing orientation (wxPORTRAIT or wxLANDSCAPE).
|
||||
*/
|
||||
wxPrintOrientation GetWxOrientation() const { return IsPortrait() ? wxPORTRAIT : wxLANDSCAPE; }
|
||||
|
||||
/**
|
||||
* Function GetPaperId
|
||||
* @return wxPaperSize - wxPrintData's style paper id associated with
|
||||
* page type name.
|
||||
* @return wxPrintData's style paper id associated with page type name.
|
||||
*/
|
||||
wxPaperSize GetPaperId() const { return m_paper_id; }
|
||||
|
||||
|
@ -151,40 +143,29 @@ public:
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Function SetCustomWidthMils
|
||||
* sets the width of Custom page in mils, for any custom page
|
||||
* constructed or made via SetType() after making this call.
|
||||
* Set the width of Custom page in mils for any custom page constructed or made via
|
||||
* SetType() after making this call.
|
||||
*/
|
||||
static void SetCustomWidthMils( int aWidthInMils );
|
||||
|
||||
/**
|
||||
* Function SetCustomHeightMils
|
||||
* sets the height of Custom page in mils, for any custom page
|
||||
* constructed or made via SetType() after making this call.
|
||||
* Set the height of Custom page in mils for any custom page constructed or made via
|
||||
* SetType() after making this call.
|
||||
*/
|
||||
static void SetCustomHeightMils( int aHeightInMils );
|
||||
|
||||
/**
|
||||
* Function GetCustomWidthMils.
|
||||
* @return int - custom paper width in mils.
|
||||
* @return custom paper width in mils.
|
||||
*/
|
||||
static int GetCustomWidthMils() { return s_user_width; }
|
||||
|
||||
/**
|
||||
* Function GetCustomHeightMils.
|
||||
* @return int - custom paper height in mils.
|
||||
* @return custom paper height in mils.
|
||||
*/
|
||||
static int GetCustomHeightMils() { return s_user_height; }
|
||||
|
||||
/**
|
||||
* Function GetStandardSizes
|
||||
* returns the standard page types, such as "A4", "A3", etc.
|
||||
static wxArrayString GetStandardSizes();
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function Format
|
||||
* outputs the page class to \a aFormatter in s-expression form.
|
||||
* Output the page class to \a aFormatter in s-expression form.
|
||||
*
|
||||
* @param aFormatter The #OUTPUTFORMATTER object to write to.
|
||||
* @param aNestLevel The indentation next level.
|
||||
|
@ -197,9 +178,7 @@ protected:
|
|||
// only the class implementation(s) may use this constructor
|
||||
PAGE_INFO( const wxSize& aSizeMils, const wxString& aName, wxPaperSize aPaperId );
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// standard pre-defined sizes
|
||||
static const PAGE_INFO pageA5;
|
||||
static const PAGE_INFO pageA4;
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
*
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
|
@ -43,35 +45,31 @@ class GAL;
|
|||
class VIEW_ITEM;
|
||||
|
||||
/**
|
||||
* PAINTER
|
||||
* contains all the knowledge about how to draw graphical object onto
|
||||
* any particular output device.
|
||||
* This knowledge is held outside the individual graphical objects so that
|
||||
* alternative output devices may be used, and so that the graphical objects
|
||||
* themselves to not contain drawing routines. Drawing routines in the objects
|
||||
* cause problems with usages of the objects as simple container objects in
|
||||
* DLL/DSOs.
|
||||
* PAINTER is an abstract layer, because every module (pcbnew, eeschema, etc.)
|
||||
* has to draw different kinds of objects.
|
||||
* Contains all the knowledge about how to draw graphical object onto any particular
|
||||
* output device.
|
||||
*
|
||||
* This knowledge is held outside the individual graphical objects so that alternative
|
||||
* output devices may be used, and so that the graphical objects themselves to not
|
||||
* contain drawing routines. Drawing routines in the objects cause problems with usages
|
||||
* of the objects as simple container objects in DLL/DSOs. PAINTER is an abstract layer
|
||||
* because every module (pcbnew, eeschema, etc.) has to draw different kinds of objects.
|
||||
*/
|
||||
class PAINTER
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor PAINTER( GAL* )
|
||||
* initializes this object for painting on any of the polymorphic
|
||||
* Initialize this object for painting on any of the polymorphic
|
||||
* GRAPHICS_ABSTRACTION_LAYER* derivatives.
|
||||
*
|
||||
* @param aGal is a pointer to a polymorphic GAL device on which
|
||||
* to draw (i.e. Cairo, OpenGL, wxDC)
|
||||
* No ownership is given to this PAINTER of aGal.
|
||||
* @param aGal is a pointer to a polymorphic GAL device on which to draw (i.e. Cairo,
|
||||
* OpenGL, wxDC). No ownership is given to this PAINTER of aGal.
|
||||
*/
|
||||
PAINTER( GAL* aGal );
|
||||
virtual ~PAINTER();
|
||||
|
||||
/**
|
||||
* Function SetGAL
|
||||
* Changes Graphics Abstraction Layer used for drawing items for a new one.
|
||||
*
|
||||
* @param aGal is the new GAL instance.
|
||||
*/
|
||||
void SetGAL( GAL* aGal )
|
||||
|
@ -80,26 +78,27 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function ApplySettings
|
||||
* Loads colors and display modes settings that are going to be used when drawing items.
|
||||
*
|
||||
* @param aSettings are settings to be applied.
|
||||
*/
|
||||
virtual void ApplySettings( const RENDER_SETTINGS* aSettings ) = 0;
|
||||
|
||||
/**
|
||||
* Function GetAdapter
|
||||
* Returns pointer to current settings that are going to be used when drawing items.
|
||||
* Return a pointer to current settings that are going to be used when drawing items.
|
||||
*
|
||||
* @return Current rendering settings.
|
||||
*/
|
||||
virtual RENDER_SETTINGS* GetSettings() = 0;
|
||||
|
||||
/**
|
||||
* Function Draw
|
||||
* Takes an instance of VIEW_ITEM and passes it to a function that know how to draw the item.
|
||||
* Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw
|
||||
* the item.
|
||||
*
|
||||
* @param aItem is an item to be drawn.
|
||||
* @param aLayer tells which layer is currently rendered so that draw functions
|
||||
* may know what to draw (eg. for pads there are separate layers for holes, because they
|
||||
* have other dimensions then the pad itself.
|
||||
* @param aLayer tells which layer is currently rendered so that draw functions may
|
||||
* know what to draw (eg. for pads there are separate layers for holes,
|
||||
* because they have other dimensions then the pad itself.
|
||||
*/
|
||||
virtual bool Draw( const VIEW_ITEM* aItem, int aLayer ) = 0;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004-2018 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see CHANGELOG.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
|
||||
|
@ -40,14 +40,6 @@ class TOOL_MANAGER;
|
|||
|
||||
class PANEL_HOTKEYS_EDITOR : public RESETTABLE_PANEL
|
||||
{
|
||||
protected:
|
||||
EDA_BASE_FRAME* m_frame;
|
||||
bool m_readOnly;
|
||||
|
||||
std::vector<TOOL_MANAGER*> m_toolManagers;
|
||||
HOTKEY_STORE m_hotkeyStore;
|
||||
WIDGET_HOTKEY_LIST* m_hotkeyListCtrl;
|
||||
|
||||
public:
|
||||
PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aWindow, bool aReadOnly );
|
||||
|
||||
|
@ -64,28 +56,33 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Install the button panel (global reset/default, import/export)
|
||||
* @param aSizer the dialog to install on
|
||||
*
|
||||
* @param aSizer the dialog to install on.
|
||||
*/
|
||||
void installButtons( wxSizer* aSizer );
|
||||
|
||||
/**
|
||||
* Function OnFilterSearch
|
||||
* Handle a change in the hoteky filter text
|
||||
* Handle a change in the hotkey filter text.
|
||||
*
|
||||
* @param aEvent: the search event, used to get the search query
|
||||
* @param aEvent is the search event, used to get the search query.
|
||||
*/
|
||||
void OnFilterSearch( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Function ImportHotKeys
|
||||
* Puts up a dialog allowing the user to select a hotkeys file and then overlays those
|
||||
* Put up a dialog allowing the user to select a hotkeys file and then overlays those
|
||||
* hotkeys onto the current hotkey store.
|
||||
*/
|
||||
void ImportHotKeys();
|
||||
|
||||
protected:
|
||||
EDA_BASE_FRAME* m_frame;
|
||||
bool m_readOnly;
|
||||
|
||||
std::vector<TOOL_MANAGER*> m_toolManagers;
|
||||
HOTKEY_STORE m_hotkeyStore;
|
||||
WIDGET_HOTKEY_LIST* m_hotkeyListCtrl;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2020 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
|
||||
|
@ -68,35 +68,14 @@ struct MAGNETIC_SETTINGS;
|
|||
wxDECLARE_EVENT( BOARD_CHANGED, wxCommandEvent );
|
||||
|
||||
/**
|
||||
* PCB_BASE_FRAME
|
||||
* basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
|
||||
* Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
|
||||
*/
|
||||
class PCB_BASE_FRAME : public EDA_DRAW_FRAME
|
||||
{
|
||||
protected:
|
||||
BOARD* m_pcb;
|
||||
PCB_DISPLAY_OPTIONS m_displayOptions;
|
||||
PCB_ORIGIN_TRANSFORMS m_originTransforms;
|
||||
PCBNEW_SETTINGS* m_settings; // No ownership, just a shortcut
|
||||
|
||||
virtual void unitsChangeRefresh() override;
|
||||
|
||||
/**
|
||||
* Function loadFootprint
|
||||
* attempts to load \a aFootprintId from the footprint library table.
|
||||
*
|
||||
* @param aFootprintId is the #LIB_ID of component footprint to load.
|
||||
* @return the #FOOTPRINT if found or NULL if \a aFootprintId not found in any of the
|
||||
* libraries in the table returned from #Prj().PcbFootprintLibs().
|
||||
* @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
|
||||
* occurs while reading footprint library files.
|
||||
*/
|
||||
FOOTPRINT* loadFootprint( const LIB_ID& aFootprintId );
|
||||
|
||||
public:
|
||||
PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName );
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName );
|
||||
|
||||
~PCB_BASE_FRAME();
|
||||
|
||||
|
@ -106,15 +85,15 @@ public:
|
|||
EDA_3D_VIEWER* Get3DViewerFrame();
|
||||
|
||||
/**
|
||||
* Update the 3D view, if the viewer is opened by this frame
|
||||
* @param aTitle = the new title of the 3D frame, or nullptr
|
||||
* to do not change the frame title
|
||||
* Update the 3D view, if the viewer is opened by this frame.
|
||||
*
|
||||
* @param aTitle is the new title of the 3D frame, or nullptr to do not change the
|
||||
* frame title
|
||||
*/
|
||||
virtual void Update3DView( bool aReloadRequest, const wxString* aTitle = nullptr );
|
||||
|
||||
/**
|
||||
* Function LoadFootprint
|
||||
* attempts to load \a aFootprintId from the footprint library table.
|
||||
* Attempt to load \a aFootprintId from the footprint library table.
|
||||
*
|
||||
* @param aFootprintId is the #LIB_ID of component footprint to load.
|
||||
* @return the #FOOTPRINT if found or NULL if \a aFootprintId not found in any of the
|
||||
|
@ -123,12 +102,12 @@ public:
|
|||
FOOTPRINT* LoadFootprint( const LIB_ID& aFootprintId );
|
||||
|
||||
/**
|
||||
* Function GetBoardBoundingBox
|
||||
* calculates the bounding box containing all board items (or board edge segments).
|
||||
* Calculate the bounding box containing all board items (or board edge segments).
|
||||
*
|
||||
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
|
||||
* @return EDA_RECT - the board's bounding box
|
||||
* @return the board's bounding box.
|
||||
*/
|
||||
EDA_RECT GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const;
|
||||
EDA_RECT GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const;
|
||||
|
||||
const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override
|
||||
{
|
||||
|
@ -170,14 +149,16 @@ public:
|
|||
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
|
||||
|
||||
/**
|
||||
* Returns the BOARD_DESIGN_SETTINGS for the open project
|
||||
* Returns the BOARD_DESIGN_SETTINGS for the open project.
|
||||
*
|
||||
* Overloaded in FOOTPRINT_EDIT_FRAME.
|
||||
*/
|
||||
virtual BOARD_DESIGN_SETTINGS& GetDesignSettings() const;
|
||||
|
||||
/**
|
||||
* Helper to retrieve the current color settings
|
||||
* @return a pointer to the active COLOR_SETTINGS
|
||||
* Helper to retrieve the current color settings.
|
||||
*
|
||||
* @return a pointer to the active COLOR_SETTINGS.
|
||||
*/
|
||||
virtual COLOR_SETTINGS* GetColorSettings() override
|
||||
{
|
||||
|
@ -190,9 +171,8 @@ public:
|
|||
void SetDrawBgColor( COLOR4D aColor ) override;
|
||||
|
||||
/**
|
||||
* Function GetDisplayOptions
|
||||
* Display options control the way tracks, vias, outlines and other things are shown
|
||||
* (for instance solid or sketch mode)
|
||||
* (for instance solid or sketch mode).
|
||||
*/
|
||||
const PCB_DISPLAY_OPTIONS& GetDisplayOptions() const { return m_displayOptions; }
|
||||
void SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions );
|
||||
|
@ -201,18 +181,17 @@ public:
|
|||
void SetZoneSettings( const ZONE_SETTINGS& aSettings );
|
||||
|
||||
/**
|
||||
* Function GetPlotSettings
|
||||
* returns the PCB_PLOT_PARAMS for the BOARD owned by this frame.
|
||||
* Return the #PCB_PLOT_PARAMS for the BOARD owned by this frame.
|
||||
*
|
||||
* Overloaded in FOOTPRINT_EDIT_FRAME.
|
||||
*/
|
||||
virtual const PCB_PLOT_PARAMS& GetPlotSettings() const;
|
||||
virtual void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings );
|
||||
|
||||
/**
|
||||
* Function SetBoard
|
||||
* sets the m_Pcb member in such as way as to ensure deleting any previous
|
||||
* BOARD.
|
||||
* @param aBoard The BOARD to put into the frame.
|
||||
* Set the #m_Pcb member in such as way as to ensure deleting any previous #BOARD.
|
||||
*
|
||||
* @param aBoard is the #BOARD to put into the frame.
|
||||
*/
|
||||
virtual void SetBoard( BOARD* aBoard );
|
||||
|
||||
|
@ -223,7 +202,6 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function GetModel()
|
||||
* @return the primary data model.
|
||||
*/
|
||||
virtual BOARD_ITEM_CONTAINER* GetModel() const = 0;
|
||||
|
@ -242,60 +220,56 @@ public:
|
|||
|
||||
/**
|
||||
* Shows the 3D view frame.
|
||||
* If it does not exist, it is created.
|
||||
* If it exists, it is bring to the foreground
|
||||
*
|
||||
* If it does not exist, it is created. If it exists, it is brought to the foreground.
|
||||
*/
|
||||
EDA_3D_VIEWER* CreateAndShow3D_Frame();
|
||||
|
||||
/**
|
||||
* Function GetCollectorsGuide
|
||||
* @return GENERAL_COLLECTORS_GUIDE - that considers the global configuration options.
|
||||
* @return global configuration options.
|
||||
*/
|
||||
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
|
||||
|
||||
/**
|
||||
* Function SelectLibrary
|
||||
* puts up a dialog and allows the user to pick a library, for unspecified use.
|
||||
* Put up a dialog and allows the user to pick a library, for unspecified use.
|
||||
*
|
||||
* @param aNicknameExisting is the current choice to highlight
|
||||
* @return wxString - the library or wxEmptyString on abort.
|
||||
* @param aNicknameExisting is the current choice to highlight.
|
||||
* @return the library or wxEmptyString on abort.
|
||||
*/
|
||||
wxString SelectLibrary( const wxString& aNicknameExisting );
|
||||
|
||||
/**
|
||||
* Function GetFootprintFromBoardByReference
|
||||
* @return a reference to the footprint found by its refence on the curent board. The
|
||||
* @return a reference to the footprint found by its reference on the current board. The
|
||||
* reference is entered by the user from a dialog (by awxTextCtlr, or a list of
|
||||
* available references)
|
||||
*/
|
||||
FOOTPRINT* GetFootprintFromBoardByReference();
|
||||
|
||||
/**
|
||||
* Function OnModify
|
||||
* Must be called after a change in order to set the "modify" flag of the current screen
|
||||
* and update the date in frame reference.
|
||||
*
|
||||
* Do not forget to call this basic OnModify function to update info in derived OnModify
|
||||
* functions.
|
||||
*/
|
||||
virtual void OnModify();
|
||||
|
||||
// footprints (footprints)
|
||||
|
||||
/**
|
||||
* Function CreateNewFootprint
|
||||
* Creates a new footprint, at position 0,0
|
||||
* Creates a new footprint, at position 0,0.
|
||||
*
|
||||
* The new footprint contains only 2 texts: a reference and a value:
|
||||
* Reference = REF**
|
||||
* Value = "VAL**" or Footprint name in lib
|
||||
* Note: they are dummy texts, which will be replaced by the actual texts
|
||||
* when the fooprint is placed on a board and a netlist is read
|
||||
* @param aFootprintName = name of the new footprint in library
|
||||
*
|
||||
* @note They are dummy texts, which will be replaced by the actual texts when the
|
||||
* footprint is placed on a board and a netlist is read.
|
||||
*
|
||||
* @param aFootprintName is the name of the new footprint in library.
|
||||
*/
|
||||
FOOTPRINT* CreateNewFootprint( const wxString& aFootprintName );
|
||||
|
||||
/**
|
||||
* Function PlaceFootprint
|
||||
* places \a aFootprint at the current cursor position and updates footprint coordinates
|
||||
* Places \a aFootprint at the current cursor position and updates footprint coordinates
|
||||
* with the new position.
|
||||
*
|
||||
* @param aRecreateRatsnest A bool true redraws the footprint ratsnest.
|
||||
|
@ -305,71 +279,69 @@ public:
|
|||
void ShowPadPropertiesDialog( PAD* aPad );
|
||||
|
||||
/**
|
||||
* Function SelectFootprintFromLibTree
|
||||
* opens a dialog to select a footprint.
|
||||
* Open a dialog to select a footprint.
|
||||
*
|
||||
* @param aPreslect = if valid, the LIB_ID to select (otherwise the global history is used)
|
||||
* @param aPreslect if valid, the #LIB_ID to select (otherwise the global history is used).
|
||||
*/
|
||||
FOOTPRINT* SelectFootprintFromLibTree( LIB_ID aPreselect = LIB_ID() );
|
||||
|
||||
/**
|
||||
* Adds the given footprint to the board.
|
||||
* @param aFootprint
|
||||
* @param aDC (can be NULL ) = the current Device Context, to draw the new footprint
|
||||
* Add the given footprint to the board.
|
||||
*
|
||||
* @param aDC is the current Device Context, to draw the new footprint (can be NULL ).
|
||||
*/
|
||||
virtual void AddFootprintToBoard( FOOTPRINT* aFootprint );
|
||||
|
||||
/**
|
||||
* Function SelectFootprintFromLibBrowser
|
||||
* launches the footprint viewer to select the name of a footprint to load.
|
||||
* Launch the footprint viewer to select the name of a footprint to load.
|
||||
*
|
||||
* @return the selected footprint name or an empty string if no selection was made.
|
||||
*/
|
||||
wxString SelectFootprintFromLibBrowser();
|
||||
|
||||
/**
|
||||
* Function Compile_Ratsnest
|
||||
* Create the entire board ratsnest.
|
||||
* Must be called after a board change (changes for
|
||||
* pads, footprints or a read netlist ).
|
||||
* @param aDC = the current device context (can be NULL)
|
||||
* @param aDisplayStatus : if true, display the computation results
|
||||
* Create the entire board ratsnest.
|
||||
*
|
||||
* This must be called after a board change (changes for pads, footprints or a read
|
||||
* netlist ).
|
||||
*
|
||||
* @param aDC is the current device context (can be NULL).
|
||||
* @param aDisplayStatus if true, display the computation results.
|
||||
*/
|
||||
void Compile_Ratsnest( bool aDisplayStatus );
|
||||
|
||||
/* Functions relative to Undo/redo commands: */
|
||||
|
||||
/**
|
||||
* Function SaveCopyInUndoList (virtual pure)
|
||||
* Creates a new entry in undo list of commands.
|
||||
* add a picker to handle aItemToCopy
|
||||
* @param aItemToCopy = the board item modified by the command to undo
|
||||
* @param aTypeCommand = command type (see enum UNDO_REDO)
|
||||
* @param aTransformPoint = the reference point of the transformation, for
|
||||
* commands like move
|
||||
* Create a new entry in undo list of commands.
|
||||
*
|
||||
* @param aItemToCopy is the board item modified by the command to undo.
|
||||
* @param aTypeCommand is the command type (see enum #UNDO_REDO).
|
||||
* @param aTransformPoint is the reference point of the transformation, for
|
||||
* commands like move
|
||||
*/
|
||||
virtual void SaveCopyInUndoList( EDA_ITEM* aItemToCopy, UNDO_REDO aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
|
||||
|
||||
/**
|
||||
* Function SaveCopyInUndoList (virtual pure, overloaded).
|
||||
* Creates a new entry in undo list of commands.
|
||||
* add a list of pickers to handle a list of items
|
||||
* @param aItemsList = the list of items modified by the command to undo
|
||||
* @param aTypeCommand = command type (see enum UNDO_REDO)
|
||||
* @param aTransformPoint = the reference point of the transformation,
|
||||
* for commands like move
|
||||
*
|
||||
* @param aItemsList is the list of items modified by the command to undo.
|
||||
* @param aTypeCommand is the command type (see enum #UNDO_REDO)
|
||||
* @param aTransformPoint is the reference point of the transformation,
|
||||
* for commands like move.
|
||||
*/
|
||||
virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand,
|
||||
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;
|
||||
|
||||
|
||||
/** Install the dialog box for layer selection
|
||||
* @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
|
||||
* @param aNotAllowedLayersMask = a layer mask for not allowed layers
|
||||
* (= 0 to show all layers in use)
|
||||
* @param aDlgPosition = position of dialog ( defualt = centered)
|
||||
* @return the selected layer id
|
||||
/**
|
||||
* Show the dialog box for layer selection.
|
||||
*
|
||||
* @param aDefaultLayer is the default layer to select. Use #NB_PCB_LAYERS if no selection
|
||||
* is desired.
|
||||
* @param aNotAllowedLayersMask is a layer mask for not allowed layers. Use 0 to show all
|
||||
* layers in use.
|
||||
* @param aDlgPosition is the position of dialog (default is centered).
|
||||
* @return the selected layer id.
|
||||
*/
|
||||
PCB_LAYER_ID SelectLayer( PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask = LSET(),
|
||||
wxPoint aDlgPosition = wxDefaultPosition );
|
||||
|
@ -404,26 +376,43 @@ public:
|
|||
virtual void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) {}
|
||||
|
||||
/**
|
||||
* Function DisplayGridMsg()
|
||||
*
|
||||
* Display the current grid pane on the status bar.
|
||||
*/
|
||||
void DisplayGridMsg() override;
|
||||
|
||||
PCB_DRAW_PANEL_GAL* GetCanvas() const override;
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
|
||||
virtual void ActivateGalCanvas() override;
|
||||
|
||||
/**
|
||||
* Does nothing. Should be overriden in derived classes which support autozoom.
|
||||
* Does nothing. Should be overridden in derived classes which support autozoom.
|
||||
*/
|
||||
virtual void SetAutoZoom( bool aAutoZoom ) {}
|
||||
|
||||
/**
|
||||
* Always returns false. Should be overriden in derived classes which support autozoom.
|
||||
* Always returns false. Should be overridden in derived classes which support autozoom.
|
||||
*/
|
||||
virtual bool GetAutoZoom() { return false; }
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Attempts to load \a aFootprintId from the footprint library table.
|
||||
*
|
||||
* @param aFootprintId is the #LIB_ID of component footprint to load.
|
||||
* @return the #FOOTPRINT if found or NULL if \a aFootprintId not found in any of the
|
||||
* libraries in the table returned from #Prj().PcbFootprintLibs().
|
||||
* @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
|
||||
* occurs while reading footprint library files.
|
||||
*/
|
||||
FOOTPRINT* loadFootprint( const LIB_ID& aFootprintId );
|
||||
|
||||
BOARD* m_pcb;
|
||||
PCB_DISPLAY_OPTIONS m_displayOptions;
|
||||
PCB_ORIGIN_TRANSFORMS m_originTransforms;
|
||||
PCBNEW_SETTINGS* m_settings; // No ownership, just a shortcut
|
||||
|
||||
virtual void unitsChangeRefresh() override;
|
||||
};
|
||||
|
||||
#endif // PCB_BASE_FRAME_H
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2020 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
|
||||
|
@ -33,16 +33,16 @@
|
|||
#include <project/board_project_settings.h>
|
||||
|
||||
/**
|
||||
* PCB_DISPLAY_OPTIONS
|
||||
* handles display options like enable/disable some optional drawings.
|
||||
* Container for display options like enable/disable some optional drawings.
|
||||
*/
|
||||
class PCB_DISPLAY_OPTIONS
|
||||
{
|
||||
public:
|
||||
PCB_DISPLAY_OPTIONS();
|
||||
|
||||
/**
|
||||
* Enum TRACE_CLEARANCE_DISPLAY_MODE_T
|
||||
* is the set of values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option.
|
||||
* The set of values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option.
|
||||
*
|
||||
* This parameter controls how to show tracks and vias clearance area.
|
||||
*/
|
||||
enum TRACE_CLEARANCE_DISPLAY_MODE_T {
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
/// Ratsnest draw mode (all layers vs only visible layers)
|
||||
RATSNEST_MODE m_RatsnestMode;
|
||||
|
||||
int m_MaxLinksShowed; // in track creation: number of hairwires shown
|
||||
int m_MaxLinksShowed; // in track creation: number of airwires shown
|
||||
bool m_ShowModuleRatsnest; // When moving a footprint: allows displaying a ratsnest
|
||||
bool m_ShowGlobalRatsnest; // If true, show all
|
||||
bool m_DisplayRatsnestLinesCurved; // Airwires can be drawn as straight lines (false)
|
||||
|
@ -106,8 +106,8 @@ public:
|
|||
double m_ZoneOpacity; ///< Opacity override for filled zone areas
|
||||
|
||||
/**
|
||||
* Enum PCB_DISPLAY_ORIGIN_OPTIONS_T
|
||||
* is the set of values for DISPLAY_OPTIONS.DisplayOrigin parameter option.
|
||||
* The set of values for DISPLAY_OPTIONS.DisplayOrigin parameter option.
|
||||
*
|
||||
* This parameter controls what is used as the origin point for location values
|
||||
*/
|
||||
enum PCB_DISPLAY_ORIGIN_OPTIONS_T {
|
||||
|
@ -121,9 +121,6 @@ public:
|
|||
bool m_DisplayInvertXAxis; //< true: Invert the X axis for display
|
||||
bool m_DisplayInvertYAxis; //< true: Invert the Y axis for display
|
||||
|
||||
public:
|
||||
|
||||
PCB_DISPLAY_OPTIONS();
|
||||
};
|
||||
|
||||
#endif // PCBSTRUCT_H_
|
||||
|
|
|
@ -25,11 +25,6 @@
|
|||
/**
|
||||
* @file class_pcb_group.h
|
||||
* @brief Class to handle a set of BOARD_ITEMs.
|
||||
* Group parent is always board, not logical parent group.
|
||||
* Group is transparent container - e.g., its position is derived from the position
|
||||
* of its members.
|
||||
* A selection containing a group implicitly contains its members. However other operations
|
||||
* on sets of items, like committing, updating the view, etc the set is explicit.
|
||||
*/
|
||||
|
||||
#ifndef CLASS_PCB_GROUP_H_
|
||||
|
@ -46,6 +41,11 @@ class VIEW;
|
|||
|
||||
/**
|
||||
* PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
|
||||
*
|
||||
* The group parent is always board, not logical parent group. The group is transparent
|
||||
* container - e.g., its position is derived from the position of its members. A selection
|
||||
* containing a group implicitly contains its members. However other operations on sets of
|
||||
* items, like committing, updating the view, etc the set is explicit.
|
||||
*/
|
||||
class PCB_GROUP : public BOARD_ITEM
|
||||
{
|
||||
|
@ -88,6 +88,7 @@ public:
|
|||
|
||||
/*
|
||||
* Searches for highest level group containing item.
|
||||
*
|
||||
* @param scope restricts the search to groups within the group scope.
|
||||
* @return group containing item, if it exists, otherwise, NULL
|
||||
*/
|
||||
|
@ -121,12 +122,12 @@ public:
|
|||
EDA_ITEM* Clone() const override;
|
||||
|
||||
/*
|
||||
* Clone() this and all descendents
|
||||
* Clone() this and all descendants
|
||||
*/
|
||||
PCB_GROUP* DeepClone() const;
|
||||
|
||||
/*
|
||||
* Duplicate() this and all descendents
|
||||
* Duplicate() this and all descendants
|
||||
*/
|
||||
PCB_GROUP* DeepDuplicate() const;
|
||||
|
||||
|
@ -146,7 +147,8 @@ public:
|
|||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
||||
///> @copydoc EDA_ITEM::Visit
|
||||
SEARCH_RESULT Visit( INSPECTOR aInspector, void* aTestData, const KICAD_T aScanTypes[] ) override;
|
||||
SEARCH_RESULT Visit( INSPECTOR aInspector, void* aTestData,
|
||||
const KICAD_T aScanTypes[] ) override;
|
||||
|
||||
///> @copydoc VIEW_ITEM::ViewGetLayers
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
@ -174,15 +176,17 @@ public:
|
|||
|
||||
/**
|
||||
* Invokes a function on all members of the group.
|
||||
* Note that this function should not add or remove items to the group
|
||||
*
|
||||
* @note This function should not add or remove items to the group.
|
||||
*
|
||||
* @param aFunction is the function to be invoked.
|
||||
*/
|
||||
void RunOnChildren( const std::function<void ( BOARD_ITEM* )>& aFunction ) const;
|
||||
|
||||
/**
|
||||
* Invokes a function on all descendents of the group.
|
||||
* Note that this function should not add or remove items to the group or descendent
|
||||
* groups.
|
||||
* Invokes a function on all descendants of the group.
|
||||
*
|
||||
* @note This function should not add or remove items to the group or descendant groups.
|
||||
* @param aFunction is the function to be invoked.
|
||||
*/
|
||||
void RunOnDescendants( const std::function<void( BOARD_ITEM* )>& aFunction ) const;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2020 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
|
||||
|
@ -33,17 +33,15 @@
|
|||
/* Handle info to display a board */
|
||||
class PCB_SCREEN : public BASE_SCREEN
|
||||
{
|
||||
public:
|
||||
PCB_LAYER_ID m_Active_Layer;
|
||||
PCB_LAYER_ID m_Route_Layer_TOP;
|
||||
PCB_LAYER_ID m_Route_Layer_BOTTOM;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* @param aPageSizeIU is the size of the initial paper page in internal units.
|
||||
*/
|
||||
PCB_SCREEN( const wxSize& aPageSizeIU );
|
||||
|
||||
PCB_LAYER_ID m_Active_Layer;
|
||||
PCB_LAYER_ID m_Route_Layer_TOP;
|
||||
PCB_LAYER_ID m_Route_Layer_BOTTOM;
|
||||
};
|
||||
|
||||
#endif // PCB_SCREEN_H
|
||||
|
|
Loading…
Reference in New Issue