Fix broken Doxygen comment specifiers.

Please note, ///> is not a valid Doxygen comment specifier.  ///< is the
correct specifier to use for single line or short Doxygen comments.
This commit is contained in:
Wayne Stambaugh 2021-01-25 07:42:36 -05:00
parent 9f18fee124
commit 6ab1144ea3
69 changed files with 1128 additions and 1229 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013-2016 CERN * Copyright (C) 2013-2016 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -99,7 +99,7 @@ public:
static TOOL_ACTION toggleComments; static TOOL_ACTION toggleComments;
static TOOL_ACTION toggleECO; static TOOL_ACTION toggleECO;
///> @copydoc COMMON_ACTIONS::TranslateLegacyId() ///< @copydoc COMMON_ACTIONS::TranslateLegacyId()
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); } virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 Ian McInerney <ian.s.mcinerney at ieee.org> * Copyright (C) 2020 Ian McInerney <ian.s.mcinerney at ieee.org>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -72,19 +72,19 @@ public:
SELECTION_CONDITION GridSize( GRID3D_TYPE aGridSize ); SELECTION_CONDITION GridSize( GRID3D_TYPE aGridSize );
private: private:
///> Helper function used by MaterialMode() ///< Helper function used by MaterialMode()
static bool materialModeFunction( const SELECTION& aSelection, BOARD_ADAPTER* aAdapter, static bool materialModeFunction( const SELECTION& aSelection, BOARD_ADAPTER* aAdapter,
MATERIAL_MODE aMaterial ); MATERIAL_MODE aMaterial );
///> Helper function used by Flag() ///< Helper function used by Flag()
static bool flagFunction( const SELECTION& aSelection, BOARD_ADAPTER* aAdapter, static bool flagFunction( const SELECTION& aSelection, BOARD_ADAPTER* aAdapter,
DISPLAY3D_FLG aFlag ); DISPLAY3D_FLG aFlag );
///> Helper function used by GridDize() ///< Helper function used by GridDize()
static bool gridSizeFunction( const SELECTION& aSelection, BOARD_ADAPTER* aAdapter, static bool gridSizeFunction( const SELECTION& aSelection, BOARD_ADAPTER* aAdapter,
GRID3D_TYPE aGridSize ); GRID3D_TYPE aGridSize );
///> The board adapter to read the 3D viewer state from ///< The board adapter to read the 3D viewer state from
BOARD_ADAPTER* m_adapter; BOARD_ADAPTER* m_adapter;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -97,7 +97,7 @@ public:
int ToggleVisibility( const TOOL_EVENT& aEvent ); int ToggleVisibility( const TOOL_EVENT& aEvent );
private: private:
///> Sets up handlers for various events. ///< Sets up handlers for various events.
void setTransitions() override; void setTransitions() override;
int doZoomInOut( bool aDirection, bool aCenterOnCursor ); int doZoomInOut( bool aDirection, bool aCenterOnCursor );

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2019 Kicad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2021 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -100,7 +100,7 @@ private:
void OnExportToFile( wxCommandEvent& event ) override; void OnExportToFile( wxCommandEvent& event ) override;
void OnExportToClipboard( wxCommandEvent& event ) override; void OnExportToClipboard( wxCommandEvent& event ) override;
///> @return the EDA_UNITS from the m_PixelUnit choice ///< @return the EDA_UNITS from the m_PixelUnit choice
EDA_UNITS getUnitFromSelection(); EDA_UNITS getUnitFromSelection();
// return a string giving the output size, according to the selected unit // return a string giving the output size, according to the selected unit

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014 Rafael Sokolowski <Rafael.Sokolowski@web.de> * Copyright (C) 2014 Rafael Sokolowski <Rafael.Sokolowski@web.de>
* Copyright (C) 2014-2017 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2014-2021 KiCad Developers, see CHANGELOG.TXT for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -114,7 +114,7 @@ public:
void SetAppIcon( const wxIcon& aIcon ) { m_appIcon = aIcon; } void SetAppIcon( const wxIcon& aIcon ) { m_appIcon = aIcon; }
wxIcon& GetAppIcon() { return m_appIcon; } wxIcon& GetAppIcon() { return m_appIcon; }
///> Wrapper to manage memory allocation for bitmaps ///< Wrapper to manage memory allocation for bitmaps
wxBitmap* CreateKiBitmap( BITMAP_DEF aBitmap ) wxBitmap* CreateKiBitmap( BITMAP_DEF aBitmap )
{ {
m_bitmaps.emplace_back( KiBitmapNew( aBitmap ) ); m_bitmaps.emplace_back( KiBitmapNew( aBitmap ) );
@ -140,7 +140,7 @@ private:
wxIcon m_appIcon; wxIcon m_appIcon;
///> Bitmaps to be freed when the dialog is closed ///< Bitmaps to be freed when the dialog is closed
std::vector<std::unique_ptr<wxBitmap>> m_bitmaps; std::vector<std::unique_ptr<wxBitmap>> m_bitmaps;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -27,9 +27,7 @@
#include <eda_units.h> #include <eda_units.h>
/** /**
* WX_HTML_REPORT_BOX * A slimmed down version of #WX_HTML_REPORT_PANEL
*
* A slimmed down version of WX_HTML_REPORT_PANEL
*/ */
class WX_HTML_REPORT_BOX : public wxHtmlWindow, public REPORTER class WX_HTML_REPORT_BOX : public wxHtmlWindow, public REPORTER
{ {
@ -60,7 +58,7 @@ private:
// reports, but can be very slow for larger reports. // reports, but can be very slow for larger reports.
bool m_immediateMode; bool m_immediateMode;
///> copy of the report, stored for filtering ///< copy of the report, stored for filtering
std::vector<wxString> m_messages; std::vector<wxString> m_messages;
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015 CERN * Copyright (C) 2015 CERN
* Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2015-2021 KiCad Developers, see change_log.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@ -30,8 +30,6 @@
/** /**
* WX_HTML_REPORT_PANEL
*
* A widget for browsing a rich text error/status report. Used in numerous * A widget for browsing a rich text error/status report. Used in numerous
* dialogs in eeschema and pcbnew. Provides error filtering functionality * dialogs in eeschema and pcbnew. Provides error filtering functionality
* and saving report files. * and saving report files.
@ -46,10 +44,10 @@ public:
const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL ); const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
~WX_HTML_REPORT_PANEL(); ~WX_HTML_REPORT_PANEL();
///> Set the min size of the area which displays html messages: ///< Set the min size of the area which displays html messages:
void MsgPanelSetMinSize( const wxSize& aMinSize ); void MsgPanelSetMinSize( const wxSize& aMinSize );
///> returns the reporter object that reports to this panel ///< returns the reporter object that reports to this panel
REPORTER& Reporter(); REPORTER& Reporter();
/** /**
@ -61,43 +59,43 @@ public:
void Report( const wxString& aText, SEVERITY aSeverity, void Report( const wxString& aText, SEVERITY aSeverity,
REPORTER::LOCATION aLocation = REPORTER::LOC_BODY ); REPORTER::LOCATION aLocation = REPORTER::LOC_BODY );
///> clears the report panel ///< clears the report panel
void Clear(); void Clear();
///> return the number of messages matching the given severity mask. ///< return the number of messages matching the given severity mask.
int Count( int severityMask ); int Count( int severityMask );
///> sets the frame label ///< sets the frame label
void SetLabel( const wxString& aLabel ) override; void SetLabel( const wxString& aLabel ) override;
///> Sets the lasy update. If this mode is on, messages are stored but the display ///< Sets the lasy update. If this mode is on, messages are stored but the display
///> is not updated (Updating display can be very time consumming if there are many messages) ///< is not updated (Updating display can be very time consumming if there are many messages)
///> A call to Flush() will be needed after build the report ///< A call to Flush() will be needed after build the report
void SetLazyUpdate( bool aLazyUpdate ); void SetLazyUpdate( bool aLazyUpdate );
///> Forces updating the HTML page, after the report is built in lazy mode ///< Forces updating the HTML page, after the report is built in lazy mode
///> If aSort = true, the body messages will be ordered by severity ///< If aSort = true, the body messages will be ordered by severity
void Flush( bool aSort = false ); void Flush( bool aSort = false );
///> Set the visible severity filter. ///< Set the visible severity filter.
///> if aSeverities < 0 the m_showAll option is set ///< if aSeverities < 0 the m_showAll option is set
void SetVisibleSeverities( int aSeverities ); void SetVisibleSeverities( int aSeverities );
///> @return the visible severity filter. ///< @return the visible severity filter.
///> If the m_showAll option is set, the mask is < 0 ///< If the m_showAll option is set, the mask is < 0
int GetVisibleSeverities() const; int GetVisibleSeverities() const;
///> If true prints Info: at the beginning of each Info severity line (Default) ///< If true prints Info: at the beginning of each Info severity line (Default)
void SetPrintInfo( bool aPrintInfo ); void SetPrintInfo( bool aPrintInfo );
///> @return the visible severity filter. ///< @return the visible severity filter.
///> If the m_showAll option is set, the mask is < 0 ///< If the m_showAll option is set, the mask is < 0
void SetShowSeverity( SEVERITY aSeverity, bool aValue ); void SetShowSeverity( SEVERITY aSeverity, bool aValue );
///> Set the report full file name to the string ///< Set the report full file name to the string
void SetFileName( const wxString& aReportFileName ); void SetFileName( const wxString& aReportFileName );
///> @return reference to the current report fill file name string. ///< @return reference to the current report fill file name string.
wxString& GetFileName( void ); wxString& GetFileName( void );
@ -128,27 +126,27 @@ private:
void onBtnSaveToFile( wxCommandEvent& event ) override; void onBtnSaveToFile( wxCommandEvent& event ) override;
///> copy of the report, stored for filtering ///< copy of the report, stored for filtering
REPORT_LINES m_report; REPORT_LINES m_report;
///> Lines to print at the very end of the report, regardless of sorting ///< Lines to print at the very end of the report, regardless of sorting
REPORT_LINES m_reportTail; REPORT_LINES m_reportTail;
///> Lines to print at the very beginning of the report, regardless of sorting ///< Lines to print at the very beginning of the report, regardless of sorting
REPORT_LINES m_reportHead; REPORT_LINES m_reportHead;
///> the reporter ///< the reporter
WX_HTML_PANEL_REPORTER m_reporter; WX_HTML_PANEL_REPORTER m_reporter;
///> message severities to display (mask) ///< message severities to display (mask)
int m_severities; int m_severities;
bool m_lazyUpdate; bool m_lazyUpdate;
///> Print "Info:" at the front of Info messages (default) ///< Print "Info:" at the front of Info messages (default)
bool m_printInfo; bool m_printInfo;
///> Use this as the filename instead of /bin/report.txt (default) ///< Use this as the filename instead of /bin/report.txt (default)
wxString m_reportFileName; wxString m_reportFileName;
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2012-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017 CERN * Copyright (C) 2017 CERN
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com> * @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* *
@ -52,7 +52,7 @@ typedef std::map<wxString, FOOTPRINT*> FOOTPRINT_MAP;
typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP; typedef std::map<wxString, EINSTANCE*> EINSTANCE_MAP;
typedef std::map<wxString, std::unique_ptr<EPART>> EPART_MAP; typedef std::map<wxString, std::unique_ptr<EPART>> EPART_MAP;
///> Translates Eagle special characters to their counterparts in KiCad. ///< Translates Eagle special characters to their counterparts in KiCad.
wxString escapeName( const wxString& aNetName ); wxString escapeName( const wxString& aNetName );
static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const wxString& aName ) static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const wxString& aName )
@ -63,8 +63,7 @@ static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const wxString& aName
/** /**
* XML_PARSER_ERROR * Implement a simple wrapper around runtime_error to isolate the errors thrown by the
* implements a simple wrapper around runtime_error to isolate the errors thrown by the
* Eagle XML parser. * Eagle XML parser.
*/ */
struct XML_PARSER_ERROR : std::runtime_error struct XML_PARSER_ERROR : std::runtime_error
@ -97,8 +96,8 @@ struct TRIPLET
/** /**
* XPATH * Keep track of what we are working on within a PTREE.
* keeps track of what we are working on within a PTREE. *
* Then if an exception is thrown, the place within the tree that gave us * Then if an exception is thrown, the place within the tree that gave us
* grief can be reported almost accurately. To minimally impact * grief can be reported almost accurately. To minimally impact
* speed, merely assign const char* pointers during the tree walking * speed, merely assign const char* pointers during the tree walking
@ -165,8 +164,8 @@ public:
/** /**
* Function Convert * Convert a wxString to a generic type T.
* converts a wxString to a generic type T. *
* @param aValue is a wxString containing the value that will be converted to type T. * @param aValue is a wxString containing the value that will be converted to type T.
* @throw XML_PARSER_ERROR - an exception is thrown if the parsing fails or if the conversion to * @throw XML_PARSER_ERROR - an exception is thrown if the parsing fails or if the conversion to
* type T is unknown. * type T is unknown.
@ -181,8 +180,8 @@ template <>
wxString Convert<wxString>( const wxString& aValue ); wxString Convert<wxString>( const wxString& aValue );
/** /**
* OPTIONAL_XML_ATTRIBUTE * Model an optional XML attribute.
* models an optional XML attribute. *
* This was implemented as an alternative to OPT. This class should be replaced with a * This was implemented as an alternative to OPT. This class should be replaced with a
* simple typedef per type using std::optional when C++17 is published. * simple typedef per type using std::optional when C++17 is published.
*/ */
@ -198,8 +197,7 @@ private:
public: public:
/** /**
* Constructor OPTIONAL_XML_ATTRIBUTE * Construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not available.
* construct a default OPTIONAL_XML_ATTRIBUTE, whose data is not available.
*/ */
OPTIONAL_XML_ATTRIBUTE() : OPTIONAL_XML_ATTRIBUTE() :
m_isAvailable( false ), m_isAvailable( false ),
@ -207,7 +205,6 @@ public:
{} {}
/** /**
* Constructor OPTIONAL_XML_ATTRIBUTE
* @param aData is a wxString containing the value that should be converted to type T. If * @param aData is a wxString containing the value that should be converted to type T. If
* aData is empty, the attribute is understood as unavailable; otherwise, the * aData is empty, the attribute is understood as unavailable; otherwise, the
* conversion to T is tried. * conversion to T is tried.
@ -222,7 +219,6 @@ public:
} }
/** /**
* Constructor OPTIONAL_XML_ATTRIBUTE
* @param aData is the value of the XML attribute. If this constructor is called, the * @param aData is the value of the XML attribute. If this constructor is called, the
* attribute is available. * attribute is available.
*/ */
@ -233,8 +229,7 @@ public:
{} {}
/** /**
* Operator bool * @return bool the availability of the attribute.
* @return bool - the availability of the attribute.
*/ */
operator bool() const operator bool() const
{ {
@ -242,8 +237,8 @@ public:
} }
/** /**
* Assignment operator * Assign to a string (optionally) containing the data.
* to a string (optionally) containing the data. *
* @param aData is a wxString that should be converted to T. If the string is empty, the * @param aData is a wxString that should be converted to T. If the string is empty, the
* attribute is set to unavailable. * attribute is set to unavailable.
*/ */
@ -258,8 +253,8 @@ public:
} }
/** /**
* Assignment operator * Assign to an object of the base type containing the data.
* to an object of the base type containing the data. *
* @param aData is the actual value of the attribute. Calling this assignment, the attribute * @param aData is the actual value of the attribute. Calling this assignment, the attribute
* is automatically made available. * is automatically made available.
*/ */
@ -272,8 +267,6 @@ public:
} }
/** /**
* Equal operator
* to an object of the base type.
* @param aOther is the object of the base type that should be compared with this one. * @param aOther is the object of the base type that should be compared with this one.
*/ */
bool operator ==( const T& aOther ) const bool operator ==( const T& aOther ) const
@ -282,8 +275,8 @@ public:
} }
/** /**
* Function Set * Attempt to convert a string to the base type.
* tries to convert a string to the base type. *
* @param aString is the string that will be converted to the base type. * @param aString is the string that will be converted to the base type.
*/ */
void Set( const wxString& aString ) void Set( const wxString& aString )
@ -293,8 +286,8 @@ public:
} }
/** /**
* Function Get * Return a reference to the value of the attribute assuming it is available.
* returns a reference to the value of the attribute assuming it is available. *
* @return T& - the value of the attribute. * @return T& - the value of the attribute.
*/ */
T& Get() T& Get()
@ -304,8 +297,8 @@ public:
} }
/** /**
* Function CGet * Return a constant reference to the value of the attribute assuming it is available.
* returns a constant reference to the value of the attribute assuming it is available. *
* @return const T& - the value of the attribute. * @return const T& - the value of the attribute.
*/ */
const T& CGet() const const T& CGet() const
@ -315,8 +308,8 @@ public:
} }
/** /**
* Operator * * Return a reference to the value of the attribute assuming it is available.
* returns a reference to the value of the attribute assuming it is available. *
* @return T& - the value of the attribute. * @return T& - the value of the attribute.
*/ */
T& operator*() T& operator*()
@ -325,8 +318,8 @@ public:
} }
/** /**
* Operator * * Return a constant reference to the value of the attribute assuming it is available.
* returns a constant reference to the value of the attribute assuming it is available. *
* @return const T& - the value of the attribute. * @return const T& - the value of the attribute.
*/ */
const T& operator*() const const T& operator*() const
@ -335,8 +328,8 @@ public:
} }
/** /**
* Operator -> * Return a pointer to the value of the attribute assuming it is available.
* returns a pointer to the value of the attribute assuming it is available. *
* @return T* - the value of the attribute. * @return T* - the value of the attribute.
*/ */
T* operator->() T* operator->()
@ -345,8 +338,8 @@ public:
} }
/** /**
* Operator -> * Return a constant pointer to the value of the attribute assuming it is available.
* returns a constant pointer to the value of the attribute assuming it is available. *
* @return const T* - the value of the attribute. * @return const T* - the value of the attribute.
*/ */
const T* operator->() const const T* operator->() const
@ -357,15 +350,15 @@ public:
/** /**
* Function MapChildren * Provide an easy access to the children of an XML node via their names.
* provides an easy access to the children of an XML node via their names. *
* @param currentNode is a pointer to a wxXmlNode, whose children will be mapped. * @param currentNode is a pointer to a wxXmlNode, whose children will be mapped.
* @return NODE_MAP - a map linking the name of each children to the children itself (via a * @return NODE_MAP is a map linking the name of each children to the children itself (via a
* wxXmlNode*) * wxXmlNode*)
*/ */
NODE_MAP MapChildren( wxXmlNode* aCurrentNode ); NODE_MAP MapChildren( wxXmlNode* aCurrentNode );
///> Convert an Eagle curve end to a KiCad center for S_ARC ///< Convert an Eagle curve end to a KiCad center for S_ARC
wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAngle ); wxPoint ConvertArcCenter( const wxPoint& aStart, const wxPoint& aEnd, double aAngle );
// Pre-declare for typedefs // Pre-declare for typedefs
@ -396,10 +389,10 @@ struct ECOORD
EU_MIL, ///< mils/thous EU_MIL, ///< mils/thous
}; };
///> Value expressed in nanometers ///< Value expressed in nanometers
long long int value; long long int value;
///> Unit used for the value field ///< Unit used for the value field
static constexpr EAGLE_UNIT ECOORD_UNIT = EU_NM; static constexpr EAGLE_UNIT ECOORD_UNIT = EU_NM;
ECOORD() ECOORD()
@ -452,7 +445,7 @@ struct ECOORD
return value == aOther.value; return value == aOther.value;
} }
///> Converts a size expressed in a certain unit to nanometers. ///< Converts a size expressed in a certain unit to nanometers.
static long long int ConvertToNm( int aValue, enum EAGLE_UNIT aUnit ); static long long int ConvertToNm( int aValue, enum EAGLE_UNIT aUnit );
}; };
@ -594,10 +587,10 @@ struct ERECT
/** /**
* EATTR * Parse an Eagle "attribute" XML element.
* parses an Eagle "attribute" XML element. Note that an attribute element *
* is different than an XML element attribute. The attribute element is a * @note An attribute element is different than an XML element attribute. The attribute element
* full XML node in and of itself, and has attributes of its own. Blame Eagle. * is a full XML node in and of itself, and has attributes of its own. Blame Eagle.
*/ */
struct EATTR struct EATTR
{ {

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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-2021 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -28,7 +28,7 @@
using namespace KIGFX::PREVIEW; using namespace KIGFX::PREVIEW;
///> Snap an angle to the nearest 45 degrees ///< Snap an angle to the nearest 45 degrees
static double snapAngle( double aAngle ) static double snapAngle( double aAngle )
{ {
return KiROUND( aAngle / M_PI_4 ) * M_PI_4; return KiROUND( aAngle / M_PI_4 ) * M_PI_4;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2017-2021 Kicad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -90,9 +90,9 @@ static double getTickLineWidth( const TEXT_DIMS& textDims, bool aDrawingDropShad
*/ */
struct TICK_FORMAT struct TICK_FORMAT
{ {
double divisionBase; ///> multiple from the last scale double divisionBase; ///< multiple from the last scale
int majorStep; ///> ticks between major ticks int majorStep; ///< ticks between major ticks
int midStep; ///> ticks between medium ticks (0 if no medium ticks) int midStep; ///< ticks between medium ticks (0 if no medium ticks)
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2013-2020 KiCad Developers, see CHANGELOG.txt for contributors. * Copyright (C) 2013-2021 KiCad Developers, see CHANGELOG.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -43,7 +43,7 @@
#include <wx/stc/stc.h> #include <wx/stc/stc.h>
#include <kiplatform/app.h> #include <kiplatform/app.h>
///> Stores information about a mouse button state ///< Stores information about a mouse button state
struct TOOL_DISPATCHER::BUTTON_STATE struct TOOL_DISPATCHER::BUTTON_STATE
{ {
BUTTON_STATE( TOOL_MOUSE_BUTTONS aButton, const wxEventType& aDownEvent, BUTTON_STATE( TOOL_MOUSE_BUTTONS aButton, const wxEventType& aDownEvent,
@ -57,45 +57,45 @@ struct TOOL_DISPATCHER::BUTTON_STATE
dblClickEvent( aDblClickEvent ) dblClickEvent( aDblClickEvent )
{}; {};
///> Flag indicating that dragging is active for the given button. ///< Flag indicating that dragging is active for the given button.
bool dragging; bool dragging;
///> Flag indicating that the given button is pressed. ///< Flag indicating that the given button is pressed.
bool pressed; bool pressed;
///> Point where dragging has started (in world coordinates). ///< Point where dragging has started (in world coordinates).
VECTOR2D dragOrigin; VECTOR2D dragOrigin;
///> Point where click event has occurred. ///< Point where click event has occurred.
VECTOR2D downPosition; VECTOR2D downPosition;
///> Difference between drag origin point and current mouse position (expressed as distance in ///< Difference between drag origin point and current mouse position (expressed as distance in
///> pixels). ///< pixels).
double dragMaxDelta; double dragMaxDelta;
///> Determines the mouse button for which information are stored. ///< Determines the mouse button for which information are stored.
TOOL_MOUSE_BUTTONS button; TOOL_MOUSE_BUTTONS button;
///> The type of wxEvent that determines mouse button press. ///< The type of wxEvent that determines mouse button press.
wxEventType downEvent; wxEventType downEvent;
///> The type of wxEvent that determines mouse button release. ///< The type of wxEvent that determines mouse button release.
wxEventType upEvent; wxEventType upEvent;
///> The type of wxEvent that determines mouse button double click. ///< The type of wxEvent that determines mouse button double click.
wxEventType dblClickEvent; wxEventType dblClickEvent;
///> Time stamp for the last mouse button press event. ///< Time stamp for the last mouse button press event.
wxLongLong downTimestamp; wxLongLong downTimestamp;
///> Restores initial state. ///< Restores initial state.
void Reset() void Reset()
{ {
dragging = false; dragging = false;
pressed = false; pressed = false;
} }
///> Checks the current state of the button. ///< Checks the current state of the button.
bool GetState() const bool GetState() const
{ {
wxMouseState mouseState = wxGetMouseState(); wxMouseState mouseState = wxGetMouseState();
@ -251,6 +251,7 @@ bool TOOL_DISPATCHER::handleMouseButton( wxEvent& aEvent, int aIndex, bool aMoti
return false; return false;
} }
// Helper function to know if a special key ( see key list ) should be captured // Helper function to know if a special key ( see key list ) should be captured
// or if the event can be skipped // or if the event can be skipped
// on Linux, the event must be passed to the GUI if they are not used by KiCad, // on Linux, the event must be passed to the GUI if they are not used by KiCad,
@ -279,6 +280,7 @@ bool isKeySpecialCode( int aKeyCode )
return isInList; return isInList;
} }
// Helper function to know if a key should be managed by DispatchWxEvent() // Helper function to know if a key should be managed by DispatchWxEvent()
// or if the event can be ignored and skipped because the key is only a modifier // or if the event can be ignored and skipped because the key is only a modifier
// that is not used alone in kicad // that is not used alone in kicad
@ -430,7 +432,8 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
wxWindow* focus = wxWindow::FindFocus(); wxWindow* focus = wxWindow::FindFocus();
// Required in win32 to ensure wxTimer events get scheduled in between other events // Required in win32 to ensure wxTimer events get scheduled in between other events
// Or else we may stall them out entirely and never get them during actions like rapid mouse moves // Or else we may stall them out entirely and never get them during actions like rapid
// mouse moves.
KIPLATFORM::APP::ForceTimerMessagesToBeCreatedIfNecessary(); KIPLATFORM::APP::ForceTimerMessagesToBeCreatedIfNecessary();
wxEventType type = aEvent.GetEventType(); wxEventType type = aEvent.GetEventType();
@ -607,7 +610,8 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
// Not handled wxEVT_CHAR must be Skipped (sent to GUI). // Not handled wxEVT_CHAR must be Skipped (sent to GUI).
// Otherwise accelerators and shortcuts in main menu or toolbars are not seen. // Otherwise accelerators and shortcuts in main menu or toolbars are not seen.
// Escape key presses are never skipped by the handler since they correspond to tool cancel // Escape key presses are never skipped by the handler since they correspond to tool cancel
// events, and if they aren't skipped then they are propagated to other frames (which we don't want). // events, and if they aren't skipped then they are propagated to other frames (which we
// don't want).
if( (type == wxEVT_CHAR || type == wxEVT_CHAR_HOOK) if( (type == wxEVT_CHAR || type == wxEVT_CHAR_HOOK)
&& !keyIsSpecial && !keyIsSpecial
&& !handled && !handled

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013-2018 CERN * Copyright (C) 2013-2018 CERN
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -144,8 +144,7 @@ struct TOOL_MANAGER::TOOL_STATE
} }
/** /**
* Function Push() * Store the current state of the tool on stack. Stacks are stored internally and are not
* Stores the current state of the tool on stack. Stacks are stored internally and are not
* shared between different TOOL_STATE objects. * shared between different TOOL_STATE objects.
*/ */
void Push() void Push()
@ -156,9 +155,9 @@ struct TOOL_MANAGER::TOOL_STATE
} }
/** /**
* Function Pop() * Restore state of the tool from stack. Stacks are stored internally and are not
* Restores state of the tool from stack. Stacks are stored internally and are not
* shared between different TOOL_STATE objects. * shared between different TOOL_STATE objects.
*
* @return True if state was restored, false if the stack was empty. * @return True if state was restored, false if the stack was empty.
*/ */
bool Pop() bool Pop()
@ -179,10 +178,10 @@ struct TOOL_MANAGER::TOOL_STATE
} }
private: private:
///> Stack preserving previous states of a TOOL. ///< Stack preserving previous states of a TOOL.
std::stack<std::unique_ptr<TOOL_STATE>> stateStack; std::stack<std::unique_ptr<TOOL_STATE>> stateStack;
///> Restores the initial state. ///< Restores the initial state.
void clear() void clear()
{ {
idle = true; idle = true;

View File

@ -2,6 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013-2017 CERN * Copyright (C) 2013-2017 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -70,8 +72,7 @@ private:
friend class VIEW; friend class VIEW;
/** /**
* Function getLayers() * Return layer numbers used by the item.
* Returns layer numbers used by the item.
* *
* @param aLayers[]: output layer index array * @param aLayers[]: output layer index array
* @param aCount: number of layer indices in aLayers[] * @param aCount: number of layer indices in aLayers[]
@ -91,17 +92,16 @@ private:
int m_requiredUpdate; ///< Flag required for updating int m_requiredUpdate; ///< Flag required for updating
int m_drawPriority; ///< Order to draw this item in a layer, lowest first int m_drawPriority; ///< Order to draw this item in a layer, lowest first
///> Helper for storing cached items group ids ///< Helper for storing cached items group ids
typedef std::pair<int, int> GroupPair; typedef std::pair<int, int> GroupPair;
///> Indexes of cached GAL display lists corresponding to the item (for every layer it occupies). ///< Indexes of cached GAL display lists corresponding to the item (for every layer it.
///> (in the std::pair "first" stores layer number, "second" stores group id). ///< occupies)(in the std::pair "first" stores layer number, "second" stores group id).
GroupPair* m_groups; GroupPair* m_groups;
int m_groupsSize; int m_groupsSize;
/** /**
* Function getGroup() * Return number of the group id for the given layer, or -1 in case it was not cached before.
* Returns number of the group id for the given layer, or -1 in case it was not cached before.
* *
* @param aLayer is the layer number for which group id is queried. * @param aLayer is the layer number for which group id is queried.
* @return group id or -1 in case there is no group id (ie. item is not cached). * @return group id or -1 in case there is no group id (ie. item is not cached).
@ -118,8 +118,7 @@ private:
} }
/** /**
* Function setGroup() * Set a group id for the item and the layer combination.
* Sets a group id for the item and the layer combination.
* *
* @param aLayer is the layer numbe. * @param aLayer is the layer numbe.
* @param aGroup is the group id. * @param aGroup is the group id.
@ -151,8 +150,7 @@ private:
/** /**
* Function deleteGroups() * Remove all of the stored group ids. Forces recaching of the item.
* Removes all of the stored group ids. Forces recaching of the item.
*/ */
void deleteGroups() void deleteGroups()
{ {
@ -163,8 +161,7 @@ private:
/** /**
* Function storesGroups() * Return information if the item uses at least one group id (ie. if it is cached at all).
* Returns information if the item uses at least one group id (ie. if it is cached at all).
* *
* @returns true in case it is cached at least for one layer. * @returns true in case it is cached at least for one layer.
*/ */
@ -175,7 +172,8 @@ private:
/** /**
* Reorders the stored groups (to facilitate reordering of layers) * Reorder the stored groups (to facilitate reordering of layers).
*
* @see VIEW::ReorderLayerData * @see VIEW::ReorderLayerData
* *
* @param aReorderMap is the mapping of old to new layer ids * @param aReorderMap is the mapping of old to new layer ids
@ -202,8 +200,7 @@ private:
std::vector<int> m_layers; std::vector<int> m_layers;
/** /**
* Function saveLayers() * Save layers used by the item.
* Saves layers used by the item.
* *
* @param aLayers is an array containing layer numbers to be saved. * @param aLayers is an array containing layer numbers to be saved.
* @param aCount is the size of the array. * @param aCount is the size of the array.
@ -222,8 +219,7 @@ private:
} }
/** /**
* Function viewRequiredUpdate() * Return current update flag for an item.
* Returns current update flag for an item.
*/ */
int requiredUpdate() const int requiredUpdate() const
{ {
@ -231,8 +227,7 @@ private:
} }
/** /**
* Function clearUpdateFlags() * Mark an item as already updated, so it is not going to be redrawn.
* Marks an item as already updated, so it is not going to be redrawn.
*/ */
void clearUpdateFlags() void clearUpdateFlags()
{ {
@ -240,8 +235,7 @@ private:
} }
/** /**
* Function isRenderable() * Return if the item should be drawn or not.
* Returns if the item should be drawn or not.
*/ */
bool isRenderable() const bool isRenderable() const
{ {
@ -1198,7 +1192,8 @@ void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags )
} }
else else
{ {
// updateLayers updates geometry too, so we do not have to update both of them at the same time // updateLayers updates geometry too, so we do not have to update both of them at the
// same time
if( aUpdateFlags & LAYERS ) if( aUpdateFlags & LAYERS )
{ {
updateLayers( aItem ); updateLayers( aItem );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018 CERN * Copyright (C) 2018 CERN
* Author: Maciej Suminski <maciej.suminski@cern.ch> * Author: Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -90,34 +90,34 @@ public:
* *
* @param aLayerName a text which can be printed as layer name. * @param aLayerName a text which can be printed as layer name.
* @param aPageNum the number of the current page (only used to print this value). * @param aPageNum the number of the current page (only used to print this value).
* @param aPageCount the number of pages to ptint (only used to print this value). * @param aPageCount the number of pages to print (only used to print this value).
*/ */
virtual void DrawPage( const wxString& aLayerName = wxEmptyString, virtual void DrawPage( const wxString& aLayerName = wxEmptyString,
int aPageNum = 1, int aPageCount = 1 ); int aPageNum = 1, int aPageCount = 1 );
protected: protected:
///> Convert mils to internal units ///< Convert mils to internal units
virtual int milsToIU( double aMils ) const = 0; virtual int milsToIU( double aMils ) const = 0;
///> Enables layers visibility for a printout ///< Enables layers visibility for a printout
virtual void setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet ); virtual void setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet );
///> Configures PAINTER object for a printout ///< Configures PAINTER object for a printout
virtual void setupPainter( KIGFX::PAINTER& aPainter ); virtual void setupPainter( KIGFX::PAINTER& aPainter );
///> Configures GAL object for a printout ///< Configures GAL object for a printout
virtual void setupGal( KIGFX::GAL* aGal ); virtual void setupGal( KIGFX::GAL* aGal );
///> Returns bounding box of the printed objects (excluding worksheet frame) ///< Returns bounding box of the printed objects (excluding worksheet frame)
virtual EDA_RECT getBoundingBox() = 0; virtual EDA_RECT getBoundingBox() = 0;
///> Returns a PAINTER instance used to draw the items. ///< Returns a PAINTER instance used to draw the items.
virtual std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) = 0; virtual std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) = 0;
///> Source VIEW object (note that actual printing only refers to this object) ///< Source VIEW object (note that actual printing only refers to this object)
const KIGFX::VIEW* m_view; const KIGFX::VIEW* m_view;
///> Printout parameters ///< Printout parameters
BOARD_PRINTOUT_SETTINGS m_settings; BOARD_PRINTOUT_SETTINGS m_settings;
}; };

View File

@ -2,7 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright 2016-2017 CERN * Copyright 2016-2017 CERN
* Copyright (C) 2020 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see change_log.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -34,15 +35,15 @@
class EDA_ITEM; class EDA_ITEM;
///> Types of changes ///< Types of changes
enum CHANGE_TYPE { enum CHANGE_TYPE {
CHT_ADD = 1, CHT_ADD = 1,
CHT_REMOVE = 2, CHT_REMOVE = 2,
CHT_MODIFY = 4, CHT_MODIFY = 4,
CHT_TYPE = CHT_ADD | CHT_REMOVE | CHT_MODIFY, CHT_TYPE = CHT_ADD | CHT_REMOVE | CHT_MODIFY,
///> Flag to indicate the change is already applied, ///< Flag to indicate the change is already applied,
///> just notify observers (not compatible with CHT_MODIFY) ///< just notify observers (not compatible with CHT_MODIFY)
CHT_DONE = 8, CHT_DONE = 8,
CHT_FLAGS = CHT_DONE CHT_FLAGS = CHT_DONE
}; };
@ -73,39 +74,39 @@ public:
COMMIT(); COMMIT();
virtual ~COMMIT(); virtual ~COMMIT();
///> Adds a new item to the model ///< Add a new item to the model
COMMIT& Add( EDA_ITEM* aItem ) COMMIT& Add( EDA_ITEM* aItem )
{ {
return Stage( aItem, CHT_ADD ); return Stage( aItem, CHT_ADD );
} }
///> Notifies observers that aItem has been added ///< Notify observers that aItem has been added
COMMIT& Added( EDA_ITEM* aItem ) COMMIT& Added( EDA_ITEM* aItem )
{ {
return Stage( aItem, CHT_ADD | CHT_DONE ); return Stage( aItem, CHT_ADD | CHT_DONE );
} }
///> Removes a new item from the model ///< Remove a new item from the model
COMMIT& Remove( EDA_ITEM* aItem ) COMMIT& Remove( EDA_ITEM* aItem )
{ {
return Stage( aItem, CHT_REMOVE ); return Stage( aItem, CHT_REMOVE );
} }
///> Notifies observers that aItem has been removed ///< Notify observers that aItem has been removed
COMMIT& Removed( EDA_ITEM* aItem ) COMMIT& Removed( EDA_ITEM* aItem )
{ {
return Stage( aItem, CHT_REMOVE | CHT_DONE ); return Stage( aItem, CHT_REMOVE | CHT_DONE );
} }
///> Modifies a given item in the model. ///< Modify a given item in the model.
///> Must be called before modification is performed. ///< Must be called before modification is performed.
COMMIT& Modify( EDA_ITEM* aItem ) COMMIT& Modify( EDA_ITEM* aItem )
{ {
return Stage( aItem, CHT_MODIFY ); return Stage( aItem, CHT_MODIFY );
} }
///> Creates an undo entry for an item that has been already modified. Requires a copy done ///< Create an undo entry for an item that has been already modified. Requires a copy done
///> before the modification. ///< before the modification.
COMMIT& Modified( EDA_ITEM* aItem, EDA_ITEM* aCopy ) COMMIT& Modified( EDA_ITEM* aItem, EDA_ITEM* aCopy )
{ {
return createModified( aItem, aCopy ); return createModified( aItem, aCopy );
@ -121,7 +122,7 @@ public:
return *this; return *this;
} }
///> Adds a change of the item aItem of type aChangeType to the change list. ///< Add a change of the item aItem of type aChangeType to the change list.
virtual COMMIT& Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType ); virtual COMMIT& Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType );
virtual COMMIT& Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aChangeType ); virtual COMMIT& Stage( std::vector<EDA_ITEM*>& container, CHANGE_TYPE aChangeType );
@ -129,11 +130,11 @@ public:
virtual COMMIT& Stage( const PICKED_ITEMS_LIST& aItems, virtual COMMIT& Stage( const PICKED_ITEMS_LIST& aItems,
UNDO_REDO aModFlag = UNDO_REDO::UNSPECIFIED ); UNDO_REDO aModFlag = UNDO_REDO::UNSPECIFIED );
///> Executes the changes. ///< Execute the changes.
virtual void Push( const wxString& aMessage = wxT( "A commit" ), virtual void Push( const wxString& aMessage = wxT( "A commit" ),
bool aCreateUndoEntry = true, bool aSetDirtyBit = true ) = 0; bool aCreateUndoEntry = true, bool aSetDirtyBit = true ) = 0;
///> Revert the commit by restoring the modified items state. ///< Revert the commit by restoring the modified items state.
virtual void Revert() = 0; virtual void Revert() = 0;
bool Empty() const bool Empty() const
@ -141,15 +142,15 @@ public:
return m_changes.empty(); return m_changes.empty();
} }
///> Returns status of an item. ///< Returns status of an item.
int GetStatus( EDA_ITEM* aItem ); int GetStatus( EDA_ITEM* aItem );
protected: protected:
struct COMMIT_LINE struct COMMIT_LINE
{ {
EDA_ITEM* m_item; ///> Main item that is added/deleted/modified EDA_ITEM* m_item; ///< Main item that is added/deleted/modified
EDA_ITEM* m_copy; ///> Optional copy of the item EDA_ITEM* m_copy; ///< Optional copy of the item
CHANGE_TYPE m_type; ///> Modification type CHANGE_TYPE m_type; ///< Modification type
}; };
// Should be called in Push() & Revert() methods // Should be called in Push() & Revert() methods

View File

@ -4,7 +4,7 @@
* Copyright (C) 2014-2020 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2014-2020 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -148,7 +148,7 @@ wxString GetOSXKicadDataDir();
// this function, so add it if missing // this function, so add it if missing
#if !wxCHECK_VERSION( 3, 1, 0 ) #if !wxCHECK_VERSION( 3, 1, 0 )
#define USE_KICAD_WXSTRING_HASH // for common.cpp #define USE_KICAD_WXSTRING_HASH // for common.cpp
///> Template specialization to enable wxStrings for certain containers (e.g. unordered_map) ///< Template specialization to enable wxStrings for certain containers (e.g. unordered_map)
namespace std namespace std
{ {
template<> struct hash<wxString> template<> struct hash<wxString>

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -23,7 +23,8 @@
*/ */
/** /**
* This file is part of the common library * This file is part of the common library.
*
* @file confirm.h * @file confirm.h
* @see common.h * @see common.h
*/ */
@ -44,7 +45,7 @@ class wxStaticBitmap;
class KIDIALOG : public wxRichMessageDialog class KIDIALOG : public wxRichMessageDialog
{ {
public: public:
///> Dialog type. Selects appropriate icon and default dialog title ///< Dialog type. Selects appropriate icon and default dialog title
enum KD_TYPE { KD_NONE, KD_INFO, KD_QUESTION, KD_WARNING, KD_ERROR }; enum KD_TYPE { KD_NONE, KD_INFO, KD_QUESTION, KD_WARNING, KD_ERROR };
KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption, KIDIALOG( wxWindow* aParent, const wxString& aMessage, const wxString& aCaption,
@ -58,10 +59,10 @@ public:
return wxRichMessageDialog::SetOKCancelLabels( ok, cancel ); return wxRichMessageDialog::SetOKCancelLabels( ok, cancel );
} }
///> Shows the 'do not show again' checkbox ///< Shows the 'do not show again' checkbox
void DoNotShowCheckbox( wxString file, int line ); void DoNotShowCheckbox( wxString file, int line );
///> Checks the 'do not show again' setting for the dialog ///< Checks the 'do not show again' setting for the dialog
bool DoNotShowAgain() const; bool DoNotShowAgain() const;
void ForceShowAgain(); void ForceShowAgain();
@ -154,7 +155,7 @@ void DisplayInfoMessage( wxWindow* parent, const wxString& aMessage,
bool IsOK( wxWindow* aParent, const wxString& aMessage ); bool IsOK( wxWindow* aParent, const wxString& aMessage );
/** /**
* Displays a warning dialog with \a aMessage and returns the user response. * Display a warning dialog with \a aMessage and returns the user response.
* *
* @param aParent is the parent window. NULL can be used if the parent is the top level window. * @param aParent is the parent window. NULL can be used if the parent is the top level window.
* @param aWarning is the warning to display in the top part of the dialog box using a bold font. * @param aWarning is the warning to display in the top part of the dialog box using a bold font.
@ -174,7 +175,7 @@ int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxStrin
/** /**
* Displays a dialog with radioboxes asking the user to select an option. * Display a dialog with radioboxes asking the user to select an option.
* *
* @param aParent is the parent window. * @param aParent is the parent window.
* @param aTitle is the dialog title. * @param aTitle is the dialog title.
@ -183,6 +184,6 @@ int OKOrCancelDialog( wxWindow* aParent, const wxString& aWarning, const wxStrin
* @return Index of the selected option or -1 when the dialog has been canceled. * @return Index of the selected option or -1 when the dialog has been canceled.
*/ */
int SelectSingleOption( wxWindow* aParent, const wxString& aTitle, const wxString& aMessage, int SelectSingleOption( wxWindow* aParent, const wxString& aTitle, const wxString& aMessage,
const wxArrayString& aOptions ); const wxArrayString& aOptions );
#endif /* __INCLUDE__CONFIRM_H__ */ #endif /* __INCLUDE__CONFIRM_H__ */

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2019-2021 KiCad Developers, see CHANGELOG.TXT for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -76,21 +76,21 @@ public:
*/ */
struct CURSOR_DEF struct CURSOR_DEF
{ {
///> The ID key used to uniquely identify a cursor in a given store ///< The ID key used to uniquely identify a cursor in a given store
KICURSOR m_id_key; KICURSOR m_id_key;
///> The image data bitmap ///< The image data bitmap
const unsigned char* m_image_data; const unsigned char* m_image_data;
///> The mask data bitmap ///< The mask data bitmap
const unsigned char* m_mask_data; const unsigned char* m_mask_data;
const char** m_xpm; const char** m_xpm;
///> The image size in pixels ///< The image size in pixels
wxSize m_size; wxSize m_size;
///> The "hotspot" where the cursor "is" in the image ///< The "hotspot" where the cursor "is" in the image
wxPoint m_hotspot; wxPoint m_hotspot;
}; };
@ -116,7 +116,7 @@ public:
static const wxStockCursor GetStockCursor( KICURSOR aCursorType ); static const wxStockCursor GetStockCursor( KICURSOR aCursorType );
private: private:
///> Internal store of cursors by ID ///< Internal store of cursors by ID
std::map<KICURSOR, wxCursor> m_store; std::map<KICURSOR, wxCursor> m_store;
}; };

View File

@ -5,7 +5,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2018-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -84,9 +84,10 @@ public:
* Dialog constructor * Dialog constructor
* @param aParent is the caller * @param aParent is the caller
* @param aCurrentColor is the current color, used to show it in dialog * @param aCurrentColor is the current color, used to show it in dialog
* @param aAllowOpacityControl = true to allow opacity (alpha channel) setting * @param aAllowOpacityControl true to allow opacity (alpha channel) setting
* false to not show this setting (opacity = 1.0 always) * false to not show this setting (opacity = 1.0 always)
* @param aUserColors: if not null is a list of defined colors replacing the dialog predefined colors * @param aUserColors if not null is a list of defined colors replacing the dialog
* predefined colors
*/ */
DIALOG_COLOR_PICKER( wxWindow* aParent, const KIGFX::COLOR4D& aCurrentColor, DIALOG_COLOR_PICKER( wxWindow* aParent, const KIGFX::COLOR4D& aCurrentColor,
bool aAllowOpacityControl, CUSTOM_COLORS_LIST* aUserColors = nullptr, bool aAllowOpacityControl, CUSTOM_COLORS_LIST* aUserColors = nullptr,
@ -105,7 +106,7 @@ private:
bool m_allowMouseEvents; bool m_allowMouseEvents;
bool m_allowOpacityCtrl; ///< true to show the widget, bool m_allowOpacityCtrl; ///< true to show the widget,
///< false to keep alpha channel = 1.0 ///< false to keep alpha channel = 1.0
KIGFX::COLOR4D m_previousColor4D; ///< the inital color4d KIGFX::COLOR4D m_previousColor4D; ///< the initial color4d
KIGFX::COLOR4D m_newColor4D; ///< the current color4d KIGFX::COLOR4D m_newColor4D; ///< the current color4d
KIGFX::COLOR4D m_defaultColor; ///< The default color4d KIGFX::COLOR4D m_defaultColor; ///< The default color4d
@ -117,7 +118,7 @@ private:
wxPoint m_cursorBitmapGreen; ///< the green cursor on the RGB bitmap palette. wxPoint m_cursorBitmapGreen; ///< the green cursor on the RGB bitmap palette.
wxPoint m_cursorBitmapBlue; ///< the blue cursor on the RGB bitmap palette. wxPoint m_cursorBitmapBlue; ///< the blue cursor on the RGB bitmap palette.
wxPoint m_cursorBitmapHSV; ///< the cursor on the HSV bitmap palette. wxPoint m_cursorBitmapHSV; ///< the cursor on the HSV bitmap palette.
wxPoint* m_selectedCursor; ///< the ref cursor to the selected curor, if any, or null. wxPoint* m_selectedCursor; ///< the ref cursor to the selected cursor, if any, or null.
double m_hue; ///< the current hue, in degrees (0 ... 360) double m_hue; ///< the current hue, in degrees (0 ... 360)
double m_sat; ///< the current saturation (0 ... 1.0) double m_sat; ///< the current saturation (0 ... 1.0)
@ -136,7 +137,7 @@ private:
void createRGBBitmap(); ///< generate the bitmap that shows the RVB color space void createRGBBitmap(); ///< generate the bitmap that shows the RVB color space
void drawRGBPalette(); ///< draws the RVB color space void drawRGBPalette(); ///< draws the RVB color space
///> repaint a static bitmap with the aColor4D color ///< repaint a static bitmap with the aColor4D color
void updatePreview( wxStaticBitmap* aStaticBitmap, KIGFX::COLOR4D& aColor4D ); void updatePreview( wxStaticBitmap* aStaticBitmap, KIGFX::COLOR4D& aColor4D );
///< Event handler from wxSlider: brightness (value) control ///< Event handler from wxSlider: brightness (value) control
@ -152,7 +153,7 @@ private:
void OnChangeEditHue( wxSpinEvent& event ) override; void OnChangeEditHue( wxSpinEvent& event ) override;
void OnChangeEditSat( wxSpinEvent& event ) override; void OnChangeEditSat( wxSpinEvent& event ) override;
///> mouse handlers, when clicking on a palette bitmap ///< mouse handlers, when clicking on a palette bitmap
void onRGBMouseClick( wxMouseEvent& event ) override; void onRGBMouseClick( wxMouseEvent& event ) override;
void onRGBMouseDrag( wxMouseEvent& event ) override; void onRGBMouseDrag( wxMouseEvent& event ) override;
void onHSVMouseClick( wxMouseEvent& event ) override; void onHSVMouseClick( wxMouseEvent& event ) override;
@ -163,8 +164,9 @@ private:
///< Event handler for the reset button press ///< Event handler for the reset button press
void OnResetButton( wxCommandEvent& aEvent ) override; void OnResetButton( wxCommandEvent& aEvent ) override;
/** manage the Hue and Saturation settings when the mouse cursor /**
* is at aMouseCursor. * Manage the Hue and Saturation settings when the mouse cursor is at aMouseCursor.
*
* @param aMouseCursor is the mouse cursor position on the HSV bitmap * @param aMouseCursor is the mouse cursor position on the HSV bitmap
* @return true if the Hue and Saturation can be set from aMouseCursor, * @return true if the Hue and Saturation can be set from aMouseCursor,
* if Saturation value computed from aMouseCursor is <= 1.0, * if Saturation value computed from aMouseCursor is <= 1.0,
@ -172,14 +174,16 @@ private:
*/ */
bool setHSvaluesFromCursor( wxPoint aMouseCursor ); bool setHSvaluesFromCursor( wxPoint aMouseCursor );
///> Event handler for defined color buttons ///< Event handler for defined color buttons
void buttColorClick( wxMouseEvent& event ); void buttColorClick( wxMouseEvent& event );
///> called when creating the dialog ///< called when creating the dialog
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
/** creates the bitmap buttons for each defined colors /**
* if aPredefinedColors is nullptr, a internal predefined list will be used * Create the bitmap buttons for each defined colors.
*
* If aPredefinedColors is nullptr, a internal predefined list will be used.
*/ */
void initDefinedColors( CUSTOM_COLORS_LIST* aPredefinedColors ); void initDefinedColors( CUSTOM_COLORS_LIST* aPredefinedColors );

View File

@ -2,8 +2,9 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2017 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017 CERN * Copyright (C) 2017 CERN
*
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@ -20,7 +21,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
///> Helper functions to substitute paths with environmental variables. ///< Helper functions to substitute paths with environmental variables.
#ifndef ENV_PATHS_H #ifndef ENV_PATHS_H
#define ENV_PATHS_H #define ENV_PATHS_H
@ -28,45 +29,46 @@
#include <pgm_base.h> #include <pgm_base.h>
/** /**
* Normalizes a file path to an environmental variable, if possible. * Normalize a file path to an environmental variable, if possible.
* *
* @param aFilePath is the full file path (path and file name) to be normalized. * @param aFilePath is the full file path (path and file name) to be normalized.
* @param aEnvVars is an optional map of environmental variables to try substition with. * @param aEnvVars is an optional map of environmental variables to try substitution with.
* @param aProject is an optional project, to normalize the file path to the project path. * @param aProject is an optional project, to normalize the file path to the project path.
* @return Normalized full file path (path and file name) if succeeded or empty string if the * @return Normalized full file path (path and file name) if succeeded or empty string if the
* path could not be normalized. * path could not be normalized.
*/ */
wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars, wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars,
const PROJECT* aProject ); const PROJECT* aProject );
/** /**
* Normalizes a file path to an environmental variable, if possible. * Normalize a file path to an environmental variable, if possible.
* *
* @param aFilePath is the full file path (path and file name) to be normalized. * @param aFilePath is the full file path (path and file name) to be normalized.
* @param aEnvVars is an optional map of environmental variables to try substition with. * @param aEnvVars is an optional map of environmental variables to try substitution with.
* @param aProjectPath is an optional string to normalize the file path to the project path. * @param aProjectPath is an optional string to normalize the file path to the project path.
* @return Normalized full file path (path and file name) if succeeded or empty string if the * @return Normalized full file path (path and file name) if succeeded or empty string if the
* path could not be normalized. * path could not be normalized.
*/ */
wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars, wxString NormalizePath( const wxFileName& aFilePath, const ENV_VAR_MAP* aEnvVars,
const wxString& aProjectPath ); const wxString& aProjectPath );
/** /**
* Searches the default paths trying to find one with the requested file. * Search the default paths trying to find one with the requested file.
* *
* @param aFileName is the name of the searched file. It might be a relative path. * @param aFileName is the name of the searched file. It might be a relative path.
* @param aEnvVars is an optional map of environmental variables that can contain paths. * @param aEnvVars is an optional map of environmental variables that can contain paths.
* @param aProject is an optional project, to check the project path. * @param aProject is an optional project, to check the project path.
* @return Full path (apth and file name) if the file was found in one of the paths, otherwise * @return Full path (apth and file name) if the file was found in one of the paths, otherwise
* an empty string. * an empty string.
*/ */
wxString ResolveFile( const wxString& aFileName, const ENV_VAR_MAP* aEnvVars, wxString ResolveFile( const wxString& aFileName, const ENV_VAR_MAP* aEnvVars,
const PROJECT* aProject ); const PROJECT* aProject );
/** /**
* Checks if a given filename is within a given project directory (not whether it exists!) * Check if a given filename is within a given project directory (not whether it exists!)
*
* @param aFileName is the absolute path to check * @param aFileName is the absolute path to check
* @param aProject is the project to test agains * @param aProject is the project to test against
* @param aSubPath will be filled with the relative path to the file inside the project (if any) * @param aSubPath will be filled with the relative path to the file inside the project (if any)
* @return true if aFileName's path is inside aProject's path * @return true if aFileName's path is inside aProject's path
*/ */

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de * Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2012-2020 Kicad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2012-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2018 CERN * Copyright (C) 2017-2018 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -40,7 +40,7 @@
#include <memory> #include <memory>
/** /**
* Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer. * The Cairo implementation of the graphics abstraction layer.
* *
* Quote from Wikipedia: * Quote from Wikipedia:
* " Cairo is a software library used to provide a vector graphics-based, device-independent * " Cairo is a software library used to provide a vector graphics-based, device-independent
@ -213,7 +213,7 @@ public:
void EnableDepthTest( bool aEnabled = false ) override; void EnableDepthTest( bool aEnabled = false ) override;
///> @copydoc GAL::DrawGrid() ///< @copydoc GAL::DrawGrid()
void DrawGrid() override; void DrawGrid() override;
@ -264,17 +264,17 @@ protected:
void storePath(); ///< Store the actual path void storePath(); ///< Store the actual path
/** /**
* Blits cursor into the current screen. * Blit cursor into the current screen.
*/ */
void blitCursor( wxMemoryDC& clientDC ); void blitCursor( wxMemoryDC& clientDC );
/// Drawing polygons & polylines is the same in cairo, so here is the common code /// Drawing polygons & polylines is the same in Cairo, so here is the common code
void drawPoly( const std::deque<VECTOR2D>& aPointList ); void drawPoly( const std::deque<VECTOR2D>& aPointList );
void drawPoly( const VECTOR2D aPointList[], int aListSize ); void drawPoly( const VECTOR2D aPointList[], int aListSize );
void drawPoly( const SHAPE_LINE_CHAIN& aLineChain ); void drawPoly( const SHAPE_LINE_CHAIN& aLineChain );
/** /**
* Returns a valid key that can be used as a new group number. * Return a valid key that can be used as a new group number.
* *
* @return An unique group number that is not used by any other group. * @return An unique group number that is not used by any other group.
*/ */
@ -369,7 +369,7 @@ public:
~CAIRO_GAL(); ~CAIRO_GAL();
///> @copydoc GAL::IsVisible() ///< @copydoc GAL::IsVisible()
bool IsVisible() const override bool IsVisible() const override
{ {
return IsShownOnScreen() && !GetClientRect().IsEmpty(); return IsShownOnScreen() && !GetClientRect().IsEmpty();
@ -443,7 +443,7 @@ public:
*/ */
void skipMouseEvent( wxMouseEvent& aEvent ); void skipMouseEvent( wxMouseEvent& aEvent );
///> Cairo-specific update handlers ///< Cairo-specific update handlers
bool updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions ) override; bool updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions ) override;
protected: protected:
@ -462,7 +462,7 @@ protected:
unsigned char* wxOutput; ///< wxImage compatible buffer unsigned char* wxOutput; ///< wxImage compatible buffer
// Variables related to Cairo <-> wxWidgets // Variables related to Cairo <-> wxWidgets
unsigned char* bitmapBuffer; ///< Storage of the cairo image unsigned char* bitmapBuffer; ///< Storage of the Cairo image
int stride; ///< Stride value for Cairo int stride; ///< Stride value for Cairo
int wxBufferWidth; int wxBufferWidth;
bool isInitialized; ///< Are Cairo image & surface ready to use bool isInitialized; ///< Are Cairo image & surface ready to use

View File

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2018 CERN * Copyright (C) 2018 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* Author: Maciej Suminski <maciej.suminski@cern.ch> * Author: Maciej Suminski <maciej.suminski@cern.ch>
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
@ -71,7 +71,7 @@ private:
cairo_surface_t* m_surface; cairo_surface_t* m_surface;
#ifdef __WXMSW__ #ifdef __WXMSW__
///> DC handle on Windows ///< DC handle on Windows
void* m_hdc; // the real type is HDC, but do not pull in extra headers void* m_hdc; // the real type is HDC, but do not pull in extra headers
#endif /* __WXMSW__ */ #endif /* __WXMSW__ */
@ -110,17 +110,17 @@ public:
void SetSheetSize( const VECTOR2D& aSize ) override; void SetSheetSize( const VECTOR2D& aSize ) override;
private: private:
///> Returns true if page orientation is landscape ///< Returns true if page orientation is landscape
bool isLandscape() const bool isLandscape() const
{ {
return m_nativePaperSize.x > m_nativePaperSize.y; return m_nativePaperSize.x > m_nativePaperSize.y;
} }
///> Printout size ///< Printout size
VECTOR2D m_nativePaperSize; VECTOR2D m_nativePaperSize;
///> Flag indicating whether the platform rotates page automatically or ///< Flag indicating whether the platform rotates page automatically or
///> GAL needs to handle it in the transformation matrix ///< GAL needs to handle it in the transformation matrix
bool m_hasNativeLandscapeRotation; bool m_hasNativeLandscapeRotation;
std::unique_ptr<CAIRO_PRINT_CTX> m_printCtx; std::unique_ptr<CAIRO_PRINT_CTX> m_printCtx;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2017 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -86,7 +86,7 @@ namespace KIGFX
GAL_DISPLAY_OPTIONS(); GAL_DISPLAY_OPTIONS();
/** /**
* Read GAL config options from applicaton-level config * Read GAL config options from application-level config
* @param aCfg the window settings to load from * @param aCfg the window settings to load from
*/ */
void ReadWindowSettings( WINDOW_SETTINGS& aCfg ); void ReadWindowSettings( WINDOW_SETTINGS& aCfg );
@ -120,28 +120,28 @@ namespace KIGFX
DPI_SCALING m_dpi; DPI_SCALING m_dpi;
///> The grid style to draw the grid in ///< The grid style to draw the grid in
KIGFX::GRID_STYLE m_gridStyle; KIGFX::GRID_STYLE m_gridStyle;
///> Snapping options for the grid ///< Snapping options for the grid
GRID_SNAPPING m_gridSnapping; GRID_SNAPPING m_gridSnapping;
///> Thickness to render grid lines/dots ///< Thickness to render grid lines/dots
double m_gridLineWidth; double m_gridLineWidth;
///> Minimum pixel distance between displayed grid lines ///< Minimum pixel distance between displayed grid lines
double m_gridMinSpacing; double m_gridMinSpacing;
///> Whether or not to draw the coordinate system axes ///< Whether or not to draw the coordinate system axes
bool m_axesEnabled; bool m_axesEnabled;
///> Fullscreen crosshair or small cross ///< Fullscreen crosshair or small cross
bool m_fullscreenCursor; bool m_fullscreenCursor;
///> Force cursor display ///< Force cursor display
bool m_forceDisplayCursor; bool m_forceDisplayCursor;
///> The pixel scale factor (>1 for hi-DPI scaled displays) ///< The pixel scale factor (>1 for hi-DPI scaled displays)
double m_scaleFactor; double m_scaleFactor;
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de * Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* Graphics Abstraction Layer (GAL) - base class * Graphics Abstraction Layer (GAL) - base class
* *
@ -47,10 +47,10 @@ namespace KIGFX
{ {
/** /**
* Class GAL is the abstract interface for drawing on a 2D-surface. * Abstract interface for drawing on a 2D-surface.
* *
* The functions are optimized for drawing shapes of an EDA-program such as KiCad. Most methods * The functions are optimized for drawing shapes of an EDA-program such as KiCad. Most methods
* are abstract and need to be implemented by a lower layer, for example by a cairo or OpenGL * are abstract and need to be implemented by a lower layer, for example by a Cairo or OpenGL
* implementation. Almost all methods use world coordinates as arguments. The board design is * implementation. Almost all methods use world coordinates as arguments. The board design is
* defined in world space units for drawing purposes these are transformed to screen units with * defined in world space units for drawing purposes these are transformed to screen units with
* this layer. So zooming is handled here as well. * this layer. So zooming is handled here as well.
@ -69,16 +69,16 @@ public:
GAL( GAL_DISPLAY_OPTIONS& aOptions ); GAL( GAL_DISPLAY_OPTIONS& aOptions );
virtual ~GAL(); virtual ~GAL();
/// Returns the initialization status for the canvas. /// Return the initialization status for the canvas.
virtual bool IsInitialized() const { return true; } virtual bool IsInitialized() const { return true; }
/// Returns true if the GAL canvas is visible on the screen. /// Return true if the GAL canvas is visible on the screen.
virtual bool IsVisible() const { return true; } virtual bool IsVisible() const { return true; }
/// Returns true if the GAL engine is a cairo based type. /// Return true if the GAL engine is a Cairo based type.
virtual bool IsCairoEngine() { return false; } virtual bool IsCairoEngine() { return false; }
/// Returns true if the GAL engine is a OpenGL based type. /// Return true if the GAL engine is a OpenGL based type.
virtual bool IsOpenGlEngine() { return false; } virtual bool IsOpenGlEngine() { return false; }
// --------------- // ---------------
@ -198,13 +198,13 @@ public:
// Screen methods // Screen methods
// -------------- // --------------
/// Resizes the canvas. /// Resize the canvas.
virtual void ResizeScreen( int aWidth, int aHeight ) {}; virtual void ResizeScreen( int aWidth, int aHeight ) {};
/// Shows/hides the GAL canvas /// Show/hide the GAL canvas
virtual bool Show( bool aShow ) { return true; }; virtual bool Show( bool aShow ) { return true; };
/// Returns GAL canvas size in pixels /// Return GAL canvas size in pixels
const VECTOR2I& GetScreenPixelSize() const const VECTOR2I& GetScreenPixelSize() const
{ {
return screenSize; return screenSize;
@ -337,7 +337,7 @@ public:
} }
/** /**
* Draws a vector type text using preloaded Newstroke font. * Draw a vector type text using preloaded Newstroke font.
* *
* @param aText is the text to be drawn. * @param aText is the text to be drawn.
* @param aPosition is the text position in world coordinates. * @param aPosition is the text position in world coordinates.
@ -350,7 +350,7 @@ public:
} }
/** /**
* Draws a text using a bitmap font. It should be faster than StrokeText(), * Draw a text using a bitmap font. It should be faster than StrokeText(),
* but can be used only for non-Gerber elements. * but can be used only for non-Gerber elements.
* *
* @param aText is the text to be drawn. * @param aText is the text to be drawn.
@ -373,8 +373,7 @@ public:
} }
/** /**
* Compute the X and Y size of a given text. The text is expected to be * Compute the X and Y size of a given text. The text is expected to be a only one line text.
* a only one line text.
* *
* @param aText is the text string (one line). * @param aText is the text string (one line).
* @return is the text size. * @return is the text size.
@ -389,7 +388,7 @@ public:
virtual void SetTextAttributes( const EDA_TEXT* aText ); virtual void SetTextAttributes( const EDA_TEXT* aText );
/** /**
* Reset text attributes to default styling * Reset text attributes to default styling.
* *
* Normally, custom attributes will be set individually after this, * Normally, custom attributes will be set individually after this,
* otherwise you can use SetTextAttributes() * otherwise you can use SetTextAttributes()
@ -442,7 +441,7 @@ public:
} }
/** /**
* Returns current text horizontal justification setting. * Return current text horizontal justification setting.
*/ */
inline EDA_TEXT_HJUSTIFY_T GetHorizontalJustify() const inline EDA_TEXT_HJUSTIFY_T GetHorizontalJustify() const
{ {
@ -531,7 +530,7 @@ public:
virtual void DrawGroup( int aGroupNumber ) {}; virtual void DrawGroup( int aGroupNumber ) {};
/** /**
* Changes the color used to draw the group. * Change the color used to draw the group.
* *
* @param aGroupNumber is the group number. * @param aGroupNumber is the group number.
* @param aNewColor is the new color. * @param aNewColor is the new color.
@ -539,7 +538,7 @@ public:
virtual void ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor ) {}; virtual void ChangeGroupColor( int aGroupNumber, const COLOR4D& aNewColor ) {};
/** /**
* Changes the depth (Z-axis position) of the group. * Change the depth (Z-axis position) of the group.
* *
* @param aGroupNumber is the group number. * @param aGroupNumber is the group number.
* @param aDepth is the new depth. * @param aDepth is the new depth.
@ -703,7 +702,7 @@ public:
} }
/** /**
* Returns the minimum depth in the currently used range (the top). * Return the minimum depth in the currently used range (the top).
*/ */
inline double GetMinDepth() const inline double GetMinDepth() const
{ {
@ -711,7 +710,7 @@ public:
} }
/** /**
* Returns the maximum depth in the currently used range (the bottom). * Return the maximum depth in the currently used range (the bottom).
*/ */
inline double GetMaxDepth() const inline double GetMaxDepth() const
{ {
@ -761,28 +760,28 @@ public:
// --------------------------- // ---------------------------
/** /**
* Sets the target for rendering. * Set the target for rendering.
* *
* @param aTarget is the new target for rendering. * @param aTarget is the new target for rendering.
*/ */
virtual void SetTarget( RENDER_TARGET aTarget ) {}; virtual void SetTarget( RENDER_TARGET aTarget ) {};
/** /**
* Gets the currently used target for rendering. * Get the currently used target for rendering.
* *
* @return The current rendering target. * @return The current rendering target.
*/ */
virtual RENDER_TARGET GetTarget() const { return TARGET_CACHED; }; virtual RENDER_TARGET GetTarget() const { return TARGET_CACHED; };
/** /**
* Clears the target for rendering. * Clear the target for rendering.
* *
* @param aTarget is the target to be cleared. * @param aTarget is the target to be cleared.
*/ */
virtual void ClearTarget( RENDER_TARGET aTarget ) {}; virtual void ClearTarget( RENDER_TARGET aTarget ) {};
/** /**
* Returns true if the target exists. * Return true if the target exists.
* *
* @param aTarget is the target to be checked. * @param aTarget is the target to be checked.
*/ */
@ -792,7 +791,7 @@ public:
}; };
/** /**
* Sets negative draw mode in the renderer * Set negative draw mode in the renderer.
* *
* When negative mode is enabled, drawn items will subtract from * When negative mode is enabled, drawn items will subtract from
* previously drawn items. This is mainly needed for Gerber * previously drawn items. This is mainly needed for Gerber
@ -809,7 +808,7 @@ public:
// ------------- // -------------
/** /**
* Sets the visibility setting of the grid. * Set the visibility setting of the grid.
* *
* @param aVisibility is the new visibility setting of the grid. * @param aVisibility is the new visibility setting of the grid.
*/ */
@ -861,7 +860,7 @@ public:
} }
/** /**
* Returns the grid size. * Return the grid size.
* *
* @return A vector containing the grid size in x and y direction. * @return A vector containing the grid size in x and y direction.
*/ */
@ -891,7 +890,7 @@ public:
} }
/** /**
* Enables drawing the axes. * Enable drawing the axes.
*/ */
inline void SetAxesEnabled( bool aAxesEnabled ) inline void SetAxesEnabled( bool aAxesEnabled )
{ {
@ -918,7 +917,7 @@ public:
return gridLineWidth; return gridLineWidth;
} }
///> Draw the grid ///< Draw the grid
virtual void DrawGrid() {}; virtual void DrawGrid() {};
/** /**
@ -962,7 +961,7 @@ public:
} }
/** /**
* Returns information about cursor visibility. * Return information about cursor visibility.
* *
* @return True if cursor is visible. * @return True if cursor is visible.
*/ */
@ -989,7 +988,7 @@ public:
virtual void DrawCursor( const VECTOR2D& aCursorPosition ) {}; virtual void DrawCursor( const VECTOR2D& aCursorPosition ) {};
/** /**
* Changes the current depth to deeper, so it is possible to draw objects right beneath * Change the current depth to deeper, so it is possible to draw objects right beneath
* other. * other.
*/ */
inline void AdvanceDepth() inline void AdvanceDepth()
@ -998,7 +997,7 @@ public:
} }
/** /**
* Stores current drawing depth on the depth stack. * Store current drawing depth on the depth stack.
*/ */
inline void PushDepth() inline void PushDepth()
{ {
@ -1006,7 +1005,7 @@ public:
} }
/** /**
* Restores previously stored drawing depth for the depth stack. * Restore previously stored drawing depth for the depth stack.
*/ */
inline void PopDepth() inline void PopDepth()
{ {
@ -1026,16 +1025,16 @@ public:
} }
protected: protected:
/// Private: use GAL_CONTEXT_LOCKER RAII object /// Use GAL_CONTEXT_LOCKER RAII object
virtual void lockContext( int aClientCookie ) {} virtual void lockContext( int aClientCookie ) {}
virtual void unlockContext( int aClientCookie ) {} virtual void unlockContext( int aClientCookie ) {}
/// Enables item update mode. /// Enable item update mode.
/// Private: use GAL_UPDATE_CONTEXT RAII object /// Private: use GAL_UPDATE_CONTEXT RAII object
virtual void beginUpdate() {} virtual void beginUpdate() {}
/// Disables item update mode. /// Disable item update mode.
virtual void endUpdate() {} virtual void endUpdate() {}
/// Begin the drawing, needs to be called for every new frame. /// Begin the drawing, needs to be called for every new frame.
@ -1067,7 +1066,7 @@ protected:
static const int GRID_DEPTH; static const int GRID_DEPTH;
/** /**
* Gets the actual cursor color to draw * Get the actual cursor color to draw
*/ */
COLOR4D getCursorColor() const; COLOR4D getCursorColor() const;
@ -1075,7 +1074,7 @@ protected:
// Settings observer interface // Settings observer interface
// --------------- // ---------------
/** /**
* Handler for observer settings changes * Handler for observer settings changes.
*/ */
void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& aOptions ) override; void OnGalDisplayOptionsChanged( const GAL_DISPLAY_OPTIONS& aOptions ) override;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright 2013-2017 CERN * Copyright 2013-2017 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -54,19 +54,19 @@ public:
return true; return true;
} }
///> @copydoc VERTEX_CONTAINER::SetItem() ///< @copydoc VERTEX_CONTAINER::SetItem()
virtual void SetItem( VERTEX_ITEM* aItem ) override; virtual void SetItem( VERTEX_ITEM* aItem ) override;
///> @copydoc VERTEX_CONTAINER::FinishItem() ///< @copydoc VERTEX_CONTAINER::FinishItem()
virtual void FinishItem() override; virtual void FinishItem() override;
///> @copydoc VERTEX_CONTAINER::Allocate() ///< @copydoc VERTEX_CONTAINER::Allocate()
virtual VERTEX* Allocate( unsigned int aSize ) override; virtual VERTEX* Allocate( unsigned int aSize ) override;
///> @copydoc VERTEX_CONTAINER::Delete() ///< @copydoc VERTEX_CONTAINER::Delete()
virtual void Delete( VERTEX_ITEM* aItem ) override; virtual void Delete( VERTEX_ITEM* aItem ) override;
///> @copydoc VERTEX_CONTAINER::Clear() ///< @copydoc VERTEX_CONTAINER::Clear()
virtual void Clear() override; virtual void Clear() override;
/** /**
@ -79,14 +79,14 @@ public:
*/ */
virtual bool IsMapped() const = 0; virtual bool IsMapped() const = 0;
///> @copydoc VERTEX_CONTAINER::Map() ///< @copydoc VERTEX_CONTAINER::Map()
virtual void Map() override = 0; virtual void Map() override = 0;
///> @copydoc VERTEX_CONTAINER::Unmap() ///< @copydoc VERTEX_CONTAINER::Unmap()
virtual void Unmap() override = 0; virtual void Unmap() override = 0;
protected: protected:
///> Maps size of free memory chunks to their offsets ///< Maps size of free memory chunks to their offsets
typedef std::pair<unsigned int, unsigned int> CHUNK; typedef std::pair<unsigned int, unsigned int> CHUNK;
typedef std::multimap<unsigned int, unsigned int> FREE_CHUNK_MAP; typedef std::multimap<unsigned int, unsigned int> FREE_CHUNK_MAP;
@ -153,20 +153,20 @@ protected:
*/ */
void addFreeChunk( unsigned int aOffset, unsigned int aSize ); void addFreeChunk( unsigned int aOffset, unsigned int aSize );
///> Store size & offset of free chunks. ///< Store size & offset of free chunks.
FREE_CHUNK_MAP m_freeChunks; FREE_CHUNK_MAP m_freeChunks;
///> Stored VERTEX_ITEMs ///< Stored VERTEX_ITEMs
ITEMS m_items; ITEMS m_items;
///> Currently modified item ///< Currently modified item
VERTEX_ITEM* m_item; VERTEX_ITEM* m_item;
///> Properties of currently modified chunk & item ///< Properties of currently modified chunk & item
unsigned int m_chunkSize; unsigned int m_chunkSize;
unsigned int m_chunkOffset; unsigned int m_chunkOffset;
///> Maximal vertex index number stored in the container ///< Maximal vertex index number stored in the container
unsigned int m_maxIndex; unsigned int m_maxIndex;
private: private:

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright 2013-2017 CERN * Copyright 2013-2017 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -35,7 +35,6 @@ namespace KIGFX
/** /**
* Specialization of CACHED_CONTAINER that stores data in video memory via memory mapping. * Specialization of CACHED_CONTAINER that stores data in video memory via memory mapping.
*/ */
class CACHED_CONTAINER_GPU : public CACHED_CONTAINER class CACHED_CONTAINER_GPU : public CACHED_CONTAINER
{ {
public: public:
@ -52,10 +51,10 @@ public:
return m_isMapped; return m_isMapped;
} }
///> @copydoc VERTEX_CONTAINER::Map() ///< @copydoc VERTEX_CONTAINER::Map()
void Map() override; void Map() override;
///> @copydoc VERTEX_CONTAINER::Unmap() ///< @copydoc VERTEX_CONTAINER::Unmap()
void Unmap() override; void Unmap() override;
protected: protected:
@ -71,13 +70,13 @@ protected:
bool defragmentResize( unsigned int aNewSize ) override; bool defragmentResize( unsigned int aNewSize ) override;
bool defragmentResizeMemcpy( unsigned int aNewSize ); bool defragmentResizeMemcpy( unsigned int aNewSize );
///> Flag saying if vertex buffer is currently mapped ///< Flag saying if vertex buffer is currently mapped
bool m_isMapped; bool m_isMapped;
///> Vertex buffer handle ///< Vertex buffer handle
unsigned int m_glBufferHandle; unsigned int m_glBufferHandle;
///> Flag saying whether it is safe to use glCopyBufferSubData ///< Flag saying whether it is safe to use glCopyBufferSubData
bool m_useCopyBuffer; bool m_useCopyBuffer;
}; };
} // namespace KIGFX } // namespace KIGFX

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright 2013-2017 CERN * Copyright 2013-2017 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -48,10 +48,10 @@ public:
CACHED_CONTAINER_RAM( unsigned int aSize = DEFAULT_SIZE ); CACHED_CONTAINER_RAM( unsigned int aSize = DEFAULT_SIZE );
~CACHED_CONTAINER_RAM(); ~CACHED_CONTAINER_RAM();
///> @copydoc VERTEX_CONTAINER::Unmap() ///< @copydoc VERTEX_CONTAINER::Unmap()
void Map() override {} void Map() override {}
///> @copydoc VERTEX_CONTAINER::Unmap() ///< @copydoc VERTEX_CONTAINER::Unmap()
void Unmap() override; void Unmap() override;
bool IsMapped() const override bool IsMapped() const override
@ -78,7 +78,7 @@ protected:
*/ */
bool defragmentResize( unsigned int aNewSize ) override; bool defragmentResize( unsigned int aNewSize ) override;
///> Handle to vertices buffer ///< Handle to vertices buffer
GLuint m_verticesBuffer; GLuint m_verticesBuffer;
}; };
} // namespace KIGFX } // namespace KIGFX

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -66,7 +66,7 @@ public:
virtual void DrawAll() = 0; virtual void DrawAll() = 0;
/** /**
* Clears the container after drawing routines. * Clear the container after drawing routines.
*/ */
virtual void EndDrawing() = 0; virtual void EndDrawing() = 0;
@ -85,19 +85,19 @@ public:
protected: protected:
GPU_MANAGER( VERTEX_CONTAINER* aContainer ); GPU_MANAGER( VERTEX_CONTAINER* aContainer );
///> Drawing status flag. ///< Drawing status flag.
bool m_isDrawing; bool m_isDrawing;
///> Container that stores vertices data. ///< Container that stores vertices data.
VERTEX_CONTAINER* m_container; VERTEX_CONTAINER* m_container;
///> Shader handling ///< Shader handling
SHADER* m_shader; SHADER* m_shader;
///> Location of shader attributes (for glVertexAttribPointer) ///< Location of shader attributes (for glVertexAttribPointer)
int m_shaderAttrib; int m_shaderAttrib;
///> true: enable Z test when drawing ///< true: enable Z test when drawing
bool m_enableDepthTest; bool m_enableDepthTest;
}; };
@ -108,44 +108,44 @@ public:
GPU_CACHED_MANAGER( VERTEX_CONTAINER* aContainer ); GPU_CACHED_MANAGER( VERTEX_CONTAINER* aContainer );
~GPU_CACHED_MANAGER(); ~GPU_CACHED_MANAGER();
///> @copydoc GPU_MANAGER::BeginDrawing() ///< @copydoc GPU_MANAGER::BeginDrawing()
virtual void BeginDrawing() override; virtual void BeginDrawing() override;
///> @copydoc GPU_MANAGER::DrawIndices() ///< @copydoc GPU_MANAGER::DrawIndices()
virtual void DrawIndices( unsigned int aOffset, unsigned int aSize ) override; virtual void DrawIndices( unsigned int aOffset, unsigned int aSize ) override;
///> @copydoc GPU_MANAGER::DrawAll() ///< @copydoc GPU_MANAGER::DrawAll()
virtual void DrawAll() override; virtual void DrawAll() override;
///> @copydoc GPU_MANAGER::EndDrawing() ///< @copydoc GPU_MANAGER::EndDrawing()
virtual void EndDrawing() override; virtual void EndDrawing() override;
///> Maps vertex buffer stored in GPU memory. ///< Map vertex buffer stored in GPU memory.
void Map(); void Map();
///> Unmaps vertex buffer. ///< Unmap vertex buffer.
void Unmap(); void Unmap();
protected: protected:
///> Resizes the indices buffer to aNewSize if necessary ///< Resizes the indices buffer to aNewSize if necessary
void resizeIndices( unsigned int aNewSize ); void resizeIndices( unsigned int aNewSize );
///> Buffers initialization flag ///< Buffers initialization flag
bool m_buffersInitialized; bool m_buffersInitialized;
///> Pointer to the current indices buffer ///< Pointer to the current indices buffer
boost::scoped_array<GLuint> m_indices; boost::scoped_array<GLuint> m_indices;
///> Pointer to the first free cell in the indices buffer ///< Pointer to the first free cell in the indices buffer
GLuint* m_indicesPtr; GLuint* m_indicesPtr;
///> Handle to indices buffer ///< Handle to indices buffer
GLuint m_indicesBuffer; GLuint m_indicesBuffer;
///> Number of indices stored in the indices buffer ///< Number of indices stored in the indices buffer
unsigned int m_indicesSize; unsigned int m_indicesSize;
///> Current indices buffer size ///< Current indices buffer size
unsigned int m_indicesCapacity; unsigned int m_indicesCapacity;
}; };
@ -155,16 +155,16 @@ class GPU_NONCACHED_MANAGER : public GPU_MANAGER
public: public:
GPU_NONCACHED_MANAGER( VERTEX_CONTAINER* aContainer ); GPU_NONCACHED_MANAGER( VERTEX_CONTAINER* aContainer );
///> @copydoc GPU_MANAGER::BeginDrawing() ///< @copydoc GPU_MANAGER::BeginDrawing()
virtual void BeginDrawing() override; virtual void BeginDrawing() override;
///> @copydoc GPU_MANAGER::DrawIndices() ///< @copydoc GPU_MANAGER::DrawIndices()
virtual void DrawIndices( unsigned int aOffset, unsigned int aSize ) override; virtual void DrawIndices( unsigned int aOffset, unsigned int aSize ) override;
///> @copydoc GPU_MANAGER::DrawAll() ///< @copydoc GPU_MANAGER::DrawAll()
virtual void DrawAll() override; virtual void DrawAll() override;
///> @copydoc GPU_MANAGER::EndDrawing() ///< @copydoc GPU_MANAGER::EndDrawing()
virtual void EndDrawing() override; virtual void EndDrawing() override;
}; };
} // namespace KIGFX } // namespace KIGFX

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de * Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2020 Kicad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2013-2017 CERN * Copyright (C) 2013-2017 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -56,7 +56,7 @@ class SHADER;
class GL_BITMAP_CACHE; class GL_BITMAP_CACHE;
/** /**
* @brief Class OpenGL_GAL is the OpenGL implementation of the Graphics Abstraction Layer. * OpenGL implementation of the Graphics Abstraction Layer.
* *
* This is a direct OpenGL-implementation and uses low-level graphics primitives like triangles * This is a direct OpenGL-implementation and uses low-level graphics primitives like triangles
* and quads. The purpose is to provide a fast graphics interface, that takes advantage of modern * and quads. The purpose is to provide a fast graphics interface, that takes advantage of modern
@ -66,8 +66,6 @@ class OPENGL_GAL : public GAL, public HIDPI_GL_CANVAS
{ {
public: public:
/** /**
* @brief Constructor OPENGL_GAL
*
* @param aParent is the wxWidgets immediate wxWindow parent of this object. * @param aParent is the wxWidgets immediate wxWindow parent of this object.
* *
* @param aMouseListener is the wxEvtHandler that should receive the mouse events, * @param aMouseListener is the wxEvtHandler that should receive the mouse events,
@ -87,7 +85,8 @@ public:
~OPENGL_GAL(); ~OPENGL_GAL();
/** /**
* @brief Checks OpenGL features * Checks OpenGL features.
*
* @param aOptions * @param aOptions
* @return wxEmptyString if OpenGL 2.1 or greater is available, otherwise returns error message * @return wxEmptyString if OpenGL 2.1 or greater is available, otherwise returns error message
*/ */
@ -102,7 +101,7 @@ public:
return IsShownOnScreen() && !GetClientRect().IsEmpty(); return IsShownOnScreen() && !GetClientRect().IsEmpty();
} }
///> @copydoc GAL::IsVisible() ///< @copydoc GAL::IsVisible()
bool IsVisible() const override bool IsVisible() const override
{ {
return IsShownOnScreen() && !GetClientRect().IsEmpty(); return IsShownOnScreen() && !GetClientRect().IsEmpty();
@ -302,30 +301,32 @@ private:
// Vertex buffer objects related fields // Vertex buffer objects related fields
typedef std::unordered_map< unsigned int, std::shared_ptr<VERTEX_ITEM> > GROUPS_MAP; typedef std::unordered_map< unsigned int, std::shared_ptr<VERTEX_ITEM> > GROUPS_MAP;
GROUPS_MAP groups; ///< Stores informations about VBO objects (groups) GROUPS_MAP groups; ///< Stores information about VBO objects (groups)
unsigned int groupCounter; ///< Counter used for generating keys for groups unsigned int groupCounter; ///< Counter used for generating keys for groups
VERTEX_MANAGER* currentManager; ///< Currently used VERTEX_MANAGER (for storing VERTEX_ITEMs) VERTEX_MANAGER* currentManager; ///< Currently used VERTEX_MANAGER (for storing
VERTEX_MANAGER* cachedManager; ///< Container for storing cached VERTEX_ITEMs ///< VERTEX_ITEMs).
VERTEX_MANAGER* nonCachedManager; ///< Container for storing non-cached VERTEX_ITEMs VERTEX_MANAGER* cachedManager; ///< Container for storing cached VERTEX_ITEMs
VERTEX_MANAGER* overlayManager; ///< Container for storing overlaid VERTEX_ITEMs VERTEX_MANAGER* nonCachedManager; ///< Container for storing non-cached VERTEX_ITEMs
VERTEX_MANAGER* overlayManager; ///< Container for storing overlaid VERTEX_ITEMs
// Framebuffer & compositing // Framebuffer & compositing
OPENGL_COMPOSITOR* compositor; ///< Handles multiple rendering targets OPENGL_COMPOSITOR* compositor; ///< Handles multiple rendering targets
unsigned int mainBuffer; ///< Main rendering target unsigned int mainBuffer; ///< Main rendering target
unsigned int overlayBuffer; ///< Auxiliary rendering target (for menus etc.) unsigned int overlayBuffer; ///< Auxiliary rendering target (for menus etc.)
RENDER_TARGET currentTarget; ///< Current rendering target RENDER_TARGET currentTarget; ///< Current rendering target
// Shader // Shader
SHADER* shader; ///< There is only one shader used for different objects SHADER* shader; ///< There is only one shader used for different
///< objects.
// Internal flags // Internal flags
bool isFramebufferInitialized; ///< Are the framebuffers initialized? bool isFramebufferInitialized; ///< Are the framebuffers initialized?
static bool isBitmapFontLoaded; ///< Is the bitmap font texture loaded? static bool isBitmapFontLoaded; ///< Is the bitmap font texture loaded?
bool isBitmapFontInitialized; ///< Is the shader set to use bitmap fonts? bool isBitmapFontInitialized; ///< Is the shader set to use bitmap fonts?
bool isInitialized; ///< Basic initialization flag, has to be done bool isInitialized; ///< Basic initialization flag, has to be done
///< when the window is visible ///< when the window is visible
bool isGrouping; ///< Was a group started? bool isGrouping; ///< Was a group started?
bool m_isContextLocked; ///< Used for assertion checking bool m_isContextLocked; ///< Used for assertion checking
int lockClientCookie; int lockClientCookie;
GLint ufm_worldPixelSize; GLint ufm_worldPixelSize;
GLint ufm_screenPixelSize; GLint ufm_screenPixelSize;
@ -367,8 +368,10 @@ private:
void drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ); void drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
/** /**
* @brief Draw a semicircle. Depending on settings (isStrokeEnabled & isFilledEnabled) it runs * Draw a semicircle.
* the proper function (drawStrokedSemiCircle or drawFilledSemiCircle). *
* Depending on settings (isStrokeEnabled & isFilledEnabled) it runs the proper function
* (drawStrokedSemiCircle or drawFilledSemiCircle).
* *
* @param aCenterPoint is the center point. * @param aCenterPoint is the center point.
* @param aRadius is the radius of the semicircle. * @param aRadius is the radius of the semicircle.
@ -378,7 +381,7 @@ private:
void drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); void drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle );
/** /**
* @brief Draw a filled semicircle. *Draw a filled semicircle.
* *
* @param aCenterPoint is the center point. * @param aCenterPoint is the center point.
* @param aRadius is the radius of the semicircle. * @param aRadius is the radius of the semicircle.
@ -388,7 +391,7 @@ private:
void drawFilledSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); void drawFilledSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle );
/** /**
* @brief Draw a stroked semicircle. * Draw a stroked semicircle.
* *
* @param aCenterPoint is the center point. * @param aCenterPoint is the center point.
* @param aRadius is the radius of the semicircle. * @param aRadius is the radius of the semicircle.
@ -398,28 +401,31 @@ private:
void drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ); void drawStrokedSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle );
/** /**
* @brief Generic way of drawing a polyline stored in different containers. * Generic way of drawing a polyline stored in different containers.
*
* @param aPointGetter is a function to obtain coordinates of n-th vertex. * @param aPointGetter is a function to obtain coordinates of n-th vertex.
* @param aPointCount is the number of points to be drawn. * @param aPointCount is the number of points to be drawn.
*/ */
void drawPolyline( const std::function<VECTOR2D (int)>& aPointGetter, int aPointCount ); void drawPolyline( const std::function<VECTOR2D (int)>& aPointGetter, int aPointCount );
/** /**
* @brief Draws a filled polygon. It does not need the last point to have the same coordinates * Draw a filled polygon. It does not need the last point to have the same coordinates
* as the first one. * as the first one.
*
* @param aPoints is the vertices data (3 coordinates: x, y, z). * @param aPoints is the vertices data (3 coordinates: x, y, z).
* @param aPointCount is the number of points. * @param aPointCount is the number of points.
*/ */
void drawPolygon( GLdouble* aPoints, int aPointCount ); void drawPolygon( GLdouble* aPoints, int aPointCount );
/** /**
* @brief Draws a set of polygons with a cached triangulation. Way faster than drawPolygon. * Draw a set of polygons with a cached triangulation. Way faster than drawPolygon.
*/ */
void drawTriangulatedPolyset( const SHAPE_POLY_SET& aPoly ); void drawTriangulatedPolyset( const SHAPE_POLY_SET& aPoly );
/** /**
* @brief Draws a single character using bitmap font. * Draw a single character using bitmap font.
*
* Its main purpose is to be used in BitmapText() function. * Its main purpose is to be used in BitmapText() function.
* *
* @param aChar is the character to be drawn. * @param aChar is the character to be drawn.
@ -428,7 +434,8 @@ private:
int drawBitmapChar( unsigned long aChar ); int drawBitmapChar( unsigned long aChar );
/** /**
* @brief Draws an overbar over the currently drawn text. * Draw an overbar over the currently drawn text.
*
* Its main purpose is to be used in BitmapText() function. * Its main purpose is to be used in BitmapText() function.
* This method requires appropriate scaling to be applied (as is done in BitmapText() function). * This method requires appropriate scaling to be applied (as is done in BitmapText() function).
* The current X coordinate will be the overbar ending. * The current X coordinate will be the overbar ending.
@ -439,7 +446,7 @@ private:
void drawBitmapOverbar( double aLength, double aHeight ); void drawBitmapOverbar( double aLength, double aHeight );
/** /**
* @brief Computes a size of text drawn using bitmap font with current text setting applied. * Compute a size of text drawn using bitmap font with current text setting applied.
* *
* @param aText is the text to be drawn. * @param aText is the text to be drawn.
* @return Pair containing text bounding box and common Y axis offset. The values are expressed * @return Pair containing text bounding box and common Y axis offset. The values are expressed
@ -449,33 +456,33 @@ private:
// Event handling // Event handling
/** /**
* @brief This is the OnPaint event handler. * This is the OnPaint event handler.
* *
* @param aEvent is the OnPaint event. * @param aEvent is the OnPaint event.
*/ */
void onPaint( wxPaintEvent& aEvent ); void onPaint( wxPaintEvent& aEvent );
/** /**
* @brief Skip the mouse event to the parent. * Skip the mouse event to the parent.
* *
* @param aEvent is the mouse event. * @param aEvent is the mouse event.
*/ */
void skipMouseEvent( wxMouseEvent& aEvent ); void skipMouseEvent( wxMouseEvent& aEvent );
/** /**
* @brief Blits cursor into the current screen. * Blit cursor into the current screen.
*/ */
void blitCursor(); void blitCursor();
/** /**
* @brief Returns a valid key that can be used as a new group number. * Return a valid key that can be used as a new group number.
* *
* @return An unique group number that is not used by any other group. * @return An unique group number that is not used by any other group.
*/ */
unsigned int getNewGroupNumber(); unsigned int getNewGroupNumber();
/** /**
* @brief Compute the angle step when drawing arcs/circles approximated with lines. * Compute the angle step when drawing arcs/circles approximated with lines.
*/ */
double calcAngleStep( double aRadius ) const double calcAngleStep( double aRadius ) const
{ {
@ -488,7 +495,8 @@ private:
VECTOR2D getScreenPixelSize() const; VECTOR2D getScreenPixelSize() const;
/** /**
* @brief Basic OpenGL initialization and feature checks * Basic OpenGL initialization and feature checks.
*
* @throw std::runtime_error if any of the OpenGL feature checks failed * @throw std::runtime_error if any of the OpenGL feature checks failed
*/ */
void init(); void init();

View File

@ -2,6 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -38,7 +40,8 @@
namespace KIGFX namespace KIGFX
{ {
///> Possible types of shaders (keep consistent with the actual shader source in gl_builtin_shaders.cpp) ///< Possible types of shaders (keep consistent with the actual shader source in
///< gl_builtin_shaders.cpp).
enum SHADER_MODE enum SHADER_MODE
{ {
SHADER_NONE = 0, SHADER_NONE = 0,
@ -53,7 +56,7 @@ enum SHADER_MODE
SHADER_LINE_F = 10 SHADER_LINE_F = 10
}; };
///> Data structure for vertices {X,Y,Z,R,G,B,A,shader&param} ///< Data structure for vertices {X,Y,Z,R,G,B,A,shader&param}
struct VERTEX struct VERTEX
{ {
GLfloat x, y, z; // Coordinates GLfloat x, y, z; // Coordinates

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright 2013-2017 CERN * Copyright 2013-2017 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -167,16 +167,16 @@ protected:
return m_currentSize - m_freeSpace; return m_currentSize - m_freeSpace;
} }
///> Free space left in the container, expressed in vertices ///< Free space left in the container, expressed in vertices
unsigned int m_freeSpace; unsigned int m_freeSpace;
///> Current container size, expressed in vertices ///< Current container size, expressed in vertices
unsigned int m_currentSize; unsigned int m_currentSize;
///> Store the initial size, so it can be resized to this on Clear() ///< Store the initial size, so it can be resized to this on Clear()
unsigned int m_initialSize; unsigned int m_initialSize;
///> Actual storage memory ///< Actual storage memory
VERTEX* m_vertices; VERTEX* m_vertices;
// Status flags // Status flags

View File

@ -3,8 +3,9 @@
* *
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de * Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* Copyright (C) 2016-2020 Kicad Developers, see AUTHORS.txt for contributors.
* *
* Stroke font class * Stroke font class
* *
@ -46,7 +47,7 @@ typedef std::vector<std::vector<VECTOR2D>*> GLYPH;
typedef std::vector<GLYPH*> GLYPH_LIST; typedef std::vector<GLYPH*> GLYPH_LIST;
/** /**
* Class STROKE_FONT implements stroke font drawing. * Implement a stroke font drawing.
* *
* A stroke font is composed of lines. * A stroke font is composed of lines.
*/ */
@ -142,7 +143,7 @@ private:
BOX2D computeBoundingBox( const GLYPH* aGlyph, double aGlyphWidth ) const; BOX2D computeBoundingBox( const GLYPH* aGlyph, double aGlyphWidth ) const;
/** /**
* Draws a single line of text. Multiline texts should be split before using the * Draw a single line of text. Multiline texts should be split before using the
* function. * function.
* *
* @param aText is the text to be drawn. * @param aText is the text to be drawn.
@ -168,21 +169,21 @@ private:
const GLYPH_LIST* m_glyphs; ///< Glyph list const GLYPH_LIST* m_glyphs; ///< Glyph list
const std::vector<BOX2D>* m_glyphBoundingBoxes; ///< Bounding boxes of the glyphs const std::vector<BOX2D>* m_glyphBoundingBoxes; ///< Bounding boxes of the glyphs
///> Factor that determines relative vertical position of the overbar. ///< Factor that determines relative vertical position of the overbar.
static const double OVERBAR_POSITION_FACTOR; static const double OVERBAR_POSITION_FACTOR;
static const double UNDERLINE_POSITION_FACTOR; static const double UNDERLINE_POSITION_FACTOR;
///> Factor that determines relative line width for bold text. ///< Factor that determines relative line width for bold text.
static const double BOLD_FACTOR; static const double BOLD_FACTOR;
///> Scale factor for a glyph ///< Scale factor for a glyph
static const double STROKE_FONT_SCALE; static const double STROKE_FONT_SCALE;
///> Tilt factor for italic style (the is is the scaling factor ///< Tilt factor for italic style (the is is the scaling factor
///> on dY relative coordinates to give a tilst shape ///< on dY relative coordinates to give a tilt shape
static const double ITALIC_TILT; static const double ITALIC_TILT;
///> Factor that determines the pitch between 2 lines. ///< Factor that determines the pitch between 2 lines.
static const double INTERLINE_PITCH_RATIO; static const double INTERLINE_PITCH_RATIO;
}; };
} // namespace KIGFX } // namespace KIGFX

View File

@ -2,7 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 CERN * Copyright (C) 2016 CERN
* Copyright (C) 2020 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -85,13 +86,13 @@ public:
void UnlockCtx( wxGLContext* aContext ); void UnlockCtx( wxGLContext* aContext );
private: private:
///> Map of GL contexts & their parent canvases. ///< Map of GL contexts & their parent canvases.
std::map<wxGLContext*, wxGLCanvas*> m_glContexts; std::map<wxGLContext*, wxGLCanvas*> m_glContexts;
///> Currently bound GL context. ///< Currently bound GL context.
wxGLContext* m_glCtx; wxGLContext* m_glCtx;
///> Lock to prevent unexpected GL context switching. ///< Lock to prevent unexpected GL context switching.
std::mutex m_glCtxMutex; std::mutex m_glCtxMutex;
// Singleton // Singleton

View File

@ -2,7 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 CERN * Copyright (C) 2017 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -25,6 +26,7 @@
#ifndef HASH_EDA_H_ #ifndef HASH_EDA_H_
#define HASH_EDA_H_ #define HASH_EDA_H_
/** /**
* @brief Hashing functions for EDA_ITEMs. * @brief Hashing functions for EDA_ITEMs.
*/ */
@ -34,13 +36,13 @@
class EDA_ITEM; class EDA_ITEM;
///> Enables/disables properties that will be used for calculating the hash. ///< Enables/disables properties that will be used for calculating the hash.
///> The properties might be combined using the bitwise 'or' operator. ///< The properties might be combined using the bitwise 'or' operator.
enum HASH_FLAGS enum HASH_FLAGS
{ {
HASH_POS = 0x01, HASH_POS = 0x01,
///> use coordinates relative to the parent object ///< use coordinates relative to the parent object
REL_COORD = 0x02, REL_COORD = 0x02,
HASH_ROT = 0x04, HASH_ROT = 0x04,
HASH_LAYER = 0x08, HASH_LAYER = 0x08,
@ -51,7 +53,8 @@ enum HASH_FLAGS
}; };
/** /**
* Calculates hash of an EDA_ITEM. * Calculate hash of an EDA_ITEM.
*
* @param aItem is the item for which the hash will be computed. * @param aItem is the item for which the hash will be computed.
* @return Hash value. * @return Hash value.
*/ */
@ -64,7 +67,8 @@ std::size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags = HASH_FLAGS::HASH_A
static inline void hash_combine( std::size_t &seed ) {} static inline void hash_combine( std::size_t &seed ) {}
/** /**
* @brief Combine multiple hashes utilizing previous hash result * Combine multiple hashes utilizing previous hash result.
*
* @tparam T A hashable type * @tparam T A hashable type
* @param seed A seed value input and output for the result. * @param seed A seed value input and output for the result.
* @param val A hashable object of type T * @param val A hashable object of type T

View File

@ -2,6 +2,8 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2017 CERN * Copyright (C) 2017 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -25,7 +27,7 @@
#ifndef INTRUSIVE_LIST_H #ifndef INTRUSIVE_LIST_H
#define INTRUSIVE_LIST_H #define INTRUSIVE_LIST_H
///> A lightweight intrusive list container ///< A lightweight intrusive list container
template <class T> template <class T>
class INTRUSIVE_LIST class INTRUSIVE_LIST
{ {

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright 2017 CERN * Copyright 2017 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* @author Bernhard Stegmaier <stegmaier@sw-systems.de> * @author Bernhard Stegmaier <stegmaier@sw-systems.de>
@ -106,7 +106,6 @@ public:
protected: protected:
/** /**
* Constructor.
* @param aItems is the container to wrap. * @param aItems is the container to wrap.
* @param aIt is the iterator to initialize this iterator (usually some begin() or end() * @param aIt is the iterator to initialize this iterator (usually some begin() or end()
* iterator). * iterator).
@ -121,7 +120,7 @@ public:
m_filter = ( aType != UNDEFINED_TYPE ); m_filter = ( aType != UNDEFINED_TYPE );
} }
///> Assures the iterator is in a valid state. ///< Assures the iterator is in a valid state.
void validate() void validate()
{ {
// for all-items iterators (unfiltered): check if this is the end of the // for all-items iterators (unfiltered): check if this is the end of the
@ -145,25 +144,25 @@ public:
} }
} }
///> Wrapped container ///< Wrapped container
ITEM_CONTAINER* m_parent; ITEM_CONTAINER* m_parent;
///> Iterator for one of the ptr_vector containers stored in the array ///< Iterator for one of the ptr_vector containers stored in the array
ITEM_CONTAINER_IT m_it; ITEM_CONTAINER_IT m_it;
///> Flag indicating whether type filtering is enabled ///< Flag indicating whether type filtering is enabled
bool m_filter; bool m_filter;
///> Type of the currently iterated items ///< Type of the currently iterated items
int m_curType; int m_curType;
friend class MULTIVECTOR; friend class MULTIVECTOR;
}; };
///> The non-const iterator ///< The non-const iterator
typedef ITERATOR_BASE<T, MULTIVECTOR<T, FIRST_TYPE_VAL, LAST_TYPE_VAL>, typedef ITERATOR_BASE<T, MULTIVECTOR<T, FIRST_TYPE_VAL, LAST_TYPE_VAL>,
typename ITEM_PTR_VECTOR::iterator> ITERATOR; typename ITEM_PTR_VECTOR::iterator> ITERATOR;
///> The const iterator ///< The const iterator
typedef ITERATOR_BASE<const T, const MULTIVECTOR<T, FIRST_TYPE_VAL, LAST_TYPE_VAL>, typedef ITERATOR_BASE<const T, const MULTIVECTOR<T, FIRST_TYPE_VAL, LAST_TYPE_VAL>,
typename ITEM_PTR_VECTOR::const_iterator> CONST_ITERATOR; typename ITEM_PTR_VECTOR::const_iterator> CONST_ITERATOR;
@ -295,7 +294,7 @@ public:
static constexpr int TYPES_COUNT = LAST_TYPE - FIRST_TYPE + 1; static constexpr int TYPES_COUNT = LAST_TYPE - FIRST_TYPE + 1;
private: private:
///> Get first non-empty type or first type if all are empty. ///< Get first non-empty type or first type if all are empty.
int first() const int first() const
{ {
int i = 0; int i = 0;
@ -306,7 +305,7 @@ private:
return ( i == TYPES_COUNT ) ? FIRST_TYPE : FIRST_TYPE + i; return ( i == TYPES_COUNT ) ? FIRST_TYPE : FIRST_TYPE + i;
} }
///> Get last non-empty type or first type if all are empty. ///< Get last non-empty type or first type if all are empty.
int last() const int last() const
{ {
int i = TYPES_COUNT - 1; int i = TYPES_COUNT - 1;
@ -317,7 +316,7 @@ private:
return ( i < 0 ) ? FIRST_TYPE : FIRST_TYPE + i; return ( i < 0 ) ? FIRST_TYPE : FIRST_TYPE + i;
} }
///> Contained items by type ///< Contained items by type
ITEM_PTR_VECTOR m_data[TYPES_COUNT]; ITEM_PTR_VECTOR m_data[TYPES_COUNT];
}; };

View File

@ -2,7 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013-2016 CERN * Copyright (C) 2013-2016 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -41,7 +42,7 @@ namespace KIGFX {
class ORIGIN_VIEWITEM : public EDA_ITEM class ORIGIN_VIEWITEM : public EDA_ITEM
{ {
public: public:
///> Marker symbol styles ///< Marker symbol styles
enum MARKER_STYLE enum MARKER_STYLE
{ {
NO_GRAPHIC, CROSS, X, DOT, CIRCLE_CROSS, CIRCLE_X, CIRCLE_DOT, DASH_LINE NO_GRAPHIC, CROSS, X, DOT, CIRCLE_CROSS, CIRCLE_X, CIRCLE_DOT, DASH_LINE
@ -150,22 +151,22 @@ public:
} }
protected: protected:
///> Marker coordinates. ///< Marker coordinates.
VECTOR2D m_position; VECTOR2D m_position;
///> Marker end position for markers that stretch between points ///< Marker end position for markers that stretch between points
VECTOR2D m_end; VECTOR2D m_end;
///> Marker size (in pixels). ///< Marker size (in pixels).
int m_size; int m_size;
///> Marker color. ///< Marker color.
COLOR4D m_color; COLOR4D m_color;
///> Marker symbol. ///< Marker symbol.
MARKER_STYLE m_style; MARKER_STYLE m_style;
///> If set, the marker will be drawn even if its position is 0,0 ///< If set, the marker will be drawn even if its position is 0,0
bool m_drawAtZero; bool m_drawAtZero;
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 Joshua Redstone redstone at gmail.com * Copyright (C) 2020 Joshua Redstone redstone at gmail.com
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -40,7 +40,7 @@ class VIEW;
} }
/** /**
* PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates) * A set of BOARD_ITEMs (i.e., without duplicates).
* *
* The group parent is always board, not logical parent group. The group is transparent * 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 * container - e.g., its position is derived from the position of its members. A selection
@ -76,14 +76,14 @@ public:
} }
/** /**
* Adds item to group. Does not take ownership of item. * Add item to group. Does not take ownership of item.
* *
* @return true if item was added (false if item belongs to a different group). * @return true if item was added (false if item belongs to a different group).
*/ */
bool AddItem( BOARD_ITEM* aItem ); bool AddItem( BOARD_ITEM* aItem );
/** /**
* Removes item from group. * Remove item from group.
* *
* @return true if item was removed (false if item was not in the group). * @return true if item was removed (false if item was not in the group).
*/ */
@ -92,7 +92,7 @@ public:
void RemoveAll(); void RemoveAll();
/* /*
* Searches for highest level group containing item. * Search for highest level group containing item.
* *
* @param aScope restricts the search to groups within the group scope. * @param aScope restricts the search to groups within the group scope.
* @param aFootprintEditor true if we should stop promoting at the footprint level * @param aFootprintEditor true if we should stop promoting at the footprint level
@ -109,22 +109,22 @@ public:
} }
#endif #endif
///> @copydoc EDA_ITEM::GetPosition ///< @copydoc EDA_ITEM::GetPosition
wxPoint GetPosition() const override; wxPoint GetPosition() const override;
///> @copydoc EDA_ITEM::SetPosition ///< @copydoc EDA_ITEM::SetPosition
void SetPosition( const wxPoint& aNewpos ) override; void SetPosition( const wxPoint& aNewpos ) override;
///> @copydoc BOARD_ITEM::GetLayerSet ///< @copydoc BOARD_ITEM::GetLayerSet
LSET GetLayerSet() const override; LSET GetLayerSet() const override;
///> @copydoc BOARD_ITEM::SetLayer ///< @copydoc BOARD_ITEM::SetLayer
void SetLayer( PCB_LAYER_ID aLayer ) override void SetLayer( PCB_LAYER_ID aLayer ) override
{ {
wxFAIL_MSG( "groups don't support layer SetLayer" ); wxFAIL_MSG( "groups don't support layer SetLayer" );
} }
///> @copydoc EDA_ITEM::Clone ///< @copydoc EDA_ITEM::Clone
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
/* /*
@ -137,51 +137,51 @@ public:
*/ */
PCB_GROUP* DeepDuplicate() const; PCB_GROUP* DeepDuplicate() const;
///> @copydoc BOARD_ITEM::SwapData ///< @copydoc BOARD_ITEM::SwapData
void SwapData( BOARD_ITEM* aImage ) override; void SwapData( BOARD_ITEM* aImage ) override;
///> @copydoc BOARD_ITEM::IsOnLayer ///< @copydoc BOARD_ITEM::IsOnLayer
bool IsOnLayer( PCB_LAYER_ID aLayer ) const override; bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
///> @copydoc EDA_ITEM::HitTest ///< @copydoc EDA_ITEM::HitTest
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
///> @copydoc EDA_ITEM::HitTest ///< @copydoc EDA_ITEM::HitTest
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override; bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
///> @copydoc EDA_ITEM::GetBoundingBox ///< @copydoc EDA_ITEM::GetBoundingBox
const EDA_RECT GetBoundingBox() const override; const EDA_RECT GetBoundingBox() const override;
///> @copydoc EDA_ITEM::Visit ///< @copydoc EDA_ITEM::Visit
SEARCH_RESULT Visit( INSPECTOR aInspector, void* aTestData, SEARCH_RESULT Visit( INSPECTOR aInspector, void* aTestData,
const KICAD_T aScanTypes[] ) override; const KICAD_T aScanTypes[] ) override;
///> @copydoc VIEW_ITEM::ViewGetLayers ///< @copydoc VIEW_ITEM::ViewGetLayers
void ViewGetLayers( int aLayers[], int& aCount ) const override; void ViewGetLayers( int aLayers[], int& aCount ) const override;
///> @copydoc VIEW_ITEM::ViewGetLOD ///< @copydoc VIEW_ITEM::ViewGetLOD
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override; double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
///> @copydoc BOARD_ITEM::Move ///< @copydoc BOARD_ITEM::Move
void Move( const wxPoint& aMoveVector ) override; void Move( const wxPoint& aMoveVector ) override;
///> @copydoc BOARD_ITEM::Rotate ///< @copydoc BOARD_ITEM::Rotate
void Rotate( const wxPoint& aRotCentre, double aAngle ) override; void Rotate( const wxPoint& aRotCentre, double aAngle ) override;
///> @copydoc BOARD_ITEM::Flip ///< @copydoc BOARD_ITEM::Flip
void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override; void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
///> @copydoc EDA_ITEM::GetSelectMenuText ///< @copydoc EDA_ITEM::GetSelectMenuText
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
///> @copydoc EDA_ITEM::GetMenuImage ///< @copydoc EDA_ITEM::GetMenuImage
BITMAP_DEF GetMenuImage() const override; BITMAP_DEF GetMenuImage() const override;
///> @copydoc EDA_ITEM::GetMsgPanelInfo ///< @copydoc EDA_ITEM::GetMsgPanelInfo
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override; void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
/** /**
* Invokes a function on all members of the group. * Invoke a function on all members of the group.
* *
* @note This function should not add or remove items to the group. * @note This function should not add or remove items to the group.
* *
@ -190,7 +190,7 @@ public:
void RunOnChildren( const std::function<void ( BOARD_ITEM* )>& aFunction ) const; void RunOnChildren( const std::function<void ( BOARD_ITEM* )>& aFunction ) const;
/** /**
* Invokes a function on all descendants of the group. * Invoke a function on all descendants of the group.
* *
* @note This function should not add or remove items to the group or descendant groups. * @note This function should not add or remove items to the group or descendant groups.
* @param aFunction is the function to be invoked. * @param aFunction is the function to be invoked.

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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-2021 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -31,16 +31,12 @@ namespace PREVIEW {
/** /**
* ARC_GEOM_MANAGER * Manage the construction of a circular arc though sequential setting of critical points:
* * center, arc start and arc end. The manager is driven by setting cursor points, which
* A class to manage the construction of a circular arc though
* sequential setting of critical points: centre, arc start
* and arc end. The manager is driven by setting cursor points, which
* update the geometry, and optionally advance the manager state. * update the geometry, and optionally advance the manager state.
* *
* Interfaces are provided to return both arc geometry (can be used * Interfaces are provided to return both arc geometry (can be used to set up real arcs on
* to set up real arcs on PCBs, for example) as well as important * PCBs, for example) as well as important control points for informational overlays.
* control points for informational overlays.
*/ */
class ARC_GEOM_MANAGER: public MULTISTEP_GEOM_MANAGER class ARC_GEOM_MANAGER: public MULTISTEP_GEOM_MANAGER
{ {
@ -50,9 +46,9 @@ public:
enum ARC_STEPS enum ARC_STEPS
{ {
SET_ORIGIN = 0, ///> Waiting to lock in origin point SET_ORIGIN = 0, ///< Waiting to lock in origin point
SET_START, ///> Waiting to lock in the arc start point SET_START, ///< Waiting to lock in the arc start point
SET_ANGLE, ///> Waiting to lock in the arc end point SET_ANGLE, ///< Waiting to lock in the arc end point
COMPLETE COMPLETE
}; };
@ -62,7 +58,7 @@ public:
} }
/** /**
* Get the current step the mananger is on (useful when drawing * Get the current step the manager is on (useful when drawing
* something depends on the current state) * something depends on the current state)
*/ */
ARC_STEPS GetStep() const ARC_STEPS GetStep() const
@ -72,13 +68,13 @@ public:
bool acceptPoint( const VECTOR2I& aPt ) override; bool acceptPoint( const VECTOR2I& aPt ) override;
///> The the arc to be clockwise from start ///< The the arc to be clockwise from start
void SetClockwise( bool aCw ); void SetClockwise( bool aCw );
///> Reverse the current are direction ///< Reverse the current are direction
void ToggleClockwise(); void ToggleClockwise();
///> Set angle snapping (for the next point) ///< Set angle snapping (for the next point)
void SetAngleSnap( bool aSnap ) void SetAngleSnap( bool aSnap )
{ {
m_angleSnap = aSnap; m_angleSnap = aSnap;
@ -88,22 +84,22 @@ public:
* Geometry query interface - used by clients of the manager * Geometry query interface - used by clients of the manager
*/ */
///> Get the centre point of the arc (valid when state > SET_ORIGIN) ///< Get the center point of the arc (valid when state > SET_ORIGIN)
VECTOR2I GetOrigin() const; VECTOR2I GetOrigin() const;
///> Get the coordinates of the arc start ///< Get the coordinates of the arc start
VECTOR2I GetStartRadiusEnd() const; VECTOR2I GetStartRadiusEnd() const;
///> Get the coordinates of the arc end point ///< Get the coordinates of the arc end point
VECTOR2I GetEndRadiusEnd() const; VECTOR2I GetEndRadiusEnd() const;
///> Get the radius of the arc (valid if step >= SET_START) ///< Get the radius of the arc (valid if step >= SET_START)
double GetRadius() const; double GetRadius() const;
///> Get the angle of the vector leading to the start point (valid if step >= SET_START) ///< Get the angle of the vector leading to the start point (valid if step >= SET_START)
double GetStartAngle() const; double GetStartAngle() const;
///> Get the angle of the vector leading to the end point (valid if step >= SET_ANGLE) ///< Get the angle of the vector leading to the end point (valid if step >= SET_ANGLE)
double GetSubtended() const; double GetSubtended() const;
private: private:
@ -112,13 +108,13 @@ private:
* Point acceptor functions * Point acceptor functions
*/ */
///> Set the centre point of the arc ///< Set the center point of the arc
bool setOrigin( const VECTOR2I& aOrigin ); bool setOrigin( const VECTOR2I& aOrigin );
///> Set the end of the first radius line (arc start) ///< Set the end of the first radius line (arc start)
bool setStart( const VECTOR2I& aEnd ); bool setStart( const VECTOR2I& aEnd );
///> Set a point of the second radius line (collinear with arc end) ///< Set a point of the second radius line (collinear with arc end)
bool setEnd( const VECTOR2I& aCursor ); bool setEnd( const VECTOR2I& aCursor );
/* /*

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -40,36 +40,31 @@ namespace PREVIEW
class TWO_POINT_GEOMETRY_MANAGER; class TWO_POINT_GEOMETRY_MANAGER;
/** /**
* CENTRELINE_RECT_ITEM * Represent an area drawn by drawing a rectangle of a given aspect along a vector, with the
* midpoint of one side on the start point and the mid point of the opposite side on the end.
* *
* Represents an area drawn by drawing a rectangle of a given aspect * The center line does not have to horizontal or vertical, it can be at any angle.
* along a vector, with the midpoiunt of one side on the start point
* and the mid point of the opposite side on the end.
*
* The centre line does not have to horizontal or vertical, it
* can be at any angle.
*/ */
class CENTRELINE_RECT_ITEM : public SIMPLE_OVERLAY_ITEM class CENTRELINE_RECT_ITEM : public SIMPLE_OVERLAY_ITEM
{ {
public: public:
CENTRELINE_RECT_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, CENTRELINE_RECT_ITEM( const TWO_POINT_GEOMETRY_MANAGER& aGeomMgr, double aAspect );
double aAspect );
///> Gets the bounding box of the rectangle ///< Gets the bounding box of the rectangle
virtual const BOX2I ViewBBox() const override; virtual const BOX2I ViewBBox() const override;
private: private:
///> Get the rectangular outline ///< Get the rectangular outline
SHAPE_POLY_SET getOutline() const; SHAPE_POLY_SET getOutline() const;
///> Draw rectangle and centre line onto GAL ///< Draw rectangle and center line onto GAL
void drawPreviewShape( KIGFX::VIEW* aView ) const override; void drawPreviewShape( KIGFX::VIEW* aView ) const override;
const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr; const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr;
///> The aspect ratio of the rectangle to draw ///< The aspect ratio of the rectangle to draw
double m_aspect; double m_aspect;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -53,9 +53,9 @@ public:
* Add a point to the construction manager * Add a point to the construction manager
* *
* @param aPt the new point * @param aPt the new point
* @param aLockIn whether to "lock in" the point, and move the * @param aLockIn whether to "lock in" the point, and move the geometry manager to the
* geometry manager to the next (or previous) step. False to * next (or previous) step. False to update geometry and not affect
* update geometry and not affect manager state * manager state.
*/ */
void AddPoint( const VECTOR2I& aPt, bool aLockIn ) void AddPoint( const VECTOR2I& aPt, bool aLockIn )
{ {
@ -73,16 +73,14 @@ public:
} }
/** /**
* Undo the last point, and move the manager back to the previous * Undo the last point, and move the manager back to the previous step.
* step
*/ */
void RemoveLastPoint() void RemoveLastPoint()
{ {
performStep( false ); performStep( false );
// process the last point again, but in the previous step mode // process the last point again, but in the previous step mode it doesn't matter if
// it doesn't matter if accepted or not, as long as the geometry // accepted or not, as long as the geometry is regenerated if needed.
// is regenerated if needed
acceptPoint( GetLastPoint() ); acceptPoint( GetLastPoint() );
setGeometryChanged(); setGeometryChanged();
} }
@ -96,7 +94,7 @@ public:
} }
/** /**
* Reset the manager to the initial state * Reset the manager to the initial state.
*/ */
void Reset() void Reset()
{ {
@ -105,7 +103,7 @@ public:
} }
/** /**
* @return true if the manager reached the final state * @return true if the manager reached the final state.
*/ */
bool IsComplete() const bool IsComplete() const
{ {
@ -113,10 +111,10 @@ public:
} }
/** /**
* Gets the last point added (locked in or not). This can * Get the last point added (locked in or not).
* be useful when drawing previews, as the point given isn't always *
* what gets locked into the geometry, if that step doesn't have * This can* be useful when drawing previews, as the point given isn't always what gets
* full degrees of freedom * locked into the geometry, if that step doesn't have full degrees of freedom.
*/ */
VECTOR2I GetLastPoint() const VECTOR2I GetLastPoint() const
{ {
@ -124,8 +122,7 @@ public:
} }
/** /**
* @return true if the geoemtry has changed, eg such that a client * @return true if the geometry has changed, eg such that a client should redraw.
* should redraw
*/ */
bool HasGeometryChanged() const bool HasGeometryChanged() const
{ {
@ -133,8 +130,8 @@ public:
} }
/** /**
* Clear the geometry changed flag, call after the client code has * Clear the geometry changed flag, call after the client code has updated everything
* updated everything as needed. * as needed.
*/ */
void ClearGeometryChanged() void ClearGeometryChanged()
{ {
@ -143,13 +140,13 @@ public:
protected: protected:
///> Mark the geometry as changed for clients to notice ///< Mark the geometry as changed for clients to notice
void setGeometryChanged() void setGeometryChanged()
{ {
m_changed = true; m_changed = true;
} }
///> Get the current stage of the manager ///< Get the current stage of the manager
int getStep() const int getStep() const
{ {
return m_step; return m_step;
@ -157,17 +154,17 @@ protected:
private: private:
///> Function that accepts a point for a stage, or rejects it ///< Function that accepts a point for a stage, or rejects it
///> to return to the previous stage ///< to return to the previous stage
virtual bool acceptPoint( const VECTOR2I& aPt ) = 0; virtual bool acceptPoint( const VECTOR2I& aPt ) = 0;
/** /**
* The highest step this manager has - used to recognise completion * The highest step this manager has - used to recognize completion
* and to clamp the step as it advances. * and to clamp the step as it advances.
*/ */
virtual int getMaxStep() const = 0; virtual int getMaxStep() const = 0;
///> Moves the manager forward or backward through the stages ///< Moves the manager forward or backward through the stages
void performStep( bool aForward ) void performStep( bool aForward )
{ {
m_step += aForward ? 1 : -1; m_step += aForward ? 1 : -1;
@ -176,15 +173,14 @@ private:
m_step = std::min( std::max( m_step, 0 ), getMaxStep() ); m_step = std::min( std::max( m_step, 0 ), getMaxStep() );
} }
///> Has the gemotry changed such that a client should redraw? ///< Has the geometry changed such that a client should redraw?
bool m_changed = false; bool m_changed = false;
///> The last (raw) point added, which is usually the cursor position ///< The last (raw) point added, which is usually the cursor position
VECTOR2I m_lastPoint; VECTOR2I m_lastPoint;
/** /**
* The current manager step, from 0 to some highest number that * The current manager step, from 0 to some highest number that depends on the manager.
* depends on the manager
*/ */
int m_step = 0; int m_step = 0;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * 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-2021 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -27,9 +27,8 @@
#include <geometry/shape_line_chain.h> #include <geometry/shape_line_chain.h>
/** /**
* Class that handles the drawing of a polygon, including * Class that handles the drawing of a polygon, including management of last corner deletion
* management of last corner deletion and drawing of leader lines * and drawing of leader lines with various constraints (eg 45 deg only).
* with various constraints (eg 45 deg only).
* *
* This class handles only the geometry of the process. * This class handles only the geometry of the process.
*/ */
@ -46,17 +45,17 @@ public:
public: public:
/** /**
* Called before the first point is added - clients can do * Called before the first point is added - clients can do
* initialisation here, and can veto the start of the process * initialization here, and can veto the start of the process
* (e.g. if user cancels a dialog) * (e.g. if user cancels a dialog)
* *
* @return false to veto start of new polygon * @return false to veto start of new polygon
*/ */
virtual bool OnFirstPoint( POLYGON_GEOM_MANAGER& aMgr ) = 0; virtual bool OnFirstPoint( POLYGON_GEOM_MANAGER& aMgr ) = 0;
///> Sent when the polygon geometry changes ///< Sent when the polygon geometry changes
virtual void OnGeometryChange( const POLYGON_GEOM_MANAGER& aMgr ) = 0; virtual void OnGeometryChange( const POLYGON_GEOM_MANAGER& aMgr ) = 0;
///> Called when the polygon is complete ///< Called when the polygon is complete
virtual void OnComplete( const POLYGON_GEOM_MANAGER& aMgr ) = 0; virtual void OnComplete( const POLYGON_GEOM_MANAGER& aMgr ) = 0;
virtual ~CLIENT() virtual ~CLIENT()
@ -69,8 +68,8 @@ public:
*/ */
enum class LEADER_MODE enum class LEADER_MODE
{ {
DIRECT, ///> Unconstrained point-to-point DIRECT, ///< Unconstrained point-to-point
DEG45, ///> 45 Degree only DEG45, ///< 45 Degree only
}; };
/** /**
@ -84,18 +83,17 @@ public:
bool AddPoint( const VECTOR2I& aPt ); bool AddPoint( const VECTOR2I& aPt );
/** /**
* Mark the polygon finished and update the client * Mark the polygon finished and update the client.
*/ */
void SetFinished(); void SetFinished();
/** /**
* Clear the manager state and start again * Clear the manager state and start again.
*/ */
void Reset(); void Reset();
/** /**
* Set the leader mode to use when calculating the leader/returner * Set the leader mode to use when calculating the leader/returner lines.
* lines
*/ */
void SetLeaderMode( LEADER_MODE aMode ); void SetLeaderMode( LEADER_MODE aMode );
@ -106,6 +104,7 @@ public:
/** /**
* Enables/disables self-intersecting polygons. * Enables/disables self-intersecting polygons.
*
* @param aEnabled true if self-intersecting polygons are enabled. * @param aEnabled true if self-intersecting polygons are enabled.
*/ */
void AllowIntersections( bool aEnabled ) void AllowIntersections( bool aEnabled )
@ -114,7 +113,8 @@ public:
} }
/** /**
* Checks whether self-intersecting polygons are enabled. * Check whether self-intersecting polygons are enabled.
*
* @return true if self-intersecting polygons are enabled. * @return true if self-intersecting polygons are enabled.
*/ */
bool IntersectionsAllowed() const bool IntersectionsAllowed() const
@ -123,7 +123,8 @@ public:
} }
/** /**
* Checks whether the locked points constitute a self-intersecting outline. * Check whether the locked points constitute a self-intersecting outline.
*
* @param aIncludeLeaderPts when true, also the leading points (not placed ones) will be tested. * @param aIncludeLeaderPts when true, also the leading points (not placed ones) will be tested.
* @return True when the outline is self-intersecting. * @return True when the outline is self-intersecting.
*/ */
@ -141,8 +142,7 @@ public:
bool IsPolygonInProgress() const; bool IsPolygonInProgress() const;
/** /**
* @return true if locking in the given point would close the * @return true if locking in the given point would close the current polygon.
* current polygon
*/ */
bool NewPointClosesOutline( const VECTOR2I& aPt ) const; bool NewPointClosesOutline( const VECTOR2I& aPt ) const;
@ -183,19 +183,19 @@ private:
void updateLeaderPoints( const VECTOR2I& aEndPoint, void updateLeaderPoints( const VECTOR2I& aEndPoint,
LEADER_MODE aModifier = LEADER_MODE::DIRECT ); LEADER_MODE aModifier = LEADER_MODE::DIRECT );
///> The "user" of the polygon data that is informed when the geometry changes ///< The "user" of the polygon data that is informed when the geometry changes
CLIENT& m_client; CLIENT& m_client;
///> The current mode of the leader line ///< The current mode of the leader line
LEADER_MODE m_leaderMode; LEADER_MODE m_leaderMode;
///> Flag enabling self-intersecting polygons ///< Flag enabling self-intersecting polygons
bool m_intersectionsAllowed; bool m_intersectionsAllowed;
///> Point that have been "locked in" ///< Point that have been "locked in"
SHAPE_LINE_CHAIN m_lockedPoints; SHAPE_LINE_CHAIN m_lockedPoints;
///> Points in the temporary "leader" line(s) ///< Points in the temporary "leader" line(s)
SHAPE_LINE_CHAIN m_leaderPts; SHAPE_LINE_CHAIN m_leaderPts;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2017 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2017-2021 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -39,22 +39,17 @@ namespace PREVIEW
{ {
/** /**
* POLYGON_ITEM * A preview item which shows an in-progress polygon, which can be used for zone outlines, etc.
*
* A preview item which shows an in-progress polygon, which
* can be used for zone outlines, etc
*/ */
class POLYGON_ITEM : public SIMPLE_OVERLAY_ITEM class POLYGON_ITEM : public SIMPLE_OVERLAY_ITEM
{ {
public: public:
POLYGON_ITEM(); POLYGON_ITEM();
///> Gets the bounding box of the polygon ///< Gets the bounding box of the polygon
virtual const BOX2I ViewBBox() const override; virtual const BOX2I ViewBBox() const override;
/** /**
* Set the polygon points * Set the polygon points
* *
@ -66,14 +61,13 @@ public:
const SHAPE_LINE_CHAIN& aLeaderPts ); const SHAPE_LINE_CHAIN& aLeaderPts );
private: private:
///< Draw rectangle and center line onto GAL
///> Draw rectangle and centre line onto GAL
void drawPreviewShape( KIGFX::VIEW* aView ) const override; void drawPreviewShape( KIGFX::VIEW* aView ) const override;
///> complete polyline of locked in and leader points ///< complete polyline of locked in and leader points
SHAPE_LINE_CHAIN m_lockedChain, m_leaderChain; SHAPE_LINE_CHAIN m_lockedChain, m_leaderChain;
///> polygon fill ///< polygon fill
SHAPE_POLY_SET m_polyfill; SHAPE_POLY_SET m_polyfill;
static const double POLY_LINE_WIDTH; static const double POLY_LINE_WIDTH;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -36,8 +36,6 @@ namespace PREVIEW
class TWO_POINT_GEOMETRY_MANAGER; class TWO_POINT_GEOMETRY_MANAGER;
/** /**
* RULER_ITEM
*
* A drawn ruler item for showing the distance between two points. * A drawn ruler item for showing the distance between two points.
*/ */
class RULER_ITEM : public EDA_ITEM class RULER_ITEM : public EDA_ITEM
@ -45,13 +43,13 @@ class RULER_ITEM : public EDA_ITEM
public: public:
RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr, EDA_UNITS userUnits ); RULER_ITEM( const TWO_POINT_GEOMETRY_MANAGER& m_geomMgr, EDA_UNITS userUnits );
///> @copydoc EDA_ITEM::ViewBBox() ///< @copydoc EDA_ITEM::ViewBBox()
const BOX2I ViewBBox() const override; const BOX2I ViewBBox() const override;
///> @copydoc EDA_ITEM::ViewGetLayers() ///< @copydoc EDA_ITEM::ViewGetLayers()
void ViewGetLayers( int aLayers[], int& aCount ) const override; void ViewGetLayers( int aLayers[], int& aCount ) const override;
///> @copydoc EDA_ITEM::ViewDraw(); ///< @copydoc EDA_ITEM::ViewDraw();
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final; void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final;

View File

@ -2,6 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -36,12 +38,10 @@ namespace PREVIEW
{ {
/** /**
* SELECTION_AREA * Represent a selection area (currently a rectangle) in a VIEW, drawn corner-to-corner between
* two points.
* *
* Represents a selection area (currently a rectangle) in a VIEW, * This is useful when selecting a rectangular area, for lasso-select or zooming, for example.
* drawn corner-to-corner between two points. This is useful when
* selecting a rectangular area, for lasso-select or zooming, for
* example.
*/ */
class SELECTION_AREA : public SIMPLE_OVERLAY_ITEM class SELECTION_AREA : public SIMPLE_OVERLAY_ITEM
{ {
@ -52,7 +52,7 @@ public:
const BOX2I ViewBBox() const override; const BOX2I ViewBBox() const override;
///> Set the origin of the rectange (the fixed corner) ///< Set the origin of the rectangle (the fixed corner)
void SetOrigin( VECTOR2I aOrigin ) void SetOrigin( VECTOR2I aOrigin )
{ {
m_origin = aOrigin; m_origin = aOrigin;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2017 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -58,13 +58,13 @@ public:
SIMPLE_OVERLAY_ITEM(); SIMPLE_OVERLAY_ITEM();
/** /**
* Sets the overlay layer only. You can override this if * Set the overlay layer only. You can override this if
* you have more layers to draw on. * you have more layers to draw on.
*/ */
void ViewGetLayers( int aLayers[], int& aCount ) const override; void ViewGetLayers( int aLayers[], int& aCount ) const override;
/** /**
* Draws the preview - this is done by calling the two functions: * Draw the preview - this is done by calling the two functions:
* setupGal() and drawPreviewShape(). If you need more than this, * setupGal() and drawPreviewShape(). If you need more than this,
* or direct access to the VIEW, you probably should make a new * or direct access to the VIEW, you probably should make a new
*. *.
@ -87,19 +87,19 @@ public:
return "SIMPLE_OVERLAY_ITEM"; return "SIMPLE_OVERLAY_ITEM";
} }
///> Set the stroke colour to set before drawing preview ///< Set the stroke color to set before drawing preview
void SetStrokeColor( const COLOR4D& aNewColor ) void SetStrokeColor( const COLOR4D& aNewColor )
{ {
m_strokeColor = aNewColor; m_strokeColor = aNewColor;
} }
///> Set the fill colour to set before drawing preview ///< Set the fill color to set before drawing preview
void SetFillColor( const COLOR4D& aNewColor ) void SetFillColor( const COLOR4D& aNewColor )
{ {
m_fillColor = aNewColor; m_fillColor = aNewColor;
} }
///> Set the line width to set before drawing preview ///< Set the line width to set before drawing preview
void SetLineWidth( double aNewWidth ) void SetLineWidth( double aNewWidth )
{ {
m_lineWidth = aNewWidth; m_lineWidth = aNewWidth;
@ -110,15 +110,15 @@ private:
/** /**
* Set up the GAL canvas - this provides a default implementation, * Set up the GAL canvas - this provides a default implementation,
* that sets fill, stroke and width. * that sets fill, stroke and width.
*
* If that's not suitable, you can set more options in * If that's not suitable, you can set more options in
* updatePreviewShape(), but you might find that defining a new * updatePreviewShape(), but you might find that defining a new
* EDA_ITEM derivative is easier for heavily customised cases. * EDA_ITEM derivative is easier for heavily customized cases.
*/ */
void setupGal( KIGFX::GAL& aGal ) const; void setupGal( KIGFX::GAL& aGal ) const;
/** /**
* Draw the preview onto the given GAL. setupGal() will be called * Draw the preview onto the given GAL. setupGal() will be called before this function.
* before this function.
* *
* Subclasses should implement this in terms of their own graphical * Subclasses should implement this in terms of their own graphical
* data. * data.

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -35,16 +35,13 @@ namespace PREVIEW
{ {
/** /**
* TWO_POINT_GEOMETRY_MANAGER * Represent a very simple geometry manager for items that have a start and end point.
*
* Represents a very simple geometry manager for items that have
* a start and end point.
*/ */
class TWO_POINT_GEOMETRY_MANAGER class TWO_POINT_GEOMETRY_MANAGER
{ {
public: public:
///> Set the origin of the ruler (the fixed end) ///< Set the origin of the ruler (the fixed end)
void SetOrigin( const VECTOR2I& aOrigin ) void SetOrigin( const VECTOR2I& aOrigin )
{ {
m_origin = aOrigin; m_origin = aOrigin;
@ -58,8 +55,7 @@ public:
} }
/** /**
* Set the current end of the rectangle (the end that moves * Set the current end of the rectangle (the end that moves with the cursor.
* with the cursor.
*/ */
void SetEnd( const VECTOR2I& aEnd ) void SetEnd( const VECTOR2I& aEnd )
{ {
@ -107,8 +103,7 @@ public:
} }
/** /**
* @return true if the geoemtry has changed, eg such that a client * @return true if the geometry has changed, eg such that a client should redraw.
* should redraw
*/ */
bool HasGeometryChanged() const bool HasGeometryChanged() const
{ {
@ -116,8 +111,8 @@ public:
} }
/** /**
* Clear the geometry changed flag, call after the client code has * Clear the geometry changed flag, call after the client code has updated everything as
* updated everything as needed. * needed.
*/ */
void ClearGeometryChanged() void ClearGeometryChanged()
{ {
@ -125,7 +120,7 @@ public:
} }
protected: protected:
///> Mark the geometry as changed for clients to notice ///< Mark the geometry as changed for clients to notice
void setGeometryChanged() void setGeometryChanged()
{ {
m_changed = true; m_changed = true;
@ -136,7 +131,7 @@ private:
VECTOR2I m_origin, m_end; VECTOR2I m_origin, m_end;
bool m_angleSnap = false; bool m_angleSnap = false;
///> Has the gemotry changed such that a client should redraw? ///< Has the geometry changed such that a client should redraw?
bool m_changed = false; bool m_changed = false;
bool m_originSet = false; bool m_originSet = false;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -56,7 +56,7 @@ class PROJECT_LOCAL_SETTINGS;
/** /**
* Container for project specific data. * Container for project specific data.
* *
* Because it is in the neutral program top, which is not linked to by subsidiarly DSOs, * Because it is in the neutral program top, which is not linked to by subsidiary DSOs,
* any functions in this interface must be virtual. * any functions in this interface must be virtual.
*/ */
class PROJECT class PROJECT
@ -67,7 +67,7 @@ public:
* *
* Derive #PROJECT elements from this, it has a virtual destructor, and Elem*() functions * Derive #PROJECT elements from this, it has a virtual destructor, and Elem*() functions
* can work with it. Implementation is opaque in class #PROJECT. If find you have to * can work with it. Implementation is opaque in class #PROJECT. If find you have to
* include derived class headersin this file, you are doing incompatible with the goal * include derived class headers in this file, you are doing incompatible with the goal
* of this class. Keep knowledge of derived classes opaque to class PROJECT please. * of this class. Keep knowledge of derived classes opaque to class PROJECT please.
*/ */
class _ELEM class _ELEM
@ -180,10 +180,10 @@ public:
* Return a "retained string", which is any session and project specific string * Return a "retained string", which is any session and project specific string
* identified in enum #RSTRING_T. * identified in enum #RSTRING_T.
* *
*Retained strings are not written to disk, and are therefore good only for the current * Retained strings are not written to disk, and are therefore good only for the current
* session. * session.
*/ */
virtual const wxString& GetRString( RSTRING_T aStringId ); virtual const wxString& GetRString( RSTRING_T aStringId );
/** /**
* Store a "retained string", which is any session and project specific string * Store a "retained string", which is any session and project specific string
@ -192,7 +192,7 @@ public:
* Retained strings are not written to disk, and are therefore good only for the current * Retained strings are not written to disk, and are therefore good only for the current
* session. * session.
*/ */
virtual void SetRString( RSTRING_T aStringId, const wxString& aString ); virtual void SetRString( RSTRING_T aStringId, const wxString& aString );
/** /**
* The set of #_ELEMs that a #PROJECT can hold. * The set of #_ELEMs that a #PROJECT can hold.
@ -255,7 +255,7 @@ public:
virtual FP_LIB_TABLE* PcbFootprintLibs( KIWAY& aKiway ); virtual FP_LIB_TABLE* PcbFootprintLibs( KIWAY& aKiway );
// These are the non-virtual DATA LOAD ON DEMAND members. They load project related // These are the non-virtual DATA LOAD ON DEMAND members. They load project related
// data on demand, and do so typicallly into m_elems[] at a particular index using // data on demand, and do so typically into m_elems[] at a particular index using
// SetElem() & GetElem(). That is, they wrap SetElem() and GetElem(). // SetElem() & GetElem(). That is, they wrap SetElem() and GetElem().
// To get the data to reload on demand, first SetProjectFullName(), // To get the data to reload on demand, first SetProjectFullName(),
// then call SetElem( ELEM_T, NULL ) from client code. // then call SetElem( ELEM_T, NULL ) from client code.
@ -342,7 +342,7 @@ private:
wxFileName m_project_name; ///< \<fullpath\>/\<basename\>.pro wxFileName m_project_name; ///< \<fullpath\>/\<basename\>.pro
wxString m_pro_date_and_time; wxString m_pro_date_and_time;
///> True if the project is read-only: no project files will be written ///< True if the project is read-only: no project files will be written
bool m_readOnly; bool m_readOnly;
/// Backing store for project data -- owned by SETTINGS_MANAGER /// Backing store for project data -- owned by SETTINGS_MANAGER

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com> * Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -83,16 +83,16 @@ struct SELECTION_FILTER_OPTIONS
}; };
/** /**
* Determines how inactive layers should be displayed * Determine how inactive layers should be displayed.
*/ */
enum class HIGH_CONTRAST_MODE enum class HIGH_CONTRAST_MODE
{ {
NORMAL = 0, ///> Non-active layers are shown normally (no high-contrast mode) NORMAL = 0, ///< Non-active layers are shown normally (no high-contrast mode)
DIMMED, ///> Non-active layers are dimmed (old high-contrast mode) DIMMED, ///< Non-active layers are dimmed (old high-contrast mode)
HIDDEN ///> Non-active layers are hidden HIDDEN ///< Non-active layers are hidden
}; };
///> Determines how zones should be displayed ///< Determine how zones should be displayed.
enum class ZONE_DISPLAY_MODE enum class ZONE_DISPLAY_MODE
{ {
SHOW_FILLED, ///< Filled polygons are shown SHOW_FILLED, ///< Filled polygons are shown
@ -100,7 +100,7 @@ enum class ZONE_DISPLAY_MODE
SHOW_FILLED_OUTLINE ///< Outlines of filled polygons are shown SHOW_FILLED_OUTLINE ///< Outlines of filled polygons are shown
}; };
///> Determines how net color overrides should be applied ///< Determine how net color overrides should be applied.
enum class NET_COLOR_MODE enum class NET_COLOR_MODE
{ {
OFF, ///< Net (and netclass) colors are not shown OFF, ///< Net (and netclass) colors are not shown
@ -108,7 +108,7 @@ enum class NET_COLOR_MODE
ALL ///< Net/netclass colors are shown on all net copper ALL ///< Net/netclass colors are shown on all net copper
}; };
///> Determines how ratsnest lines are drawn ///< Determine how ratsnest lines are drawn.
enum class RATSNEST_MODE enum class RATSNEST_MODE
{ {
ALL, ///< Ratsnest lines are drawn to items on all layers (default) ALL, ///< Ratsnest lines are drawn to items on all layers (default)
@ -116,7 +116,7 @@ enum class RATSNEST_MODE
}; };
/** /**
* A saved set of layers that are visible * A saved set of layers that are visible.
*/ */
struct LAYER_PRESET struct LAYER_PRESET
{ {

View File

@ -2,7 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 CERN * Copyright (C) 2020 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -43,7 +44,7 @@ class PROPERTY_BASE;
template<typename T> template<typename T>
class ENUM_MAP; class ENUM_MAP;
///> Common property types ///< Common property types
enum PROPERTY_DISPLAY enum PROPERTY_DISPLAY
{ {
DEFAULT, ///< Default property for a given type DEFAULT, ///< Default property for a given type
@ -52,7 +53,7 @@ enum PROPERTY_DISPLAY
DECIDEGREE ///< Convert decidegrees to degrees for display DECIDEGREE ///< Convert decidegrees to degrees for display
}; };
///> Macro to generate unique identifier for a type ///< Macro to generate unique identifier for a type
#define TYPE_HASH( x ) typeid( x ).hash_code() #define TYPE_HASH( x ) typeid( x ).hash_code()
#define TYPE_NAME( x ) typeid( x ).name() #define TYPE_NAME( x ) typeid( x ).name()
//#define TYPE_HASH( x ) typeid( std::decay<x>::type ).hash_code() //#define TYPE_HASH( x ) typeid( std::decay<x>::type ).hash_code()
@ -169,7 +170,7 @@ public:
class PROPERTY_BASE class PROPERTY_BASE
{ {
private: private:
///> Used to generate unique IDs. Must come up front so it's initialized before ctor. ///< Used to generate unique IDs. Must come up front so it's initialized before ctor.
public: public:
PROPERTY_BASE( const wxString& aName, PROPERTY_DISPLAY aDisplay = DEFAULT ) : PROPERTY_BASE( const wxString& aName, PROPERTY_DISPLAY aDisplay = DEFAULT ) :
@ -189,7 +190,7 @@ public:
} }
/** /**
* Returns a limited set of possible values (e.g. enum). Check with HasChoices() if a particular * Return a limited set of possible values (e.g. enum). Check with HasChoices() if a particular
* PROPERTY provides such set. * PROPERTY provides such set.
*/ */
virtual const wxPGChoices& Choices() const virtual const wxPGChoices& Choices() const
@ -199,7 +200,7 @@ public:
} }
/** /**
* Sets the possible values for for the property. * Set the possible values for for the property.
*/ */
virtual void SetChoices( const wxPGChoices& aChoices ) virtual void SetChoices( const wxPGChoices& aChoices )
{ {
@ -207,7 +208,7 @@ public:
} }
/** /**
* Returns true if this PROPERTY has a limited set of possible values. * Return true if this PROPERTY has a limited set of possible values.
* @see PROPERTY_BASE::Choices() * @see PROPERTY_BASE::Choices()
*/ */
virtual bool HasChoices() const virtual bool HasChoices() const
@ -216,7 +217,7 @@ public:
} }
/** /**
* Returns true if aObject offers this PROPERTY. * Return true if aObject offers this PROPERTY.
*/ */
bool Available( INSPECTABLE* aObject ) const bool Available( INSPECTABLE* aObject ) const
{ {
@ -224,7 +225,7 @@ public:
} }
/** /**
* Sets a callback function to determine whether an object provides this property. * Set a callback function to determine whether an object provides this property.
*/ */
void SetAvailableFunc( std::function<bool(INSPECTABLE*)> aFunc ) void SetAvailableFunc( std::function<bool(INSPECTABLE*)> aFunc )
{ {
@ -232,17 +233,17 @@ public:
} }
/** /**
* Returns type-id of the Owner class. * Return type-id of the Owner class.
*/ */
virtual size_t OwnerHash() const = 0; virtual size_t OwnerHash() const = 0;
/** /**
* Returns type-id of the Base class. * Return type-id of the Base class.
*/ */
virtual size_t BaseHash() const = 0; virtual size_t BaseHash() const = 0;
/** /**
* Returns type-id of the property type. * Return type-id of the property type.
*/ */
virtual size_t TypeHash() const = 0; virtual size_t TypeHash() const = 0;
@ -279,7 +280,7 @@ private:
const wxString m_name; const wxString m_name;
const PROPERTY_DISPLAY m_display; const PROPERTY_DISPLAY m_display;
std::function<bool(INSPECTABLE*)> m_availFunc; ///> Eval to determine if prop is available std::function<bool(INSPECTABLE*)> m_availFunc; ///< Eval to determine if prop is available
friend class INSPECTABLE; friend class INSPECTABLE;
}; };
@ -360,19 +361,19 @@ protected:
return res; return res;
} }
///> Set method ///< Set method
std::unique_ptr<SETTER_BASE<Owner, T>> m_setter; std::unique_ptr<SETTER_BASE<Owner, T>> m_setter;
///> Get method ///< Get method
std::unique_ptr<GETTER_BASE<Owner, T>> m_getter; std::unique_ptr<GETTER_BASE<Owner, T>> m_getter;
///> Owner class type-id ///< Owner class type-id
const size_t m_ownerHash; const size_t m_ownerHash;
///> Base class type-id ///< Base class type-id
const size_t m_baseHash; const size_t m_baseHash;
///> Property value type-id ///< Property value type-id
const size_t m_typeHash; const size_t m_typeHash;
}; };
@ -596,7 +597,7 @@ private:
DECLARE_ENUM_TO_WXANY( type ) \ DECLARE_ENUM_TO_WXANY( type ) \
IMPLEMENT_ENUM_TO_WXANY( type ) IMPLEMENT_ENUM_TO_WXANY( type )
///> Macro to define read-only fields (no setter method available) ///< Macro to define read-only fields (no setter method available)
#define NO_SETTER( owner, type ) ( ( void ( owner::* )( type ) ) nullptr ) #define NO_SETTER( owner, type ) ( ( void ( owner::* )( type ) ) nullptr )
/* /*

View File

@ -2,6 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 CERN * Copyright (C) 2020 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -37,7 +39,7 @@
class PROPERTY_BASE; class PROPERTY_BASE;
class TYPE_CAST_BASE; class TYPE_CAST_BASE;
///> Unique type identifier ///< Unique type identifier
using TYPE_ID = size_t; using TYPE_ID = size_t;
using PROPERTY_LIST = std::vector<PROPERTY_BASE*>; using PROPERTY_LIST = std::vector<PROPERTY_BASE*>;
@ -45,7 +47,7 @@ using PROPERTY_LIST = std::vector<PROPERTY_BASE*>;
using PROPERTY_SET = std::set<std::pair<size_t, wxString>>; using PROPERTY_SET = std::set<std::pair<size_t, wxString>>;
/** /**
* Provides class metadata. Each class handled by PROPERTY_MANAGER * Provide class metadata. Each class handled by PROPERTY_MANAGER
* needs to be described using AddProperty(), AddTypeCast() and InheritsAfter() methods. * needs to be described using AddProperty(), AddTypeCast() and InheritsAfter() methods.
* *
* Enum types use a dedicated property type (PROPERTY_ENUM), define its possible values * Enum types use a dedicated property type (PROPERTY_ENUM), define its possible values
@ -68,9 +70,9 @@ public:
} }
/** /**
* Associates a name with a type. * Associate a name with a type.
* *
* Builds a map to provide faster type look-up. * Build a map to provide faster type look-up.
* *
* @param aType is the type identifier (obtained using TYPE_HASH()). * @param aType is the type identifier (obtained using TYPE_HASH()).
* @param aName is the type name. * @param aName is the type name.
@ -78,7 +80,7 @@ public:
void RegisterType( TYPE_ID aType, const wxString& aName ); void RegisterType( TYPE_ID aType, const wxString& aName );
/** /**
* Returns name of a type. * Return name of a type.
* *
* @param aType is the type identifier (obtained using TYPE_HASH()). * @param aType is the type identifier (obtained using TYPE_HASH()).
* @return Name of the type or empty string, if not available. * @return Name of the type or empty string, if not available.
@ -86,7 +88,7 @@ public:
const wxString& ResolveType( TYPE_ID aType ) const; const wxString& ResolveType( TYPE_ID aType ) const;
/** /**
* Returns a property for a specific type. * Return a property for a specific type.
* *
* @param aType is the type identifier (obtained using TYPE_HASH()). * @param aType is the type identifier (obtained using TYPE_HASH()).
* @param aProperty is the property name used during class registration. * @param aProperty is the property name used during class registration.
@ -95,7 +97,7 @@ public:
PROPERTY_BASE* GetProperty( TYPE_ID aType, const wxString& aProperty ) const; PROPERTY_BASE* GetProperty( TYPE_ID aType, const wxString& aProperty ) const;
/** /**
* Returns all properties for a specific type. * Return all properties for a specific type.
* *
* @param aType is the type identifier (obtained using TYPE_HASH()). * @param aType is the type identifier (obtained using TYPE_HASH()).
* @return Vector storing all properties of the requested type. * @return Vector storing all properties of the requested type.
@ -103,7 +105,7 @@ public:
const PROPERTY_LIST& GetProperties( TYPE_ID aType ) const; const PROPERTY_LIST& GetProperties( TYPE_ID aType ) const;
/** /**
* Casts a type to another type. Used for correct type-casting of types with * Cast a type to another type. Used for correct type-casting of types with
* multi-inheritance. Requires registration of an appropriate converter (AddTypeCast). * multi-inheritance. Requires registration of an appropriate converter (AddTypeCast).
* *
* @param aSource is a pointer to the casted object. * @param aSource is a pointer to the casted object.
@ -121,14 +123,14 @@ public:
} }
/** /**
* Registers a property. * Register a property.
* *
* @param aProperty is the property to register. * @param aProperty is the property to register.
*/ */
void AddProperty( PROPERTY_BASE* aProperty ); void AddProperty( PROPERTY_BASE* aProperty );
/** /**
* Replaces an existing property for a specific type. * Replace an existing property for a specific type.
* *
* It is used to modify a property that has been inherited from a base class. * It is used to modify a property that has been inherited from a base class.
* This method is used instead of AddProperty(). * This method is used instead of AddProperty().
@ -140,14 +142,14 @@ public:
void ReplaceProperty( size_t aBase, const wxString& aName, PROPERTY_BASE* aNew ); void ReplaceProperty( size_t aBase, const wxString& aName, PROPERTY_BASE* aNew );
/** /**
* Registers a type converter. Required prior TypeCast() usage. * Register a type converter. Required prior TypeCast() usage.
* *
* @param aCast is the type converter to register. * @param aCast is the type converter to register.
*/ */
void AddTypeCast( TYPE_CAST_BASE* aCast ); void AddTypeCast( TYPE_CAST_BASE* aCast );
/** /**
* Declares an inheritance relationship between types. * Declare an inheritance relationship between types.
* *
* @param aBase is the base type identifier (obtained using TYPE_HASH()). * @param aBase is the base type identifier (obtained using TYPE_HASH()).
* @param aDerived is the derived type identifier (obtained using TYPE_HASH()). * @param aDerived is the derived type identifier (obtained using TYPE_HASH()).
@ -155,7 +157,7 @@ public:
void InheritsAfter( TYPE_ID aDerived, TYPE_ID aBase ); void InheritsAfter( TYPE_ID aDerived, TYPE_ID aBase );
/** /**
* Returns true if aDerived is inherited from aBase. * Return true if aDerived is inherited from aBase.
*/ */
bool IsOfType( TYPE_ID aDerived, TYPE_ID aBase ) const; bool IsOfType( TYPE_ID aDerived, TYPE_ID aBase ) const;
@ -170,7 +172,7 @@ public:
} }
/** /**
* Rebuilds the list of all registered properties. Needs to be called * Rebuild the list of all registered properties. Needs to be called
* once before GetProperty()/GetProperties() are used. * once before GetProperty()/GetProperties() are used.
*/ */
void Rebuild(); void Rebuild();
@ -194,7 +196,7 @@ private:
{ {
} }
///> Structure holding type meta-data ///< Structure holding type meta-data
struct CLASS_DESC struct CLASS_DESC
{ {
CLASS_DESC( TYPE_ID aId ) CLASS_DESC( TYPE_ID aId )
@ -202,38 +204,38 @@ private:
{ {
} }
///> Unique type identifier (obtained using TYPE_HASH) ///< Unique type identifier (obtained using TYPE_HASH)
const TYPE_ID m_id; const TYPE_ID m_id;
///> Types after which this type inherits ///< Types after which this type inherits
std::vector<std::reference_wrapper<CLASS_DESC>> m_bases; std::vector<std::reference_wrapper<CLASS_DESC>> m_bases;
///> Properties unique to this type (i.e. not inherited) ///< Properties unique to this type (i.e. not inherited)
std::map<wxString, std::unique_ptr<PROPERTY_BASE>> m_ownProperties; std::map<wxString, std::unique_ptr<PROPERTY_BASE>> m_ownProperties;
///> Type converters available for this type ///< Type converters available for this type
std::map<TYPE_ID, std::unique_ptr<TYPE_CAST_BASE>> m_typeCasts; std::map<TYPE_ID, std::unique_ptr<TYPE_CAST_BASE>> m_typeCasts;
///> All properties (both unique to the type and inherited) ///< All properties (both unique to the type and inherited)
std::vector<PROPERTY_BASE*> m_allProperties; std::vector<PROPERTY_BASE*> m_allProperties;
///> Replaced properties (TYPE_ID / name) ///< Replaced properties (TYPE_ID / name)
PROPERTY_SET m_replaced; PROPERTY_SET m_replaced;
///> Recreates the list of properties ///< Recreates the list of properties
void rebuild(); void rebuild();
///> Traverses the class inheritance hierarchy bottom-to-top, gathering ///< Traverses the class inheritance hierarchy bottom-to-top, gathering
///> all properties available to a type ///< all properties available to a type
void collectPropsRecur( PROPERTY_LIST& aResult, PROPERTY_SET& aReplaced ) const; void collectPropsRecur( PROPERTY_LIST& aResult, PROPERTY_SET& aReplaced ) const;
}; };
///> Returns metadata for a specific type ///< Returns metadata for a specific type
CLASS_DESC& getClass( TYPE_ID aTypeId ); CLASS_DESC& getClass( TYPE_ID aTypeId );
std::unordered_map<TYPE_ID, wxString> m_classNames; std::unordered_map<TYPE_ID, wxString> m_classNames;
///> Map of all available types ///< Map of all available types
std::unordered_map<TYPE_ID, CLASS_DESC> m_classes; std::unordered_map<TYPE_ID, CLASS_DESC> m_classes;
/// Flag indicating that the list of properties needs to be rebuild (RebuildProperties()) /// Flag indicating that the list of properties needs to be rebuild (RebuildProperties())
@ -243,7 +245,7 @@ private:
}; };
///> Helper macro to map type hashes to names ///< Helper macro to map type hashes to names
#define REGISTER_TYPE(x) PROPERTY_MANAGER::Instance().RegisterType(TYPE_HASH(x), TYPE_NAME(x)) #define REGISTER_TYPE(x) PROPERTY_MANAGER::Instance().RegisterType(TYPE_HASH(x), TYPE_NAME(x))
#endif /* PROPERTY_MGR_H */ #endif /* PROPERTY_MGR_H */

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014-2015 CERN * Copyright (C) 2014-2015 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -49,7 +49,7 @@ public:
virtual void Popup( wxWindow* aFocus = nullptr ); virtual void Popup( wxWindow* aFocus = nullptr );
virtual void PopupFor( int aMsecs ); virtual void PopupFor( int aMsecs );
virtual void Move( const wxPoint &aWhere ); virtual void Move( const wxPoint& aWhere );
virtual void Move( const VECTOR2I& aWhere ); virtual void Move( const VECTOR2I& aWhere );
/** /**
@ -64,7 +64,7 @@ protected:
void onCharHook( wxKeyEvent& aEvent ); void onCharHook( wxKeyEvent& aEvent );
///> Expire timer even handler ///< Expire timer even handler
void onExpire( wxTimerEvent& aEvent ); void onExpire( wxTimerEvent& aEvent );
wxPanel* m_panel; wxPanel* m_panel;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2019 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2018 CERN * Copyright (C) 2018 CERN
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -150,16 +150,16 @@ public:
bool Validate( wxWindow* aParent ) override; bool Validate( wxWindow* aParent ) override;
protected: protected:
///> Compiles and stores a regular expression ///< Compiles and stores a regular expression
void compileRegEx( const wxString& aRegEx, int aFlags ); void compileRegEx( const wxString& aRegEx, int aFlags );
///> Original regular expression (for copy constructor) ///< Original regular expression (for copy constructor)
wxString m_regExString; wxString m_regExString;
///> Original compilation flags (for copy constructor) ///< Original compilation flags (for copy constructor)
int m_regExFlags; int m_regExFlags;
///> Compiled regex ///< Compiled regex
wxRegEx m_regEx; wxRegEx m_regEx;
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 2020 Ian McInerney <ian.s.mcinerney at ieee dot org> * Copyright (C) 2020 Ian McInerney <ian.s.mcinerney at ieee dot org>
* Copyright (C) 2020 Kicad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 Kicad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -102,19 +102,19 @@ protected:
} }
private: private:
///> Bitmap shown when button is enabled ///< Bitmap shown when button is enabled
wxBitmap m_normalBitmap; wxBitmap m_normalBitmap;
///> Bitmap shown when button is disabled ///< Bitmap shown when button is disabled
wxBitmap m_disabledBitmap; wxBitmap m_disabledBitmap;
///> Current state of the button ///< Current state of the button
int m_buttonState; int m_buttonState;
///> Padding on each side of the bitmap ///< Padding on each side of the bitmap
int m_padding; int m_padding;
///> Size without the padding ///< Size without the padding
wxSize m_unadjustedMinSize; wxSize m_unadjustedMinSize;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com> * @author Jon Evans <jon@craftyjon.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -43,13 +43,13 @@ class BITMAP_TOGGLE : public wxPanel
public: public:
BITMAP_TOGGLE() {} BITMAP_TOGGLE() {}
BITMAP_TOGGLE( wxWindow *aParent, wxWindowID aId, const wxBitmap& aCheckedBitmap, BITMAP_TOGGLE( wxWindow* aParent, wxWindowID aId, const wxBitmap& aCheckedBitmap,
const wxBitmap& aUncheckedBitmap, bool aChecked = false ); const wxBitmap& aUncheckedBitmap, bool aChecked = false );
///> Set the checkbox state ///< Set the checkbox state
void SetValue( bool aValue ); void SetValue( bool aValue );
///> Read the checkbox state ///< Read the checkbox state
bool GetValue() const { return m_checked; } bool GetValue() const { return m_checked; }
private: private:
@ -57,10 +57,10 @@ private:
wxStaticBitmap* m_bitmap; wxStaticBitmap* m_bitmap;
///> Bitmap to display in unchecked state ///< Bitmap to display in unchecked state
wxBitmap m_unchecked_bitmap; wxBitmap m_unchecked_bitmap;
///> Bitmap to display in checked state ///< Bitmap to display in checked state
wxBitmap m_checked_bitmap; wxBitmap m_checked_bitmap;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -50,7 +50,6 @@ public:
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
private: private:
wxBoxSizer* m_mainSizer; wxBoxSizer* m_mainSizer;
wxRadioBox* m_gridStyle; wxRadioBox* m_gridStyle;
@ -70,7 +69,7 @@ private:
wxRadioBox* m_cursorShape; wxRadioBox* m_cursorShape;
wxCheckBox* m_forceCursorDisplay; wxCheckBox* m_forceCursorDisplay;
///> The GAL options to read/write ///< The GAL options to read/write
KIGFX::GAL_DISPLAY_OPTIONS& m_galOptions; KIGFX::GAL_DISPLAY_OPTIONS& m_galOptions;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -53,7 +53,7 @@ public:
virtual ~ICON_PROVIDER() {}; virtual ~ICON_PROVIDER() {};
/** /**
* Gets a reference to the row icon in the given mode * Get a reference to the row icon in the given mode.
* *
* @param aIconId the id of the icon to get (depends on the * @param aIconId the id of the icon to get (depends on the
* provider). * provider).
@ -63,7 +63,7 @@ public:
/** /**
* Accessor for the default icon providers, which take * Accessor for the default icon providers, which take
* true and false for IDs, meaining on/off. * true and false for IDs, meaning on/off.
* *
* @param aAlternative false for blue arrow/blank, true for the * @param aAlternative false for blue arrow/blank, true for the
* green diamond * green diamond
@ -82,7 +82,7 @@ public:
ICON_ID aInitialIcon, int aID ); ICON_ID aInitialIcon, int aID );
/** /**
* Sets the row indiciator to the given state * Set the row indicator to the given state.
* *
* @param aIconId the icon ID to pass to the provider. * @param aIconId the icon ID to pass to the provider.
*/ */
@ -96,34 +96,33 @@ public:
private: private:
///> An class that delivers icons for the indictor (currently just ///< An class that delivers icons for the indicator (currently just
///> uses a default implementation). ///< uses a default implementation).
ICON_PROVIDER& m_iconProvider; ICON_PROVIDER& m_iconProvider;
///> Handle on the bitmap widget ///< Handle on the bitmap widget
wxStaticBitmap* m_bitmap; wxStaticBitmap* m_bitmap;
///> Is the icon currently "on" ///< Is the icon currently "on"
ICON_ID m_currentId; ICON_ID m_currentId;
}; };
/** /**
* Icon provider for the "standard" row indicators, for example in * Icon provider for the "standard" row indicators, for example in layer selection lists
* layer selection lists
*/ */
class ROW_ICON_PROVIDER: public INDICATOR_ICON::ICON_PROVIDER class ROW_ICON_PROVIDER: public INDICATOR_ICON::ICON_PROVIDER
{ {
public: public:
///> State constants to select the right icons ///< State constants to select the right icons
enum STATE enum STATE
{ {
OFF, ///> Row "off" or "deselected" OFF, ///< Row "off" or "deselected"
DIMMED, ///> Row "dimmed" DIMMED, ///< Row "dimmed"
ON, ///> Row "on" or "selected" ON, ///< Row "on" or "selected"
UP, ///> Row above design alpha UP, ///< Row above design alpha
DOWN, ///> Row below design alpha DOWN, ///< Row below design alpha
}; };
/** /**
@ -132,7 +131,7 @@ public:
*/ */
ROW_ICON_PROVIDER( int aSize ); ROW_ICON_PROVIDER( int aSize );
///> @copydoc INDICATOR_ICON::ICON_PROVIDER::GetIndicatorIcon() ///< @copydoc INDICATOR_ICON::ICON_PROVIDER::GetIndicatorIcon()
const wxBitmap& GetIndicatorIcon( INDICATOR_ICON::ICON_ID aIconId ) const override; const wxBitmap& GetIndicatorIcon( INDICATOR_ICON::ICON_ID aIconId ) const override;
private: private:
@ -144,5 +143,4 @@ private:
}; };
#endif // ROW_INDICATOR__H_ #endif // ROW_INDICATOR__H_

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org> * Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -42,7 +42,7 @@ class LIB_TABLE;
class LIB_TREE : public wxPanel class LIB_TREE : public wxPanel
{ {
public: public:
///> Flags to select extra widgets ///< Flags to select extra widgets
enum WIDGETS { NONE = 0x00, SEARCH = 0x01, DETAILS = 0x02, ALL = 0xFF }; enum WIDGETS { NONE = 0x00, SEARCH = 0x01, DETAILS = 0x02, ALL = 0xFF };
/** /**
@ -80,7 +80,7 @@ public:
void SelectLibId( const LIB_ID& aLibId ); void SelectLibId( const LIB_ID& aLibId );
/** /**
* Ensure that an item is visible (preferrably centered). * Ensure that an item is visible (preferably centered).
*/ */
void CenterLibId( const LIB_ID& aLibId ); void CenterLibId( const LIB_ID& aLibId );
@ -95,7 +95,7 @@ public:
void ExpandLibId( const LIB_ID& aLibId ); void ExpandLibId( const LIB_ID& aLibId );
/** /**
* Regenerates the tree. * Regenerate the tree.
*/ */
void Regenerate( bool aKeepState ); void Regenerate( bool aKeepState );
@ -108,7 +108,7 @@ public:
protected: protected:
/** /**
* Expands or collapses a node, switching it to the opposite state. * Expand or collapse a node, switching it to the opposite state.
*/ */
void toggleExpand( const wxDataViewItem& aTreeId ); void toggleExpand( const wxDataViewItem& aTreeId );
@ -137,21 +137,21 @@ protected:
*/ */
struct STATE struct STATE
{ {
///> List of expanded nodes ///< List of expanded nodes
std::vector<wxDataViewItem> expanded; std::vector<wxDataViewItem> expanded;
std::vector<wxString> pinned; std::vector<wxString> pinned;
///> Current selection, might be not valid if nothing was selected ///< Current selection, might be not valid if nothing was selected
LIB_ID selection; LIB_ID selection;
}; };
/** /**
* Returns the component tree widget state. * Return the component tree widget state.
*/ */
STATE getState() const; STATE getState() const;
/** /**
* Restores the component tree widget state from an object. * Restore the component tree widget state from an object.
*/ */
void setState( const STATE& aState ); void setState( const STATE& aState );
@ -176,10 +176,10 @@ protected:
wxHtmlWindow* m_details_ctrl; wxHtmlWindow* m_details_ctrl;
}; };
///> Custom event sent when a new component is preselected ///< Custom event sent when a new component is preselected
wxDECLARE_EVENT( COMPONENT_PRESELECTED, wxCommandEvent ); wxDECLARE_EVENT( COMPONENT_PRESELECTED, wxCommandEvent );
///> Custom event sent when a component is selected ///< Custom event sent when a component is selected
wxDECLARE_EVENT( COMPONENT_SELECTED, wxCommandEvent ); wxDECLARE_EVENT( COMPONENT_SELECTED, wxCommandEvent );
#endif /* LIB_TREE_H */ #endif /* LIB_TREE_H */

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017-2018 CERN * Copyright (C) 2017-2021 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -39,24 +39,24 @@ class TEXT_CTRL_EVAL : public wxTextCtrl
{ {
public: public:
TEXT_CTRL_EVAL( wxWindow* aParent, wxWindowID aId, const wxString& aValue = wxEmptyString, TEXT_CTRL_EVAL( wxWindow* aParent, wxWindowID aId, const wxString& aValue = wxEmptyString,
const wxPoint& aPos = wxDefaultPosition, const wxSize& aSize = wxDefaultSize, const wxPoint& aPos = wxDefaultPosition, const wxSize& aSize = wxDefaultSize,
long aStyle = 0, const wxValidator& aValidator = wxDefaultValidator, long aStyle = 0, const wxValidator& aValidator = wxDefaultValidator,
const wxString& aName = wxTextCtrlNameStr ); const wxString& aName = wxTextCtrlNameStr );
virtual ~TEXT_CTRL_EVAL() virtual ~TEXT_CTRL_EVAL()
{ {
} }
/** /**
* Set a new value in evaluator buffer, and display it * Set a new value in evaluator buffer, and display it in the wxTextCtrl.
* in the wxTextCtrl. *
* @param aValue is the new value to store and display * @param aValue is the new value to store and display
* if aValue is empty, the value "0" is stored and displayed * if aValue is empty, the value "0" is stored and displayed
*/ */
void SetValue( const wxString& aValue ) override; void SetValue( const wxString& aValue ) override;
protected: protected:
///> Numeric expression evaluator ///< Numeric expression evaluator
NUMERIC_EVALUATOR m_eval; NUMERIC_EVALUATOR m_eval;
void onTextFocusGet( wxFocusEvent& aEvent ); void onTextFocusGet( wxFocusEvent& aEvent );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014-2015 CERN * Copyright (C) 2014-2015 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Maciej Suminski <maciej.suminski@cern.ch> * Author: Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -43,7 +43,6 @@ class UNIT_BINDER : public wxEvtHandler
public: public:
/** /**
* Constructor.
* @param aParent is the parent EDA_DRAW_FRAME. * @param aParent is the parent EDA_DRAW_FRAME.
* @param aLabel is the static text used to label the text input widget (note: the label * @param aLabel is the static text used to label the text input widget (note: the label
* text, trimmed of its colon, will also be used in error messages) * text, trimmed of its colon, will also be used in error messages)
@ -81,8 +80,8 @@ public:
void SetDataType( EDA_DATA_TYPE aDataType ); void SetDataType( EDA_DATA_TYPE aDataType );
/** /**
* Function SetValue * Set new value (in Internal Units) for the text field, taking care of units conversion.
* Sets new value (in Internal Units) for the text field, taking care of units conversion. *
* @param aValue is the new value. * @param aValue is the new value.
*/ */
virtual void SetValue( int aValue ); virtual void SetValue( int aValue );
@ -90,8 +89,8 @@ public:
void SetValue( wxString aValue ); void SetValue( wxString aValue );
/** /**
* Function SetDoubleValue * Set new value (in Internal Units) for the text field, taking care of units conversion.
* Sets new value (in Internal Units) for the text field, taking care of units conversion. *
* @param aValue is the new value. * @param aValue is the new value.
* the initialized value will be truncated according to the precision set by SetPrecision() * the initialized value will be truncated according to the precision set by SetPrecision()
* (if not <= 0) * (if not <= 0)
@ -99,9 +98,9 @@ public:
virtual void SetDoubleValue( double aValue ); virtual void SetDoubleValue( double aValue );
/** /**
* Function ChangeValue * Change the value (in Internal Units) for the text field, taking care of units conversion
* Changes the value (in Internal Units) for the text field, taking care of units conversion
* but does not trigger the update routine * but does not trigger the update routine
*
* @param aValue is the new value. * @param aValue is the new value.
*/ */
virtual void ChangeValue( int aValue ); virtual void ChangeValue( int aValue );
@ -109,36 +108,32 @@ public:
void ChangeValue( const wxString& aValue ); void ChangeValue( const wxString& aValue );
/** /**
* Function GetValue * Return the current value in Internal Units.
* Returns the current value in Internal Units.
*/ */
virtual long long int GetValue(); virtual long long int GetValue();
/** /**
* Function GetValue * Return the current value in Internal Units.
* Returns the current value in Internal Units. *
* the returned value will be truncated according to the precision set by * The returned value will be truncated according to the precision set by
* SetPrecision() (if not <= 0) * SetPrecision() (if not <= 0)
*/ */
virtual double GetDoubleValue(); virtual double GetDoubleValue();
/** /**
* Function IsIndeterminate * Return true if the control holds the indeterminate value (for instance, if it
* Returns true if the control holds the indeterminate value (for instance, if it
* represents a multiple selection of differing values). * represents a multiple selection of differing values).
*/ */
bool IsIndeterminate() const; bool IsIndeterminate() const;
/** /**
* Function GetOriginalText * Return the pre-evaluated text (or the current text if evaluation is not supported).
* Returns the pre-evaluated text (or the current text if evaluation is not supported).
* Used primarily to remember values between dialog invocations. * Used primarily to remember values between dialog invocations.
*/ */
wxString GetOriginalText() const; wxString GetOriginalText() const;
/** /**
* Function Validate * Validate the control against the given range, informing the user of any errors found.
* Validates the control against the given range, informing the user of any errors found.
* *
* @param aMin a minimum value for validation * @param aMin a minimum value for validation
* @param aMax a maximum value for validation * @param aMax a maximum value for validation
@ -150,14 +145,12 @@ public:
void SetLabel( const wxString& aLabel ); void SetLabel( const wxString& aLabel );
/** /**
* Function Enable * Enable/disable the label, widget and units label.
* Enables/diasables the label, widget and units label.
*/ */
void Enable( bool aEnable ); void Enable( bool aEnable );
/** /**
* Function Show * Show/hide the label, widget and units label.
* Shows/hides the label, widget and units label.
* *
* @param aShow called for the Show() routine in wx * @param aShow called for the Show() routine in wx
* @param aResize if true, the element will be sized to 0 on hide and -1 on show * @param aResize if true, the element will be sized to 0 on hide and -1 on show
@ -175,8 +168,7 @@ public:
} }
/** /**
* Function SetOriginTransform * Set the current origin transform mode
* Sets the current origin transform mode
*/ */
void SetCoordType( ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType ) void SetCoordType( ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType )
{ {
@ -191,10 +183,12 @@ protected:
void onUnitsChanged( wxCommandEvent& aEvent ); void onUnitsChanged( wxCommandEvent& aEvent );
/** When m_precision > 0 truncate the value aValue to show only /**
* When m_precision > 0 truncate the value aValue to show only
* m_precision digits in mantissa. * m_precision digits in mantissa.
* used in GetDoubleValue to return a rounded value. * used in GetDoubleValue to return a rounded value.
* Mainly for units set to DEGREES. * Mainly for units set to DEGREES.
*
* @param aValue is the value to modify. * @param aValue is the value to modify.
* @param aValueUsesUserUnits must be set to true if aValue is a user value, * @param aValueUsesUserUnits must be set to true if aValue is a user value,
* and set to false if aValue is a internal unit value. * and set to false if aValue is a internal unit value.
@ -204,25 +198,25 @@ protected:
EDA_DRAW_FRAME* m_frame; EDA_DRAW_FRAME* m_frame;
///> The bound widgets ///< The bound widgets
wxStaticText* m_label; wxStaticText* m_label;
wxWindow* m_valueCtrl; wxWindow* m_valueCtrl;
wxStaticText* m_unitLabel; // Can be nullptr wxStaticText* m_unitLabel; // Can be nullptr
///> Currently used units. ///< Currently used units.
EDA_UNITS m_units; EDA_UNITS m_units;
EDA_DATA_TYPE m_dataType; EDA_DATA_TYPE m_dataType;
int m_precision; // 0 to 6 int m_precision; // 0 to 6
///> Validation support. ///< Validation support.
wxString m_errorMessage; wxString m_errorMessage;
///> Evaluator ///< Evaluator
NUMERIC_EVALUATOR m_eval; NUMERIC_EVALUATOR m_eval;
bool m_allowEval; bool m_allowEval;
bool m_needsEval; bool m_needsEval;
///> Selection start and end of the original text ///< Selection start and end of the original text
long m_selStart; long m_selStart;
long m_selEnd; long m_selEnd;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2019-2021 KiCad Developers, see CHANGELOG.TXT for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -45,8 +45,8 @@ public:
WX_BUSY_INDICATOR(); WX_BUSY_INDICATOR();
private: private:
///> This is the actual WX cursor that is the indicator. ///< This is the actual WX cursor that is the indicator.
std::unique_ptr<wxBusyCursor> m_cursor; std::unique_ptr<wxBusyCursor> m_cursor;
}; };
#endif // COMMON_WIDGETS_WX_BUSY_INDICATOR__H #endif // COMMON_WIDGETS_WX_BUSY_INDICATOR__H

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -30,6 +30,7 @@
/** /**
* Bezier curves to polygon converter. * Bezier curves to polygon converter.
*
* Only quadratic and cubic Bezier curves are handled * Only quadratic and cubic Bezier curves are handled
*/ */
class BEZIER_POLY class BEZIER_POLY
@ -44,9 +45,10 @@ public:
} }
/** /**
* Converts Bezier curve to a polygon. * Convert a Bezier curve to a polygon.
*
* @param aOutput will be used as an output vector storing polygon points. * @param aOutput will be used as an output vector storing polygon points.
* @param aMinSegLen is the min dist between 2 successve points. * @param aMinSegLen is the min dist between 2 successive points.
* It can be used to reduce the number of points. * It can be used to reduce the number of points.
* (the last point is always generated) * (the last point is always generated)
*/ */
@ -56,7 +58,7 @@ public:
private: private:
double m_minSegLen; double m_minSegLen;
///> Control points ///< Control points
std::vector<VECTOR2D> m_ctrlPts; std::vector<VECTOR2D> m_ctrlPts;
}; };

View File

@ -2,8 +2,9 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013-2015 CERN * Copyright (C) 2013-2015 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors. *
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -30,18 +31,18 @@
#undef Opposite #undef Opposite
/** /**
* DIRECTION_45. * Represent route directions & corner angles in a 45-degree metric.
* Represents route directions & corner angles in a 45-degree metric.
*/ */
class DIRECTION_45 class DIRECTION_45
{ {
public: public:
/** /**
* Represents available directions - there are 8 of them, as on a rectilinear map (north = up) + * Available directions, there are 8 of them, as on a rectilinear map (north = up) +
* an extra undefined direction, reserved for traces that don't respect 45-degree routing regime. * an extra undefined direction, reserved for traces that don't respect 45-degree routing
* NOTE: North represents "up" to the user looking at the application, which is the negative-y * regime.
*
* @note North represents "up" to the user looking at the application, which is the negative-y
* direction in the world coordinate space! * direction in the world coordinate space!
*/ */
enum Directions : int enum Directions : int
@ -59,8 +60,7 @@ public:
}; };
/** /**
* Enum AngleType * Represent kind of angle formed by vectors heading in two DIRECTION_45s.
* Represents kind of angle formed by vectors heading in two DIRECTION_45s.
*/ */
enum AngleType enum AngleType
{ {
@ -75,7 +75,6 @@ public:
DIRECTION_45( Directions aDir = UNDEFINED ) : m_dir( aDir ), m_90deg( false ) {} DIRECTION_45( Directions aDir = UNDEFINED ) : m_dir( aDir ), m_90deg( false ) {}
/** /**
* Constructor
* @param aVec vector in world space, whose direction will be translated into a DIRECTION_45. * @param aVec vector in world space, whose direction will be translated into a DIRECTION_45.
*/ */
DIRECTION_45( const VECTOR2I &aVec, bool a90 = false ) : DIRECTION_45( const VECTOR2I &aVec, bool a90 = false ) :
@ -87,7 +86,6 @@ public:
} }
/** /**
* Constructor
* @param aSeg segment, whose direction will be translated into a DIRECTION_45. * @param aSeg segment, whose direction will be translated into a DIRECTION_45.
*/ */
DIRECTION_45( const SEG& aSeg, bool a90 = false ) : DIRECTION_45( const SEG& aSeg, bool a90 = false ) :
@ -99,7 +97,8 @@ public:
} }
/** /**
* Creates a DIRECTION_45 from the endpoints of a given arc * Create a DIRECTION_45 from the endpoints of a given arc.
*
* @param aArc will be translated into the closest DIRECTION_45 * @param aArc will be translated into the closest DIRECTION_45
*/ */
DIRECTION_45( const SHAPE_ARC& aArc, bool a90 = false ) : DIRECTION_45( const SHAPE_ARC& aArc, bool a90 = false ) :
@ -111,8 +110,8 @@ public:
} }
/** /**
* Function Format() * Format the direction in a human readable word.
* Formats the direction in a human readable word. *
* @return name of the direction * @return name of the direction
*/ */
const std::string Format() const const std::string Format() const
@ -152,8 +151,8 @@ public:
} }
/** /**
* Function Opposite() * Return a direction opposite (180 degree) to (this).
* Returns a direction opposite (180 degree) to (this) *
* @return opposite direction * @return opposite direction
*/ */
DIRECTION_45 Opposite() const DIRECTION_45 Opposite() const
@ -163,8 +162,8 @@ public:
} }
/** /**
* Function Angle() * Return the type of angle between directions (this) and \a aOther.
* Returns the type of angle between directions (this) and aOther. *
* @param aOther direction to compare angle with * @param aOther direction to compare angle with
*/ */
AngleType Angle( const DIRECTION_45& aOther ) const AngleType Angle( const DIRECTION_45& aOther ) const
@ -187,8 +186,7 @@ public:
} }
/** /**
* Function IsObtuse() * @return true, when (this) forms an obtuse angle with \a aOther.
* @return true, when (this) forms an obtuse angle with aOther
*/ */
bool IsObtuse( const DIRECTION_45& aOther ) const bool IsObtuse( const DIRECTION_45& aOther ) const
{ {
@ -196,8 +194,8 @@ public:
} }
/** /**
* Function IsDiagonal() * Returns true if the direction is diagonal (e.g. North-West, South-East, etc).
* Returns true if the direction is diagonal (e.g. North-West, South-East, etc) *
* @return true, when diagonal. * @return true, when diagonal.
*/ */
bool IsDiagonal() const bool IsDiagonal() const
@ -211,8 +209,9 @@ public:
} }
/** /**
* Builds a 2-segment line chain between points aP0 and aP1 and following 45-degree routing * Build a 2-segment line chain between points aP0 and aP1 and following 45-degree routing
* regime. If aStartDiagonal is true, the trace starts with a diagonal segment. * regime. If aStartDiagonal is true, the trace starts with a diagonal segment.
*
* @param aP0 starting point * @param aP0 starting point
* @param aP1 ending point * @param aP1 ending point
* @param aStartDiagonal whether the first segment has to be diagonal * @param aStartDiagonal whether the first segment has to be diagonal
@ -234,10 +233,7 @@ public:
} }
/** /**
* Function Right() * Return the direction on the right side of this (i.e. turns right by 45 or 90 deg).
*
* Returns the direction on the right side of this (i.e. turns right
* by 45 or 90 deg)
*/ */
const DIRECTION_45 Right() const const DIRECTION_45 Right() const
{ {
@ -255,10 +251,7 @@ public:
} }
/** /**
* Function Left() * Return the direction on the left side of this (i.e. turns left by 45 or 90 deg).
*
* Returns the direction on the left side of this (i.e. turns left
* by 45 or 90 deg)
*/ */
const DIRECTION_45 Left() const const DIRECTION_45 Left() const
{ {
@ -304,9 +297,9 @@ public:
private: private:
/** /**
* Function construct() * Calculate the direction from a vector. If the vector's angle is not a multiple of 45
* Calculates the direction from a vector. If the vector's angle is not a multiple of 45
* degrees, the direction is rounded to the nearest octant. * degrees, the direction is rounded to the nearest octant.
*
* @param aVec our vector * @param aVec our vector
*/ */
void construct_( const VECTOR2I& aVec ) void construct_( const VECTOR2I& aVec )
@ -337,10 +330,10 @@ private:
return; return;
} }
///> our actual direction ///< our actual direction
Directions m_dir; Directions m_dir;
///> Are we routing on 45 or 90 degree increments ///< Are we routing on 45 or 90 degree increments
bool m_90deg; bool m_90deg;
}; };

View File

@ -2,9 +2,10 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
@ -48,8 +49,8 @@ public:
VECTOR2I A; VECTOR2I A;
VECTOR2I B; VECTOR2I B;
/** Default constructor /**
* Creates an empty (0, 0) segment * Create an empty (0, 0) segment.
*/ */
SEG() SEG()
{ {
@ -57,8 +58,7 @@ public:
} }
/** /**
* Constructor * Create a segment between (aX1, aY1) and (aX2, aY2).
* Creates a segment between (aX1, aY1) and (aX2, aY2)
*/ */
SEG( int aX1, int aY1, int aX2, int aY2 ) : SEG( int aX1, int aY1, int aX2, int aY2 ) :
A( VECTOR2I( aX1, aY1 ) ), A( VECTOR2I( aX1, aY1 ) ),
@ -68,8 +68,7 @@ public:
} }
/** /**
* Constructor * Create a segment between (aA) and (aB).
* Creates a segment between (aA) and (aB)
*/ */
SEG( const VECTOR2I& aA, const VECTOR2I& aB ) : SEG( const VECTOR2I& aA, const VECTOR2I& aB ) :
A( aA ), A( aA ),
@ -79,8 +78,8 @@ public:
} }
/** /**
* Constructor * Create a segment between (aA) and (aB), referenced to a multi-segment shape.
* Creates a segment between (aA) and (aB), referenced to a multi-segment shape *
* @param aA reference to the start point in the parent shape * @param aA reference to the start point in the parent shape
* @param aB reference to the end point in the parent shape * @param aB reference to the end point in the parent shape
* @param aIndex index of the segment within the parent shape * @param aIndex index of the segment within the parent shape
@ -93,7 +92,7 @@ public:
} }
/** /**
* Copy constructor * Copy constructor.
*/ */
SEG( const SEG& aSeg ) : SEG( const SEG& aSeg ) :
A( aSeg.A ), A( aSeg.A ),
@ -127,19 +126,17 @@ public:
} }
/** /**
* Function LineProject() * Compute the perpendicular projection point of aP on a line passing through
*
* Computes the perpendicular projection point of aP on a line passing through
* ends of the segment. * ends of the segment.
*
* @param aP point to project * @param aP point to project
* @return projected point * @return projected point
*/ */
VECTOR2I LineProject( const VECTOR2I& aP ) const; VECTOR2I LineProject( const VECTOR2I& aP ) const;
/** /**
* Function Side() * Determine on which side of directed line passing via segment ends point aP lies.
* *
* Determines on which side of directed line passing via segment ends point aP lies.
* @param aP point to determine the orientation wrs to self * @param aP point to determine the orientation wrs to self
* @return: < 0: left, 0 : on the line, > 0 : right * @return: < 0: left, 0 : on the line, > 0 : right
*/ */
@ -151,10 +148,9 @@ public:
} }
/** /**
* Function LineDistance() * Return the closest Euclidean distance between point aP and the line defined by
*
* Returns the closest Euclidean distance between point aP and the line defined by
* the ends of segment (this). * the ends of segment (this).
*
* @param aP the point to test * @param aP the point to test
* @param aDetermineSide: when true, the sign of the returned value indicates * @param aDetermineSide: when true, the sign of the returned value indicates
* the side of the line at which we are (negative = left) * the side of the line at which we are (negative = left)
@ -163,23 +159,22 @@ public:
int LineDistance( const VECTOR2I& aP, bool aDetermineSide = false ) const; int LineDistance( const VECTOR2I& aP, bool aDetermineSide = false ) const;
/** /**
* Function NearestPoint() * Compute a point on the segment (this) that is closest to point \a aP.
* *
* Computes a point on the segment (this) that is closest to point aP.
* @return the nearest point * @return the nearest point
*/ */
const VECTOR2I NearestPoint( const VECTOR2I &aP ) const; const VECTOR2I NearestPoint( const VECTOR2I &aP ) const;
/** /**
* Computes a point on the segment (this) that is closest to any point on aSeg. * Compute a point on the segment (this) that is closest to any point on \a aSeg.
*
* @return the nearest point * @return the nearest point
*/ */
const VECTOR2I NearestPoint( const SEG &aSeg ) const; const VECTOR2I NearestPoint( const SEG &aSeg ) const;
/** /**
* Function Intersect() * Compute intersection point of segment (this) with segment \a aSeg.
* *
* Computes intersection point of segment (this) with segment aSeg.
* @param aSeg: segment to intersect with * @param aSeg: segment to intersect with
* @param aIgnoreEndpoints: don't treat corner cases (i.e. end of one segment touching the * @param aIgnoreEndpoints: don't treat corner cases (i.e. end of one segment touching the
* other) as intersections. * other) as intersections.
@ -190,9 +185,8 @@ public:
bool aLines = false ) const; bool aLines = false ) const;
/** /**
* Function IntersectLines() * Compute the intersection point of lines passing through ends of (this) and \a aSeg.
* *
* Computes the intersection point of lines passing through ends of (this) and aSeg
* @param aSeg segment defining the line to intersect with * @param aSeg segment defining the line to intersect with
* @return intersection point, if exists * @return intersection point, if exists
*/ */
@ -202,18 +196,16 @@ public:
} }
/** /**
* Function PerpendicularSeg() * Compute a segment perpendicular to this one, passing through point \a aP.
* *
* Computes a segment perpendicular to this one, passing through point aP
* @param aP Point through which the new segment will pass * @param aP Point through which the new segment will pass
* @return SEG perpendicular to this passing through point aP * @return SEG perpendicular to this passing through point aP
*/ */
SEG PerpendicularSeg( const VECTOR2I& aP ) const; SEG PerpendicularSeg( const VECTOR2I& aP ) const;
/** /**
* Function ParallelSeg() * Compute a segment parallel to this one, passing through point \a aP.
* *
* Computes a segment parallel to this one, passing through point aP
* @param aP Point through which the new segment will pass * @param aP Point through which the new segment will pass
* @return SEG parallel to this passing through point aP * @return SEG parallel to this passing through point aP
*/ */
@ -224,9 +216,8 @@ public:
ecoord SquaredDistance( const SEG& aSeg ) const; ecoord SquaredDistance( const SEG& aSeg ) const;
/** /**
* Function Distance() * Compute minimum Euclidean distance to segment \a aSeg.
* *
* Computes minimum Euclidean distance to segment aSeg.
* @param aSeg other segment * @param aSeg other segment
* @return minimum distance * @return minimum distance
*/ */
@ -241,9 +232,8 @@ public:
} }
/** /**
* Function Distance() * Compute minimum Euclidean distance to point \a aP.
* *
* Computes minimum Euclidean distance to point aP.
* @param aP the point * @param aP the point
* @return minimum distance * @return minimum distance
*/ */
@ -260,10 +250,9 @@ public:
} }
/** /**
* Function Collinear() * Check if segment aSeg lies on the same line as (this).
* *
* Checks if segment aSeg lies on the same line as (this). * @param aSeg the segment to check colinearity with
* @param aSeg the segment to chech colinearity with
* @return true, when segments are collinear. * @return true, when segments are collinear.
*/ */
bool Collinear( const SEG& aSeg ) const bool Collinear( const SEG& aSeg ) const
@ -299,7 +288,6 @@ public:
return std::abs( dist1 - dist2 ) <= 1; return std::abs( dist1 - dist2 ) <= 1;
} }
bool ApproxPerpendicular( const SEG& aSeg ) const bool ApproxPerpendicular( const SEG& aSeg ) const
{ {
SEG perp = PerpendicularSeg( A ); SEG perp = PerpendicularSeg( A );
@ -345,9 +333,8 @@ public:
} }
/** /**
* Function Length() * Return the length (this).
* *
* Returns the length (this)
* @return length * @return length
*/ */
int Length() const int Length() const
@ -363,9 +350,9 @@ public:
ecoord TCoef( const VECTOR2I& aP ) const; ecoord TCoef( const VECTOR2I& aP ) const;
/** /**
* Function Index() * Return the index of this segment in its parent shape (applicable only to non-local
* segments).
* *
* Return the index of this segment in its parent shape (applicable only to non-local segments)
* @return index value * @return index value
*/ */
int Index() const int Index() const
@ -385,7 +372,7 @@ public:
return SEG( B, A ); return SEG( B, A );
} }
///> Returns the center point of the line ///< Returns the center point of the line
VECTOR2I Center() const VECTOR2I Center() const
{ {
return A + ( B - A ) / 2; return A + ( B - A ) / 2;
@ -395,7 +382,7 @@ private:
bool ccw( const VECTOR2I& aA, const VECTOR2I& aB, const VECTOR2I &aC ) const; bool ccw( const VECTOR2I& aA, const VECTOR2I& aB, const VECTOR2I &aC ) const;
private: private:
///> index withing the parent shape (used when m_is_local == false) ///< index withing the parent shape (used when m_is_local == false)
int m_index; int m_index;
}; };

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -34,22 +35,21 @@
class SHAPE_LINE_CHAIN; class SHAPE_LINE_CHAIN;
/** /**
* Enum SHAPE_TYPE * Lists all supported shapes.
* Lists all supported shapes
*/ */
enum SHAPE_TYPE enum SHAPE_TYPE
{ {
SH_RECT = 0, ///> axis-aligned rectangle SH_RECT = 0, ///< axis-aligned rectangle
SH_SEGMENT, ///> line segment SH_SEGMENT, ///< line segment
SH_LINE_CHAIN, ///> line chain (polyline) SH_LINE_CHAIN, ///< line chain (polyline)
SH_CIRCLE, ///> circle SH_CIRCLE, ///< circle
SH_SIMPLE, ///> simple polygon SH_SIMPLE, ///< simple polygon
SH_POLY_SET, ///> set of polygons (with holes, etc.) SH_POLY_SET, ///< set of polygons (with holes, etc.)
SH_COMPOUND, ///> compound shape, consisting of multiple simple shapes SH_COMPOUND, ///< compound shape, consisting of multiple simple shapes
SH_ARC, ///> circular arc SH_ARC, ///< circular arc
SH_NULL, ///> empty shape (no shape...), SH_NULL, ///< empty shape (no shape...),
SH_POLY_SET_TRIANGLE ///> a single triangle belonging to a POLY_SET triangulation SH_POLY_SET_TRIANGLE ///< a single triangle belonging to a POLY_SET triangulation
}; };
static inline wxString SHAPE_TYPE_asString( SHAPE_TYPE a ) static inline wxString SHAPE_TYPE_asString( SHAPE_TYPE a )
@ -77,23 +77,18 @@ class SHAPE_BASE
{ {
public: public:
/** /**
* Constructor * Create an empty shape of type aType
*
* Creates an empty shape of type aType
*/ */
SHAPE_BASE( SHAPE_TYPE aType ) : SHAPE_BASE( SHAPE_TYPE aType ) :
m_type( aType ) m_type( aType )
{} {}
// Destructor
virtual ~SHAPE_BASE() virtual ~SHAPE_BASE()
{} {}
/** /**
* Function Type() * Return the type of the shape.
* *
* Returns the type of the shape.
* @retval the type * @retval the type
*/ */
SHAPE_TYPE Type() const SHAPE_TYPE Type() const
@ -111,40 +106,34 @@ public:
virtual void GetIndexableSubshapes( std::vector<SHAPE*>& aSubshapes ) { } virtual void GetIndexableSubshapes( std::vector<SHAPE*>& aSubshapes ) { }
protected: protected:
///> type of our shape ///< type of our shape
SHAPE_TYPE m_type; SHAPE_TYPE m_type;
}; };
/** /**
* SHAPE * An abstract shape on 2D plane.
*
* Represents an abstract shape on 2D plane.
*/ */
class SHAPE : public SHAPE_BASE class SHAPE : public SHAPE_BASE
{ {
public: public:
/** /**
* @brief This is the minimum precision for all the points in a shape * This is the minimum precision for all the points in a shape.
*/ */
static const int MIN_PRECISION_IU = 4; static const int MIN_PRECISION_IU = 4;
/** /**
* Constructor * Create an empty shape of type \a aType.
*
* Creates an empty shape of type aType
*/ */
SHAPE( SHAPE_TYPE aType ) : SHAPE( SHAPE_TYPE aType ) :
SHAPE_BASE( aType ) SHAPE_BASE( aType )
{} {}
// Destructor
virtual ~SHAPE() virtual ~SHAPE()
{} {}
/** /**
* Function Clone() * Return a dynamically allocated copy of the shape.
* *
* Returns a dynamically allocated copy of the shape
* @retval copy of the shape * @retval copy of the shape
*/ */
virtual SHAPE* Clone() const virtual SHAPE* Clone() const
@ -154,9 +143,8 @@ public:
}; };
/** /**
* Function IsNull() * Return true if the shape is a null shape.
* *
* Returns true if the shape is a null shape.
* @retval true if null :-) * @retval true if null :-)
*/ */
bool IsNull() const bool IsNull() const
@ -165,10 +153,9 @@ public:
} }
/** /**
* Function Collide() * Check if the boundary of shape (this) lies closer to the point \a aP than \a aClearance,
*
* Checks if the boundary of shape (this) lies closer to the point aP than aClearance,
* indicating a collision. * indicating a collision.
*
* @param aActual [out] an optional pointer to an int to store the actual distance in the * @param aActual [out] an optional pointer to an int to store the actual distance in the
* event of a collision. * event of a collision.
* @param aLocation [out] an option pointer to a point to store a nearby location in the * @param aLocation [out] an option pointer to a point to store a nearby location in the
@ -182,10 +169,9 @@ public:
} }
/** /**
* Function Collide() * Check if the boundary of shape (this) lies closer to the shape \a aShape than \a aClearance,
*
* Checks if the boundary of shape (this) lies closer to the shape aShape than aClearance,
* indicating a collision. * indicating a collision.
*
* @param aShape shape to check collision against * @param aShape shape to check collision against
* @param aClearance minimum clearance * @param aClearance minimum clearance
* @param aMTV minimum translation vector * @param aMTV minimum translation vector
@ -201,10 +187,9 @@ public:
VECTOR2I* aLocation = nullptr ) const; VECTOR2I* aLocation = nullptr ) const;
/** /**
* Function Collide() * Check if the boundary of shape (this) lies closer to the segment \a aSeg than \a aClearance,
*
* Checks if the boundary of shape (this) lies closer to the segment aSeg than aClearance,
* indicating a collision. * indicating a collision.
*
* @param aActual [out] an optional pointer to an int to be updated with the actual distance * @param aActual [out] an optional pointer to an int to be updated with the actual distance
* int the event of a collision. * int the event of a collision.
* @param aLocation [out] an option pointer to a point to store a nearby location in the * @param aLocation [out] an option pointer to a point to store a nearby location in the
@ -215,20 +200,17 @@ public:
VECTOR2I* aLocation = nullptr ) const = 0; VECTOR2I* aLocation = nullptr ) const = 0;
/** /**
* Function BBox() * Compute a bounding box of the shape, with a margin of \a aClearance a collision.
* *
* Computes a bounding box of the shape, with a margin of aClearance * @param aClearance how much the bounding box is expanded wrs to the minimum enclosing
* a collision. * rectangle for the shape.
* @param aClearance how much the bounding box is expanded wrs to the minimum enclosing rectangle
* for the shape.
* @return the bounding box. * @return the bounding box.
*/ */
virtual const BOX2I BBox( int aClearance = 0 ) const = 0; virtual const BOX2I BBox( int aClearance = 0 ) const = 0;
/** /**
* Function Centre() * Compute a center-of-mass of the shape.
* *
* Computes a center-of-mass of the shape
* @return the center-of-mass point * @return the center-of-mass point
*/ */
virtual VECTOR2I Centre() const virtual VECTOR2I Centre() const
@ -237,9 +219,8 @@ public:
} }
/** /**
* Function Rotate * @param aCenter is the rotation center.
* @param aCenter is the rotation center * @param aAngle rotation angle in radians.
* @param aAngle rotation angle in radians
*/ */
virtual void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) = 0; virtual void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) = 0;
@ -264,15 +245,13 @@ public:
{ {
} }
// Destructor
virtual ~SHAPE_LINE_CHAIN_BASE() virtual ~SHAPE_LINE_CHAIN_BASE()
{ {
} }
/** /**
* Function Collide() * Check if point \a aP lies closer to us than \a aClearance.
* *
* Checks if point aP lies closer to us than aClearance.
* @param aP the point to check for collisions with * @param aP the point to check for collisions with
* @param aClearance minimum distance that does not qualify as a collision. * @param aClearance minimum distance that does not qualify as a collision.
* @param aActual an optional pointer to an int to store the actual distance in the event * @param aActual an optional pointer to an int to store the actual distance in the event
@ -283,9 +262,8 @@ public:
VECTOR2I* aLocation = nullptr ) const override; VECTOR2I* aLocation = nullptr ) const override;
/** /**
* Function Collide() * Check if segment \a aSeg lies closer to us than \a aClearance.
* *
* Checks if segment aSeg lies closer to us than aClearance.
* @param aSeg the segment to check for collisions with * @param aSeg the segment to check for collisions with
* @param aClearance minimum distance that does not qualify as a collision. * @param aClearance minimum distance that does not qualify as a collision.
* @param aActual an optional pointer to an int to store the actual distance in the event * @param aActual an optional pointer to an int to store the actual distance in the event
@ -299,10 +277,9 @@ public:
SEG::ecoord SquaredDistance( const VECTOR2I& aP, bool aOutlineOnly = false ) const; SEG::ecoord SquaredDistance( const VECTOR2I& aP, bool aOutlineOnly = false ) const;
/** /**
* Function PointInside() * Check if point \a aP lies inside a polygon (any type) defined by the line chain.
*
* Checks if point aP lies inside a polygon (any type) defined by the line chain.
* For closed shapes only. * For closed shapes only.
*
* @param aPt point to check * @param aPt point to check
* @param aUseBBoxCache gives better peformance if the bounding box caches have been * @param aUseBBoxCache gives better peformance if the bounding box caches have been
* generated. * generated.
@ -311,18 +288,16 @@ public:
bool PointInside( const VECTOR2I& aPt, int aAccuracy = 0, bool aUseBBoxCache = false ) const; bool PointInside( const VECTOR2I& aPt, int aAccuracy = 0, bool aUseBBoxCache = false ) const;
/** /**
* Function PointOnEdge() * Check if point \a aP lies on an edge or vertex of the line chain.
* *
* Checks if point aP lies on an edge or vertex of the line chain.
* @param aP point to check * @param aP point to check
* @return true if the point lies on the edge. * @return true if the point lies on the edge.
*/ */
bool PointOnEdge( const VECTOR2I& aP, int aAccuracy = 0 ) const; bool PointOnEdge( const VECTOR2I& aP, int aAccuracy = 0 ) const;
/** /**
* Function EdgeContainingPoint() * Check if point \a aP lies on an edge or vertex of the line chain.
* *
* Checks if point aP lies on an edge or vertex of the line chain.
* @param aP point to check * @param aP point to check
* @return index of the first edge containing the point, otherwise negative * @return index of the first edge containing the point, otherwise negative
*/ */

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -35,8 +37,7 @@ class SHAPE_RECT : public SHAPE
{ {
public: public:
/** /**
* Constructor * Create an empty (0-sized) rectangle.
* Creates an empty (0-sized) rectangle
*/ */
SHAPE_RECT() : SHAPE_RECT() :
SHAPE( SH_RECT ), SHAPE( SH_RECT ),
@ -45,8 +46,7 @@ public:
{} {}
/** /**
* Constructor * Create a rectangle defined by top-left corner (aX0, aY0), width aW and height aH.
* Creates a rectangle defined by top-left corner (aX0, aY0), width aW and height aH.
*/ */
SHAPE_RECT( int aX0, int aY0, int aW, int aH ) : SHAPE_RECT( int aX0, int aY0, int aW, int aH ) :
SHAPE( SH_RECT ), SHAPE( SH_RECT ),
@ -56,8 +56,7 @@ public:
{} {}
/** /**
* Constructor * Create a rectangle defined by top-left corner aP0, width aW and height aH.
* Creates a rectangle defined by top-left corner aP0, width aW and height aH.
*/ */
SHAPE_RECT( const VECTOR2I& aP0, int aW, int aH ) : SHAPE_RECT( const VECTOR2I& aP0, int aW, int aH ) :
SHAPE( SH_RECT ), SHAPE( SH_RECT ),
@ -83,14 +82,12 @@ public:
{ {
BOX2I bbox( VECTOR2I( m_p0.x - aClearance, m_p0.y - aClearance ), BOX2I bbox( VECTOR2I( m_p0.x - aClearance, m_p0.y - aClearance ),
VECTOR2I( m_w + 2 * aClearance, m_h + 2 * aClearance ) ); VECTOR2I( m_w + 2 * aClearance, m_h + 2 * aClearance ) );
//printf("bb : %s\n",bbox.Format().c_str());
return bbox; return bbox;
} }
/** /**
* Function Diagonal() * Return length of the diagonal of the rectangle.
* *
* Returns length of the diagonal of the rectangle
* @return diagonal length * @return diagonal length
*/ */
int Diagonal() const int Diagonal() const
@ -114,9 +111,7 @@ public:
VECTOR2I* aLocation = nullptr ) const override; VECTOR2I* aLocation = nullptr ) const override;
/** /**
* Function GetPosition() * @return the top left corner of the rectangle.
*
* @return top-left corner of the rectangle
*/ */
const VECTOR2I& GetPosition() const const VECTOR2I& GetPosition() const
{ {
@ -124,9 +119,7 @@ public:
} }
/** /**
* Function GetSize() * @return the size of the rectangle.
*
* @return size of the rectangle
*/ */
const VECTOR2I GetSize() const const VECTOR2I GetSize() const
{ {
@ -134,9 +127,7 @@ public:
} }
/** /**
* Function GetWidth() * @return the width of the rectangle.
*
* @return width of the rectangle
*/ */
const int GetWidth() const const int GetWidth() const
{ {
@ -144,9 +135,7 @@ public:
} }
/** /**
* Function GetHeight() * @return the height of the rectangle.
*
* @return height of the rectangle
*/ */
const int GetHeight() const const int GetHeight() const
{ {
@ -159,12 +148,9 @@ public:
} }
/** /**
* Function Rotate()
* This function has limited utility for SHAPE_RECT as non-cartesian rotations will distort * This function has limited utility for SHAPE_RECT as non-cartesian rotations will distort
* the rectangle. If you might need to handle non-90º rotations then the SHAPE_RECT should * the rectangle. If you might need to handle non-90º rotations then the SHAPE_RECT should
* first be converted to a SHAPE_SIMPLE which can then be free-rotated. * first be converted to a SHAPE_SIMPLE which can then be free-rotated.
* @param aAngle
* @param aCenter
*/ */
void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override void Rotate( double aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override
{ {
@ -196,9 +182,9 @@ public:
virtual const std::string Format( ) const override; virtual const std::string Format( ) const override;
private: private:
VECTOR2I m_p0; ///> Top-left corner VECTOR2I m_p0; ///< Top-left corner
int m_w; ///> Width int m_w; ///< Width
int m_h; ///> Height int m_h; ///< Height
}; };
#endif // __SHAPE_RECT_H #endif // __SHAPE_RECT_H

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2010 Virtenio GmbH, Torsten Hueter, torsten.hueter <at> virtenio.de * Copyright (C) 2010 Virtenio GmbH, Torsten Hueter, torsten.hueter <at> virtenio.de
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2012-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
@ -40,14 +40,13 @@
#endif #endif
/** /**
* VECTOR2_TRAITS * Traits class for VECTOR2.
* traits class for VECTOR2.
*/ */
template <class T> template <class T>
struct VECTOR2_TRAITS struct VECTOR2_TRAITS
{ {
///> extended range/precision types used by operations involving multiple ///< extended range/precision types used by operations involving multiple
///> multiplications to prevent overflow. ///< multiplications to prevent overflow.
typedef T extended_type; typedef T extended_type;
}; };
@ -64,8 +63,7 @@ template <class T>
std::ostream& operator<<( std::ostream& aStream, const VECTOR2<T>& aVector ); std::ostream& operator<<( std::ostream& aStream, const VECTOR2<T>& aVector );
/** /**
* VECTOR2 * Define a general 2D-vector/point.
* defines a general 2D-vector/point.
* *
* This class uses templates to be universal. Several operators are provided to help * This class uses templates to be universal. Several operators are provided to help
* easy implementing of linear algebra equations. * easy implementing of linear algebra equations.
@ -83,8 +81,6 @@ public:
T x, y; T x, y;
// Constructors
/// Construct a 2D-vector with x, y = 0 /// Construct a 2D-vector with x, y = 0
VECTOR2(); VECTOR2();
@ -99,8 +95,7 @@ public:
/// Construct a vector with given components x, y /// Construct a vector with given components x, y
VECTOR2( T x, T y ); VECTOR2( T x, T y );
/// Initializes a vector from another specialization. Beware of rouding /// Initializes a vector from another specialization. Beware of rounding issues.
/// issues.
template <typename CastingType> template <typename CastingType>
VECTOR2( const VECTOR2<CastingType>& aVec ) VECTOR2( const VECTOR2<CastingType>& aVec )
{ {
@ -115,8 +110,7 @@ public:
y = aVec.y; y = aVec.y;
} }
/// Casts a vector to another specialized subclass. Beware of rouding /// Cast a vector to another specialized subclass. Beware of rounding issues.
/// issues.
template <typename CastedType> template <typename CastedType>
VECTOR2<CastedType> operator()() const VECTOR2<CastedType> operator()() const
{ {
@ -124,81 +118,80 @@ public:
} }
/** /**
* (wxPoint) * Implement the cast to wxPoint.
* implements the cast to wxPoint. *
* @return wxPoint - the vector cast to wxPoint. * @return the vector cast to wxPoint.
*/ */
explicit operator wxPoint() const explicit operator wxPoint() const
{ {
return wxPoint( x, y ); return wxPoint( x, y );
} }
/// Destructor
// virtual ~VECTOR2(); // virtual ~VECTOR2();
/** /**
* Function Euclidean Norm * Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
* computes the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2). *
* It is used to calculate the length of the vector. * It is used to calculate the length of the vector.
*
* @return Scalar, the euclidean norm * @return Scalar, the euclidean norm
*/ */
T EuclideanNorm() const; T EuclideanNorm() const;
/** /**
* Function Squared Euclidean Norm * Compute the squared euclidean norm of the vector, which is defined as (x ** 2 + y ** 2).
* computes the squared euclidean norm of the vector, which is defined as (x ** 2 + y ** 2). *
* It is used to calculate the length of the vector. * It is used to calculate the length of the vector.
*
* @return Scalar, the euclidean norm * @return Scalar, the euclidean norm
*/ */
extended_type SquaredEuclideanNorm() const; extended_type SquaredEuclideanNorm() const;
/** /**
* Function Perpendicular * Compute the perpendicular vector.
* computes the perpendicular vector *
* @return Perpendicular vector * @return Perpendicular vector
*/ */
VECTOR2<T> Perpendicular() const; VECTOR2<T> Perpendicular() const;
/** /**
* Function Resize * Return a vector of the same direction, but length specified in \a aNewLength.
* returns a vector of the same direction, but length specified in aNewLength *
* @param aNewLength: length of the rescaled vector * @param aNewLength is the length of the rescaled vector.
* @return rescaled vector * @return the rescaled vector.
*/ */
VECTOR2<T> Resize( T aNewLength ) const; VECTOR2<T> Resize( T aNewLength ) const;
/** /**
* Function Angle * Compute the angle of the vector.
* computes the angle of the vector *
* @return vector angle, in radians * @return the vector angle in radians.
*/ */
double Angle() const; double Angle() const;
/** /**
* Function Rotate * Rotate the vector by a given angle.
* rotates the vector by a given angle *
* @param aAngle rotation angle in radians * @param aAngle rotation angle in radians
* @return rotated vector * @return rotated vector
*/ */
VECTOR2<T> Rotate( double aAngle ) const; VECTOR2<T> Rotate( double aAngle ) const;
/** /**
* Function Format * Return the vector formatted as a string.
* returns the vector formatted as a string *
* @return the formatted string * @return the formatted string
*/ */
const std::string Format() const; const std::string Format() const;
/** /**
* Function Cross() * Compute cross product of self with \a aVector.
* computes cross product of self with aVector
*/ */
extended_type Cross( const VECTOR2<T>& aVector ) const; extended_type Cross( const VECTOR2<T>& aVector ) const;
/** /**
* Function Dot() * Compute dot product of self with \a aVector.
* computes dot product of self with aVector
*/ */
extended_type Dot( const VECTOR2<T>& aVector ) const; extended_type Dot( const VECTOR2<T>& aVector ) const;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
@ -21,14 +21,13 @@
#define VECTOR3_H_ #define VECTOR3_H_
/** /**
* VECTOR2_TRAITS * Traits class for VECTOR2.
* traits class for VECTOR2.
*/ */
template <class T> template <class T>
struct VECTOR3_TRAITS struct VECTOR3_TRAITS
{ {
///> extended range/precision types used by operations involving multiple ///< extended range/precision types used by operations involving multiple
///> multiplications to prevent overflow. ///< multiplications to prevent overflow.
typedef T extended_type; typedef T extended_type;
}; };
@ -40,8 +39,7 @@ struct VECTOR3_TRAITS<int>
/** /**
* VECTOR3 * Define a general 3D-vector.
* defines a general 3D-vector.
* *
* This class uses templates to be universal. Several operators are provided to help * This class uses templates to be universal. Several operators are provided to help
* easy implementing of linear algebra equations. * easy implementing of linear algebra equations.
@ -65,7 +63,7 @@ public:
/// Construct a vector with given components x, y /// Construct a vector with given components x, y
VECTOR3( T x, T y, T z ); VECTOR3( T x, T y, T z );
/// Initializes a vector from another specialization. Beware of rouding /// Initializes a vector from another specialization. Beware of rounding
/// issues. /// issues.
template <typename CastingType> template <typename CastingType>
VECTOR3( const VECTOR3<CastingType>& aVec ) VECTOR3( const VECTOR3<CastingType>& aVec )
@ -84,35 +82,33 @@ public:
} }
/** /**
* Function Cross() * Compute cross product of self with \a aVector
* computes cross product of self with aVector
*/ */
VECTOR3<T> Cross( const VECTOR3<T>& aVector ) const; VECTOR3<T> Cross( const VECTOR3<T>& aVector ) const;
/** /**
* Function Dot() * Compute the dot product of self with \a aVector
* computes dot product of self with aVector
*/ */
VECTOR3<T>::extended_type Dot( const VECTOR3<T>& aVector ) const; VECTOR3<T>::extended_type Dot( const VECTOR3<T>& aVector ) const;
/** /**
* Function Euclidean Norm * Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
* computes the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2). *
* It is used to calculate the length of the vector. * It is used to calculate the length of the vector.
*
* @return Scalar, the euclidean norm * @return Scalar, the euclidean norm
*/ */
T EuclideanNorm() const; T EuclideanNorm() const;
/** /**
* Function Normalize() * Compute the normalized vector.
* computes the normalized vector
*/ */
VECTOR3<T> Normalize(); VECTOR3<T> Normalize();
/// Equality operator ///< Equality operator
bool operator==( const VECTOR3<T>& aVector ) const; bool operator==( const VECTOR3<T>& aVector ) const;
/// Not equality operator ///< Not equality operator
bool operator!=( const VECTOR3<T>& aVector ) const; bool operator!=( const VECTOR3<T>& aVector ) const;
}; };
@ -190,4 +186,4 @@ typedef VECTOR3<double> VECTOR3D;
typedef VECTOR3<int> VECTOR3I; typedef VECTOR3<int> VECTOR3I;
typedef VECTOR3<unsigned int> VECTOR3U; typedef VECTOR3<unsigned int> VECTOR3U;
#endif // VECTOR3_H_ #endif // VECTOR3_H_