diff --git a/cvpcb/display_footprints_frame.h b/cvpcb/display_footprints_frame.h index 7b589c70fd..5ec2f120ed 100644 --- a/cvpcb/display_footprints_frame.h +++ b/cvpcb/display_footprints_frame.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2018 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2007-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2007-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -38,8 +38,7 @@ class REPORTER; /** - * DISPLAY_FOOTPRINTS_FRAME - * is used to display footprints. + * Display footprints. */ class DISPLAY_FOOTPRINTS_FRAME : public PCB_BASE_FRAME { @@ -54,18 +53,17 @@ public: void ReCreateOptToolbar() override; /** - * Function InitDisplay * Refresh the full display for this frame: * Set the title, the status line and redraw the canvas - * Must be called after the footprint to display is modifed + * Must be called after the footprint to display is modified */ void InitDisplay(); - ///> @copydoc PCB_BASE_FRAME::GetModel() + ///< @copydoc PCB_BASE_FRAME::GetModel() BOARD_ITEM_CONTAINER* GetModel() const override; /** - * update the gal canvas (view, colors ...) + * Update the gal canvas (view, colors ...). */ void updateView(); @@ -76,22 +74,20 @@ public: MAGNETIC_SETTINGS* GetMagneticItemsSettings() override; - ///> @copydoc EDA_DRAW_FRAME::UpdateMsgPanel() + ///< @copydoc EDA_DRAW_FRAME::UpdateMsgPanel() void UpdateMsgPanel() override; COLOR_SETTINGS* GetColorSettings() const override; /** - * Function GetGridColor() , virtual - * @return the color of the grid + * @return the color of the grid. */ COLOR4D GetGridColor() override; FOOTPRINT* GetFootprint( const wxString& aFootprintName, REPORTER& aReporter ); - /* SaveCopyInUndoList() virtual - * currently: do nothing in CvPcb. - * but but be defined because it is a pure virtual in PCB_BASE_FRAME + /** + * Does nothing in CvPcb but defined because it is a pure virtual in #PCB_BASE_FRAME. */ void SaveCopyInUndoList( EDA_ITEM* aItemToCopy, UNDO_REDO aTypeCommand = UNDO_REDO::UNSPECIFIED, const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override @@ -100,13 +96,14 @@ public: /** - * Function SaveCopyInUndoList (overloaded). - * Creates a new entry in undo list of commands. - * add a list of pickers to handle a list of items - * @param aItemsList = the list of items modified by the command to undo - * @param aTypeCommand = command type (see enum UNDO_REDO) - * @param aTransformPoint = the reference point of the transformation, - * for commands like move + * Create a new entry in undo list of commands. + * + * Add a list of pickers to handle a list of items. + * + * @param aItemsList is the list of items modified by the command to undo + * @param aTypeCommand is command type (see enum UNDO_REDO) + * @param aTransformPoint is the reference point of the transformation, + * for commands like move */ void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO aTypeCommand, const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override diff --git a/cvpcb/tools/cvpcb_actions.h b/cvpcb/tools/cvpcb_actions.h index 3f59335f95..d0eb3c1d4b 100644 --- a/cvpcb/tools/cvpcb_actions.h +++ b/cvpcb/tools/cvpcb_actions.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013-2016 CERN - * Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors. * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -32,10 +32,10 @@ class TOOL_ACTION; /** - * CVPCB_ACTIONS + * Gather all the actions that are shared by tools. * - * Gathers all the actions that are shared by tools. The instance of CVPCB_ACTIONS is created - * inside of ACTION_MANAGER object that registers the actions. + * The instance of CVPCB_ACTIONS is created inside of ACTION_MANAGER object that registers + * the actions. */ class CVPCB_ACTIONS : public ACTIONS { @@ -70,7 +70,7 @@ public: static TOOL_ACTION filterFPbyPin; static TOOL_ACTION FilterFPbyLibrary; - ///> @copydoc COMMON_ACTIONS::TranslateLegacyId() + ///< @copydoc COMMON_ACTIONS::TranslateLegacyId() virtual OPT TranslateLegacyId( int aId ) override { return OPT(); } }; diff --git a/cvpcb/tools/cvpcb_fpviewer_selection_tool.h b/cvpcb/tools/cvpcb_fpviewer_selection_tool.h index 1ce9518a0b..a8bdd7c571 100644 --- a/cvpcb/tools/cvpcb_fpviewer_selection_tool.h +++ b/cvpcb/tools/cvpcb_fpviewer_selection_tool.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018-2019 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 * under the terms of the GNU General Public License as published by the @@ -29,8 +29,6 @@ /** - * CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL - * * Selection tool for the footprint viewer in cvpcb. */ class CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL : public TOOL_INTERACTIVE @@ -46,8 +44,6 @@ public: void Reset( RESET_REASON aReason ) override; /** - * Function Main() - * * The main loop. */ int Main( const TOOL_EVENT& aEvent ); @@ -69,7 +65,7 @@ public: */ int UpdateMenu( const TOOL_EVENT& aEvent ); - ///> Sets up handlers for various events. + ///< Sets up handlers for various events. void setTransitions() override; private: diff --git a/eeschema/bom_plugins.h b/eeschema/bom_plugins.h index d1ad536336..96373f4712 100644 --- a/eeschema/bom_plugins.h +++ b/eeschema/bom_plugins.h @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2018 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -32,11 +34,11 @@ #include /** - * Class handling a Bill of Material output generator. + * Bill of material output generator. + * * A Material output generator is an external application called by Eeschema to create - * a BOM from our intermediate xml netlist. - * A generator can be a script or an executable that can read the intermediate xml netlist - * file and generates a output (the BOM file) + * a BOM from our intermediate XML netlist. A generator can be a script or an executable + * that can read the intermediate XML netlist file and generates a output (the BOM file) */ class BOM_GENERATOR_HANDLER { @@ -44,25 +46,24 @@ public: typedef std::unique_ptr PTR; /** - * Constructor. * @param aFile is path to the plugin file. */ BOM_GENERATOR_HANDLER( const wxString& aFile ); /** - * Returns true if the plugin is ready to work, i.e. if the plugin file - * is found an readable + * Return true if the plugin is ready to work, i.e. if the plugin file is found and readable. */ bool IsOk() { return m_isOk; } /** - * Returns true if a file name matches a recognized plugin format. + * Return true if a file name matches a recognized plugin format. + * * @param aFile is path to the plugin file. */ static bool IsValidGenerator( const wxString& aFile ); /** - * Returns plugin description stored in the plugin header file (if available). + * Return plugin description stored in the plugin header file (if available). */ const wxString& GetInfo() const { @@ -70,7 +71,7 @@ public: } /** - * Returns the file name of the plugin. + * Return the file name of the plugin. */ const wxFileName& GetFile() const { @@ -78,7 +79,7 @@ public: } /** - * Returns the customisable plugin name. + * Return the customisable plugin name. */ const wxString& GetName() const { @@ -86,7 +87,8 @@ public: } /** - * Sets the customisable plugin name. + * Set the customisable plugin name. + * * @param aName is the new name. */ void SetName( const wxString& aName ) @@ -95,7 +97,7 @@ public: } /** - * Returns the command to execute the plugin. + * Return the command to execute the plugin. */ const wxString& GetCommand() const { @@ -103,7 +105,7 @@ public: } /** - * Sets the command to execute the plugin. + * Set the command to execute the plugin. */ void SetCommand( const wxString& aCommand ) { @@ -120,27 +122,28 @@ public: protected: /** - * Reads the plugin file header. + * Read the plugin file header. + * * @param aEndSection is a string marking end of the header. */ wxString readHeader( const wxString& aEndSection ); - ///> true if the plugin is working (i.e. if the plugin file exists and was read + ///< true if the plugin is working (i.e. if the plugin file exists and was read bool m_isOk; - ///> Path to the plugin + ///< Path to the plugin const wxFileName m_file; - ///> User customisable name + ///< User customisable name wxString m_name; - ///> Command to execute the plugin + ///< Command to execute the plugin wxString m_cmd; - ///> Description of the plugin (normally from the plugin header) + ///< Description of the plugin (normally from the plugin header) wxString m_info; - ///> Plugin specific options + ///< Plugin specific options wxArrayString m_options; }; diff --git a/eeschema/dialogs/dialog_change_symbols.h b/eeschema/dialogs/dialog_change_symbols.h index 10aeb3f7ab..6693d211fe 100644 --- a/eeschema/dialogs/dialog_change_symbols.h +++ b/eeschema/dialogs/dialog_change_symbols.h @@ -5,6 +5,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. * * @author Wayne Stambaugh * @@ -63,7 +64,7 @@ protected: checkAll( false ); } - ///> Selects or deselects all fields in the listbox widget + ///< Select or deselect all fields in the listbox widget void checkAll( bool aCheck ); private: @@ -77,7 +78,7 @@ private: SCH_COMPONENT* m_symbol; MODE m_mode; - ///> Set of field names that should have values updated + ///< Set of field names that should have values updated std::set m_updateFields; }; diff --git a/eeschema/dialogs/dialog_spice_model.h b/eeschema/dialogs/dialog_spice_model.h index 2196ba404b..158d068635 100644 --- a/eeschema/dialogs/dialog_spice_model.h +++ b/eeschema/dialogs/dialog_spice_model.h @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016-2017 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -45,30 +47,35 @@ public: private: /** - * Parse a string describing a power source, so appropriate settings are checked in the dialog + * Parse a string describing a power source, so appropriate settings are checked in the dialog. + * * @param aModel contains the string to be parse (e.g. sin(0 1 10k)) * @return True if the input string was parsed without errors. */ bool parsePowerSource( const wxString& aModel ); /** - * Generates a string to describe power source parameters, basing on the current selection. + * Generate a string to describe power source parameters, basing on the current selection. + * * If there are missing fields, it will not modify the target string. + * * @param aTarget is the destination for the generated string. * @return True if the string was saved successfully. */ bool generatePowerSource( wxString& aTarget ) const; /** - * Loads a list of components (.model and .subckt) from a spice library - * file and adds them to a combo box. + * Load a list of components (.model and .subckt) from a spice library file and add them to + * a combo box. + * * @param aComboBox is the target combo box * @param aFilePath is path to the library file */ void loadLibrary( const wxString& aFilePath ); /** - * Returns or creates a field in the edited schematic fields vector. + * Return or create a field in the edited schematic fields vector. + * * @param aFieldType is an SPICE_FIELD enum value. * @return Requested field. */ @@ -76,7 +83,8 @@ private: LIB_FIELD& getLibField( int aFieldType ); /** - * Adds a value to the PWL values list. + * Add a value to the PWL values list. + * * @param aTime is the time value. * @param aValue is the source value at the given time. * @return True if request has completed successfully, false if the data is invalid. @@ -88,7 +96,7 @@ private: // The default dialog Validate() calls the validators of all widgets. // This is not what we want; We want only validators of the selected page - // of the notbooks. So disable the wxDialog::Validate(), and let our + // of the notebooks. So disable the wxDialog::Validate(), and let our // TransferDataFromWindow doing the job. virtual bool Validate() override { @@ -105,7 +113,7 @@ private: } /** - * Initializes the internal settings + * Initialize the internal settings. */ void Init(); @@ -122,26 +130,26 @@ private: void onRandomSourceType( wxCommandEvent& event ) override; void onTypeSelected( wxCommandEvent& event ) override; - ///> Edited component + ///< Edited component SCH_COMPONENT& m_component; - ///> Fields from the component properties dialog + ///< Fields from the component properties dialog std::vector* m_schfields; std::vector* m_libfields; bool m_useSchFields; - ///> Temporary field values + ///< Temporary field values std::map m_fieldsTmp; struct MODEL { - ///> Line number in the library file + ///< Line number in the library file int line; - ///> Type of the device + ///< Type of the device SPICE_PRIMITIVE model; - ///> Convert string to model + ///< Convert string to model static SPICE_PRIMITIVE parseModelType( const wxString& aValue ); MODEL( int aLine, enum SPICE_PRIMITIVE aModel ) @@ -150,10 +158,10 @@ private: } }; - ///> Models available in the selected library file + ///< Models available in the selected library file std::map m_models; - ///> Column identifiers for PWL power source value list + ///< Column identifiers for PWL power source value list long m_pwlTimeCol, m_pwlValueCol; SPICE_VALIDATOR m_spiceValidator; diff --git a/eeschema/netlist_exporters/netlist_exporter_pspice.h b/eeschema/netlist_exporters/netlist_exporter_pspice.h index 45ac604874..b6a3bbbdf0 100644 --- a/eeschema/netlist_exporters/netlist_exporter_pspice.h +++ b/eeschema/netlist_exporters/netlist_exporter_pspice.h @@ -3,7 +3,7 @@ * * Copyright (C) 1992-2013 jp.charras at wanadoo.fr * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 1992-2017 KiCad Developers + * Copyright (C) 1992-2021 KiCad Developers * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,8 +34,8 @@ class PROJECT; /// Flags for Spice netlist generation (can be combined) enum SPICE_NETLIST_OPTIONS { - NET_ADJUST_INCLUDE_PATHS = 8, // use full paths for included files (if they are in search path) - NET_ADJUST_PASSIVE_VALS = 16, // reformat passive component values (e.g. 1M -> 1Meg) + NET_ADJUST_INCLUDE_PATHS = 8, // use full paths for included files (if they are in search path) + NET_ADJUST_PASSIVE_VALS = 16, // reformat passive component values (e.g. 1M -> 1Meg) NET_ALL_FLAGS = 0xffff }; @@ -48,7 +48,7 @@ enum SPICE_FIELD { SF_END // sentinel }; -///> Basic Spice component primitives +///< Basic Spice component primitives enum SPICE_PRIMITIVE { SP_UNKNOWN = ' ', SP_RESISTOR = 'R', @@ -63,40 +63,40 @@ enum SPICE_PRIMITIVE { SP_ISOURCE = 'I' }; -/// @todo add NET_ADJUST_INCLUDE_PATHS & NET_ADJUST_PASSIVE_VALS checkboxes in the netlist export dialog +/// @todo add NET_ADJUST_INCLUDE_PATHS & NET_ADJUST_PASSIVE_VALS checkboxes in the netlist +/// export dialog. /** - * @brief Structure to represent a schematic component in the Spice simulation. + * Structure to represent a schematic component in the Spice simulation. */ struct SPICE_ITEM { - ///> Schematic component represented by this SPICE_ITEM. + ///< Schematic component represented by this SPICE_ITEM. SCH_COMPONENT* m_parent; - ///> Spice primitive type (@see SPICE_PRIMITIVE). + ///< Spice primitive type (@see SPICE_PRIMITIVE). wxChar m_primitive; - ///> Library model (for semiconductors and subcircuits), component value (for passive components) - ///> or voltage/current (for sources). + ///< Library model (for semiconductors and subcircuits), component value (for passive + ///< components) or voltage/current (for sources). wxString m_model; - ///> + ///< wxString m_refName; - ///> Flag to indicate whether the component should be used in simulation. + ///< Flag to indicate whether the component should be used in simulation. bool m_enabled; - ///> Array containing Standard Pin Name + ///< Array containing Standard Pin Name std::vector m_pins; - ///> Numeric indices into m_SortedComponentPinList + ///< Numeric indices into m_SortedComponentPinList std::vector m_pinSequence; }; /** - * NETLIST_EXPORTER_PSPICE - * generates a PSPICE compatible netlist + * Generate a PSPICE compatible netlist. */ class NETLIST_EXPORTER_PSPICE : public NETLIST_EXPORTER_BASE { @@ -112,11 +112,11 @@ public: typedef std::list SPICE_ITEM_LIST; - ///> Net name to circuit node number mapping + ///< Net name to circuit node number mapping typedef std::map NET_INDEX_MAP; /** - * @brief Returns list of items representing schematic components in the Spice world. + * Return list of items representing schematic components in the Spice world. */ const SPICE_ITEM_LIST& GetSpiceItems() const { @@ -124,7 +124,7 @@ public: } /** - * @brief Returns name of Spice device corresponding to a schematic component. + * Return name of Spice device corresponding to a schematic component. * * @param aComponent is the component reference. * @return Spice device name or empty string if there is no such component in the netlist. The @@ -135,16 +135,15 @@ public: wxString GetSpiceDevice( const wxString& aComponent ) const; /** - * Function WriteNetlist - * writes to specified output file + * Write to specified output file */ bool WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions ) override; - ///> @copydoc NETLIST_EXPORTER_BASE::Format() + ///< @copydoc NETLIST_EXPORTER_BASE::Format() bool Format( OUTPUTFORMATTER* aFormatter, unsigned aCtl ); /** - * @brief Processes the netlist to create net mapping and a list of SPICE_ITEMs. + * Process the netlist to create net mapping and a list of SPICE_ITEMs. * It is automatically called by WriteNetlist(), but might be used separately, * if only net mapping and the list of SPICE_ITEMs are required. * @return True if successful. @@ -153,15 +152,14 @@ public: /** - * @brief some chars are not accepted in netnames in spice netlists. - * for instance '(' and ')' - * ReplaceForbiddenChars replace these chars by an underscore. - * @param aNetName = the netname to modify. + * Replace illegal spice net name characters with an underscore. + * + * @param aNetName is the net name to modify. */ static void ReplaceForbiddenChars( wxString& aNetName ); /** - * @brief Returns a map of circuit nodes to net names. + * Return a map of circuit nodes to net names. */ const NET_INDEX_MAP& GetNetIndexMap() const { @@ -169,7 +167,7 @@ public: } /** - * @brief Returns a vector of component field names related to Spice simulation. + * Return a vector of component field names related to Spice simulation. */ static const std::vector& GetSpiceFields() { @@ -177,7 +175,7 @@ public: } /** - * @brief Returns a string used for a particular component field related to Spice simulation. + * Return a string used for a particular component field related to Spice simulation. */ static const wxString& GetSpiceFieldName( SPICE_FIELD aField ) { @@ -185,22 +183,23 @@ public: } /** - * @brief Retrieves either the requested field value or the default value. + * Retrieve either the requested field value or the default value. */ static wxString GetSpiceField( SPICE_FIELD aField, SCH_COMPONENT* aComponent, unsigned aCtl ); /** - * @brief Retrieves the default value for a given field. + * Retrieve the default value for a given field. */ - static wxString GetSpiceFieldDefVal( SPICE_FIELD aField, SCH_COMPONENT* aComponent, unsigned aCtl ); + static wxString GetSpiceFieldDefVal( SPICE_FIELD aField, SCH_COMPONENT* aComponent, + unsigned aCtl ); /** - * Updates the vector of Spice directives placed in the schematics. + * Update the vector of Spice directives placed in the schematics. */ void UpdateDirectives( unsigned aCtl ); /** - * @brief Returnss a vector of Spice directives found in the schematics. + * Return a vector of Spice directives found in the schematics. */ const std::vector GetDirectives() const { @@ -208,7 +207,7 @@ public: } /** - * @brief Convertes typical boolean string values (no/yes, true/false, 1/0) to a boolean value. + * Convert typical boolean string values (no/yes, true/false, 1/0) to a boolean value. */ static bool StringToBool( const wxString& aStr ) { @@ -223,24 +222,24 @@ public: protected: /** - * @brief Saves the Spice directives. + * Save the Spice directives. */ virtual void writeDirectives( OUTPUTFORMATTER* aFormatter, unsigned aCtl ) const; private: - ///> Spice simulation title found in the processed schematic sheet + ///< Spice simulation title found in the processed schematic sheet wxString m_title; - ///> Spice directives found in the processed schematic sheet + ///< Spice directives found in the processed schematic sheet std::vector m_directives; - ///> Libraries used by the simulated circuit + ///< Libraries used by the simulated circuit std::set m_libraries; - ///> Maps circuit nodes to net names + ///< Map circuit nodes to net names NET_INDEX_MAP m_netMap; - ///> List of items representing schematic components in the Spice world + ///< List of items representing schematic components in the Spice world SPICE_ITEM_LIST m_spiceItems; // Component fields that are processed during netlist export & simulation diff --git a/eeschema/sch_draw_panel.h b/eeschema/sch_draw_panel.h index 5ada4d0fe9..8d7cd682b4 100644 --- a/eeschema/sch_draw_panel.h +++ b/eeschema/sch_draw_panel.h @@ -1,7 +1,7 @@ /* * 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 * modify it under the terms of the GNU General Public License @@ -54,11 +54,11 @@ public: protected: virtual void onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) override; - ///> @copydoc EDA_DRAW_PANEL_GAL::OnShow() + ///< @copydoc EDA_DRAW_PANEL_GAL::OnShow() void OnShow() override; - void setDefaultLayerOrder(); ///> Reassigns layer order to the initial settings. - void setDefaultLayerDeps(); ///> Sets rendering targets & dependencies for layers. + void setDefaultLayerOrder(); ///< Reassign layer order to the initial settings. + void setDefaultLayerDeps(); ///< Set rendering targets & dependencies for layers. }; #endif // __SCH_DRAW_PANEL_H diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp index 180a65074e..871157ec38 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 CERN - * Copyright (C) 2017-2020 Kicad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2021 Kicad Developers, see AUTHORS.txt for contributors. * * @author Alejandro García Montoro * @author Maciej Suminski @@ -66,7 +66,7 @@ // Eagle schematic axes are aligned with x increasing left to right and Y increasing bottom to top -// Kicad schematic axes are aligned with x increasing left to right and Y increasing top to bottom. +// KiCad schematic axes are aligned with x increasing left to right and Y increasing top to bottom. using namespace std; @@ -87,7 +87,8 @@ static const std::map pinDirectionsMap = { /** - * Provides an easy access to the children of an XML node via their names. + * Provide an easy access to the children of an XML node via their names. + * * @param aCurrentNode is a pointer to a wxXmlNode, whose children will be mapped. * @param aName the name of the specific child names to be counted. * @return number of children with the give node name. @@ -113,7 +114,7 @@ static int countChildren( wxXmlNode* aCurrentNode, const wxString& aName ) } -///> Computes a bounding box for all items in a schematic sheet +///< Compute a bounding box for all items in a schematic sheet static EDA_RECT getSheetBbox( SCH_SHEET* aSheet ) { EDA_RECT bbox; @@ -125,7 +126,7 @@ static EDA_RECT getSheetBbox( SCH_SHEET* aSheet ) } -///> Extracts the net name part from a pin name (e.g. return 'GND' for pin named 'GND@2') +///< Extract the net name part from a pin name (e.g. return 'GND' for pin named 'GND@2') static inline wxString extractNetName( const wxString& aPinName ) { return aPinName.BeforeFirst( '@' ); @@ -183,8 +184,8 @@ void SCH_EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers ) for( const auto& elayer : eagleLayers ) { /** - * Layers in Kicad schematics are not actually layers, but abstract groups mainly used to - * decide item colours. + * Layers in KiCad schematics are not actually layers, but abstract groups mainly used to + * decide item colors. * * * @@ -223,7 +224,7 @@ SCH_LAYER_ID SCH_EAGLE_PLUGIN::kiCadLayer( int aEagleLayer ) } -// Return the kicad component orientation based on eagle rotation degrees. +// Return the KiCad component orientation based on eagle rotation degrees. static COMPONENT_ORIENTATION_T kiCadComponentRotation( float eagleDegrees ) { int roti = int( eagleDegrees ); @@ -464,7 +465,7 @@ SCH_SHEET* SCH_EAGLE_PLUGIN::Load( const wxString& aFileName, SCHEMATIC* aSchema libTable->Format( &formatter, 0 ); } - // Relaod the symbol library table. + // Reload the symbol library table. m_schematic->Prj().SetElem( PROJECT::ELEM_SYMBOL_LIB_TABLE, NULL ); m_schematic->Prj().SchSymbolLibTable(); } @@ -861,7 +862,7 @@ void SCH_EAGLE_PLUGIN::loadSegments( // wxCHECK( screen, [>void<] ); while( currentSegment ) { - bool labelled = false; // has a label been added to this continously connected segment + bool labelled = false; // has a label been added to this continuously connected segment NODE_MAP segmentChildren = MapChildren( currentSegment ); SCH_LINE* firstWire = nullptr; m_segments.emplace_back(); @@ -941,7 +942,7 @@ void SCH_EAGLE_PLUGIN::loadSegments( segmentAttribute = segmentAttribute->GetNext(); } - // Add a small label to the net segment if it hasn't been labelled already + // Add a small label to the net segment if it hasn't been labeled already // this preserves the named net feature of Eagle schematics. if( !labelled && firstWire ) { @@ -1028,7 +1029,8 @@ SCH_TEXT* SCH_EAGLE_PLUGIN::loadLabel( wxXmlNode* aLabelNode, const wxString& aN if( elabel.rot ) { - label->SetLabelSpinStyle( (LABEL_SPIN_STYLE::SPIN) ( KiROUND( elabel.rot->degrees / 90 ) % 4 ) ); + label->SetLabelSpinStyle( + (LABEL_SPIN_STYLE::SPIN) ( KiROUND( elabel.rot->degrees / 90 ) % 4 ) ); if( elabel.rot->mirror ) { @@ -1095,7 +1097,7 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode ) // Find the part in the list for the sheet. // Assign the component its value from the part entry // Calculate the unit number from the gate entry of the instance - // Assign the the LIB_ID from deviceset and device names + // Assign the the LIB_ID from device set and device names auto part_it = m_partlist.find( einstance.part.Upper() ); @@ -1319,7 +1321,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( symbolNode = symbolNode->GetNext(); } - // Loop through the devicesets and load each of them + // Loop through the device sets and load each of them wxXmlNode* devicesetNode = getChildrenNodes( libraryChildren, "devicesets" ); while( devicesetNode ) @@ -1989,7 +1991,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() // Add bus entry symbols // TODO: Cleanup this function and break into pieces - // for each wire segment, compare each end with all busess. + // for each wire segment, compare each end with all busses. // If the wire end is found to end on a bus segment, place a bus entry symbol. for( auto it1 = m_currentSheet->GetScreen()->Items().OfType( SCH_LINE_T ).begin(); @@ -2190,7 +2192,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() // If wire end is above the bus, if( lineend.y < busstart.y ) { - // Test for bus existance to the left of the wire + // Test for bus existence to the left of the wire if( TestSegmentHit( linestart + wxPoint( -100, 0 ), busstart, busend, 0 ) ) { @@ -2222,7 +2224,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() } else // wire end is below the bus. { - // Test for bus existance to the left of the wire + // Test for bus existence to the left of the wire if( TestSegmentHit( linestart + wxPoint( -100, 0 ), busstart, busend, 0 ) ) { @@ -2261,7 +2263,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() if( linestart.y < busstart.y ) { - // Test for bus existance to the left of the wire + // Test for bus existence to the left of the wire if( TestSegmentHit( lineend + wxPoint( -100, 0 ), busstart, busend, 0 ) ) { @@ -2293,7 +2295,7 @@ void SCH_EAGLE_PLUGIN::addBusEntries() } else // wire end is below the bus. { - // Test for bus existance to the left of the wire + // Test for bus existence to the left of the wire if( TestSegmentHit( lineend + wxPoint( -100, 0 ), busstart, busend, 0 ) ) { @@ -2520,7 +2522,8 @@ const SEG* SCH_EAGLE_PLUGIN::SEG_DESC::LabelAttached( const SCH_TEXT* aLabel ) c } -// TODO could be used to place junctions, instead of IsJunctionNeeded() (see SCH_EDIT_FRAME::importFile()) +// TODO could be used to place junctions, instead of IsJunctionNeeded() +// (see SCH_EDIT_FRAME::importFile()) bool SCH_EAGLE_PLUGIN::checkConnections( const SCH_COMPONENT* aComponent, const LIB_PIN* aPin ) const { diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.h b/eeschema/sch_plugins/eagle/sch_eagle_plugin.h index b112c164fe..64ed7e6915 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.h +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.h @@ -1,24 +1,26 @@ /* -* This program source code file is part of KiCad, a free EDA CAD application. -* -* Copyright (C) 2017 CERN -* @author Alejandro García Montoro -* @author Maciej Suminski -* @author Russell Oliver -* -* 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 Free Software Foundation; either version 3 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program. If not, see . -*/ + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2017 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * + * @author Alejandro García Montoro + * @author Maciej Suminski + * @author Russell Oliver + * + * 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 Free Software Foundation; either version 3 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ #ifndef _SCH_EAGLE_PLUGIN_H_ #define _SCH_EAGLE_PLUGIN_H_ @@ -72,8 +74,7 @@ typedef boost::ptr_map EPART_LIST; /** - * SCH_EAGLE_PLUGIN - * is a #SCH_PLUGIN derivation for loading 6.x+ Eagle schematic files. + * A #SCH_PLUGIN derivation for loading 6.x+ Eagle schematic files. * * As with all SCH_PLUGINs there is no UI dependencies i.e. windowing calls allowed. */ @@ -98,37 +99,6 @@ public: bool CheckHeader( const wxString& aFileName ) override; - // unimplemented functions. Will trigger a not_implemented IO error. - //void SaveLibrary( const wxString& aFileName, const PROPERTIES* aProperties = NULL ) override; - - //void Save( const wxString& aFileName, SCH_SCREEN* aSchematic, KIWAY* aKiway, - // const PROPERTIES* aProperties = NULL ) override; - - //void EnumerateSymbolLib( wxArrayString& aAliasNameList, const wxString& aLibraryPath, - // const PROPERTIES* aProperties = NULL ) override; - - //LIB_PART* LoadSymbol( const wxString& aLibraryPath, const wxString& aAliasName, - // const PROPERTIES* aProperties = NULL ) override; - - //void SaveSymbol( const wxString& aLibraryPath, const LIB_PART* aSymbol, - // const PROPERTIES* aProperties = NULL ) override; - - //void DeleteAlias( const wxString& aLibraryPath, const wxString& aAliasName, - // const PROPERTIES* aProperties = NULL ) override; - - //void DeleteSymbol( const wxString& aLibraryPath, const wxString& aAliasName, - // const PROPERTIES* aProperties = NULL ) override; - - //void CreateSymbolLib( const wxString& aLibraryPath, - // const PROPERTIES* aProperties = NULL ) override; - - // bool DeleteSymbolLib( const wxString& aLibraryPath, - // const PROPERTIES* aProperties = NULL ) override; - - //bool IsSymbolLibWritable( const wxString& aLibraryPath ) override; - - //void SymbolLibOptions( PROPERTIES* aListToAppendTo ) const override; - private: void loadDrawing( wxXmlNode* aDrawingNode ); void loadLayerDefs( wxXmlNode* aLayers ); @@ -138,7 +108,7 @@ private: EAGLE_LIBRARY* loadLibrary( wxXmlNode* aLibraryNode, EAGLE_LIBRARY* aEagleLib ); void countNets( wxXmlNode* aSchematicNode ); - /// Moves any labels on the wire to the new end point of the wire. + /// Move any labels on the wire to the new end point of the wire. void moveLabels( SCH_ITEM* aWire, const wxPoint& aNewEndPoint ); /// This function finds best way to place a bus entry symbol for when an Eagle wire segment @@ -158,24 +128,33 @@ private: SCH_JUNCTION* loadJunction( wxXmlNode* aJunction ); SCH_TEXT* loadPlainText( wxXmlNode* aSchText ); - bool loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr& aPart, EDEVICE* aDevice, int aGateNumber, const wxString& aGateName ); - LIB_CIRCLE* loadSymbolCircle( std::unique_ptr& aPart, wxXmlNode* aCircleNode, int aGateNumber ); - LIB_RECTANGLE* loadSymbolRectangle( std::unique_ptr& aPart, wxXmlNode* aRectNode, int aGateNumber ); - LIB_POLYLINE* loadSymbolPolyLine( std::unique_ptr& aPart, wxXmlNode* aPolygonNode, int aGateNumber ); - LIB_ITEM* loadSymbolWire( std::unique_ptr& aPart, wxXmlNode* aWireNode, int aGateNumber ); - LIB_PIN* loadPin( std::unique_ptr& aPart, wxXmlNode*, EPIN* epin, int aGateNumber ); - LIB_TEXT* loadSymbolText( std::unique_ptr& aPart, wxXmlNode* aLibText, int aGateNumber ); + bool loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr& aPart, + EDEVICE* aDevice, int aGateNumber, const wxString& aGateName ); + LIB_CIRCLE* loadSymbolCircle( std::unique_ptr& aPart, wxXmlNode* aCircleNode, + int aGateNumber ); + LIB_RECTANGLE* loadSymbolRectangle( std::unique_ptr& aPart, wxXmlNode* aRectNode, + int aGateNumber ); + LIB_POLYLINE* loadSymbolPolyLine( std::unique_ptr& aPart, wxXmlNode* aPolygonNode, + int aGateNumber ); + LIB_ITEM* loadSymbolWire( std::unique_ptr& aPart, wxXmlNode* aWireNode, + int aGateNumber ); + LIB_PIN* loadPin( std::unique_ptr& aPart, wxXmlNode*, EPIN* epin, + int aGateNumber ); + LIB_TEXT* loadSymbolText( std::unique_ptr& aPart, wxXmlNode* aLibText, + int aGateNumber ); void loadTextAttributes( EDA_TEXT* aText, const ETEXT& aAttribs ) const; void loadFieldAttributes( LIB_FIELD* aField, const LIB_TEXT* aText ) const; - ///> Moves net labels that are detached from any wire to the nearest wire + ///< Move net labels that are detached from any wire to the nearest wire void adjustNetLabels(); /** - * Translates an Eagle-style bus name into one that is KiCad-compatible. - * For vector buses such as A[7..0] this has no impact. - * For group buses, we translate from Eagle-style to KiCad-style. + * Translate an Eagle-style bus name into one that is KiCad-compatible. + * + * For vector buses such as A[7..0] this has no impact. For group buses, we translate from + * Eagle-style to KiCad-style. + * * @param aEagleName is the name of the bus from the Eagle schematic */ wxString translateEagleBusName( const wxString& aEagleName ) const; @@ -183,6 +162,55 @@ private: wxString getLibName(); wxFileName getLibFileName(); + ///< Checks if there are other wires or pins at the position of the tested pin + bool checkConnections( const SCH_COMPONENT* aComponent, const LIB_PIN* aPin ) const; + + /** + * Create net labels to emulate implicit connections in Eagle. + * + * Each named power input pin creates an implicit connection in Eagle. To emulate this behavior + * one needs to attach global net labels to the mentioned pins. This is is also expected for the + * units that are not instantiated in the schematics, therefore such units need to be stored + * in order to create them at later stage. + * + * @param aComponent is the component to process. + * @param aScreen is the screen where net labels should be added. + * @param aUpdateSet decides whether the missing units data should be updated. + */ + void addImplicitConnections( SCH_COMPONENT* aComponent, SCH_SCREEN* aScreen, bool aUpdateSet ); + + /** + * Fix invalid characters in Eagle symbol names. + * + * It changes invalid characters to underscores. + * + * @param aName is the symbol name to be fixed. + * @return Fixed symbol name. + */ + static wxString fixSymbolName( const wxString& aName ); + + // Describe missing units containing pins creating implicit connections + // (named power pins in Eagle). + struct EAGLE_MISSING_CMP + { + EAGLE_MISSING_CMP( const SCH_COMPONENT* aComponent = nullptr ) + : cmp( aComponent ) + { + } + + ///< Link to the parent component + const SCH_COMPONENT* cmp; + + /* Map of the component units: for each unit there is a flag saying + * whether the unit needs to be instantiated with appropriate net labels to + * emulate implicit connections as is done in Eagle. + */ + std::map units; + }; + + ///< Map references to missing component units data + std::map m_missingCmps; + KIWAY* m_kiway; ///< For creating sub sheets. SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded.. SCH_SHEET* m_currentSheet; ///< The current sheet of the schematic being loaded.. @@ -200,72 +228,24 @@ private: std::map m_netCounts; std::map m_layerMap; - ///> Wire intersection points, used for quick checks whether placing a net label in a particular - ///> place would short two nets. + ///< Wire intersection points, used for quick checks whether placing a net label in a particular + ///< place would short two nets. std::vector m_wireIntersections; - ///> Wires and labels of a single connection (segment in Eagle nomenclature) + ///< Wires and labels of a single connection (segment in Eagle nomenclature) typedef struct SEG_DESC_STRUCT { - ///> Tests if a particular label is attached to any of the stored segments + ///< Test if a particular label is attached to any of the stored segments const SEG* LabelAttached( const SCH_TEXT* aLabel ) const; std::vector labels; std::vector segs; } SEG_DESC; - ///> Segments representing wires for intersection checking + ///< Segments representing wires for intersection checking std::vector m_segments; - ///> Positions of pins and wire endings mapped to its parent + ///< Positions of pins and wire endings mapped to its parent std::map> m_connPoints; - - ///> Checks if there are other wires or pins at the position of the tested pin - bool checkConnections( const SCH_COMPONENT* aComponent, const LIB_PIN* aPin ) const; - - // Structure describing missing units containing pins creating implicit connections - // (named power pins in Eagle). - struct EAGLE_MISSING_CMP - { - EAGLE_MISSING_CMP( const SCH_COMPONENT* aComponent = nullptr ) - : cmp( aComponent ) - { - } - - ///> Link to the parent component - const SCH_COMPONENT* cmp; - - /* Map of the component units: for each unit there is a flag saying - * whether the unit needs to be instantiated with appropriate net labels to - * emulate implicit connections as is done in Eagle. - */ - std::map units; - }; - - ///> Map references to missing component units data - std::map m_missingCmps; - - /** - * Creates net labels to emulate implicit connections in Eagle. - * - * Each named power input pin creates an implicit connection in Eagle. To emulate this behavior - * one needs to attach global net labels to the mentioned pins. This is is also expected for the - * units that are not instantiated in the schematics, therefore such units need to be stored - * in order to create them at later stage. - * - * @param aComponent is the component to process. - * @param aScreen is the screen where net labels should be added. - * @param aUpdateSet decides whether the missing units data should be updated. - */ - void addImplicitConnections( SCH_COMPONENT* aComponent, SCH_SCREEN* aScreen, bool aUpdateSet ); - - /** - * Fixes invalid characters in Eagle symbol names. It changes invalid characters - * to underscores. - * - * @param aName is the symbol name to be fixed. - * @return Fixed symbol name. - */ - static wxString fixSymbolName( const wxString& aName ); }; #endif // _SCH_EAGLE_PLUGIN_H_ diff --git a/eeschema/sch_preview_panel.h b/eeschema/sch_preview_panel.h index d596de0fbe..d39849be79 100644 --- a/eeschema/sch_preview_panel.h +++ b/eeschema/sch_preview_panel.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 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 under the terms of the GNU General Public License @@ -48,7 +48,7 @@ public: ~SCH_PREVIEW_PANEL() override; - ///> @copydoc EDA_DRAW_PANEL_GAL::OnShow() + ///< @copydoc EDA_DRAW_PANEL_GAL::OnShow() void OnShow() override; /// @copydoc wxWindow::Refresh() @@ -61,10 +61,10 @@ protected: KIGFX::SCH_VIEW* view() const; - ///> Reassigns layer order to the initial settings. + ///< Reassign layer order to the initial settings. void setDefaultLayerOrder(); - ///> Sets rendering targets & dependencies for layers. + ///< Set rendering targets & dependencies for layers. void setDefaultLayerDeps(); }; diff --git a/eeschema/sch_reference_list.h b/eeschema/sch_reference_list.h index c7ed790209..6a65317868 100644 --- a/eeschema/sch_reference_list.h +++ b/eeschema/sch_reference_list.h @@ -38,11 +38,11 @@ #include /** - * SCH_REFERENCE - * is used as a helper to define a symbol's reference designator in a schematic. This helper - * is required in a complex hierarchy because a symbol can be used more than once and its - * reference depends on the sheet path. This class is used to flatten the schematic hierarchy - * for annotation, net list generation, and bill of material generation. + * A helper to define a symbol's reference designator in a schematic. + * + * This helper is required in a complex hierarchy because a symbol can be used more than once + * and its reference depends on the sheet path. This class is used to flatten the schematic + * hierarchy for annotation, net list generation, and bill of material generation. */ class SCH_REFERENCE { @@ -106,17 +106,16 @@ public: } /** - * Function Annotate - * updates the annotation of the symbol according the the current object state. + * Update the annotation of the symbol according the the current object state. */ void Annotate(); /** - * Function Split - * attempts to split the reference designator into a name (U) and number (1). If the - * last character is '?' or not a digit, the reference is tagged as not annotated. For - * sybmols with multiple parts per package that are not already annotated, sets m_unit to - * a max value (0x7FFFFFFF). + * Attempt to split the reference designator into a name (U) and number (1). + * + * If the last character is '?' or not a digit, the reference is tagged as not annotated. + * For symbols with multiple parts per package that are not already annotated, sets m_unit + * to a max value (0x7FFFFFFF). */ void Split(); @@ -126,7 +125,7 @@ public: void SetRefStr( const std::string& aReference ) { m_ref = aReference; } const char* GetRefStr() const { return m_ref.c_str(); } - ///> Return reference name with unit altogether + ///< Return reference name with unit altogether wxString GetFullRef() { if( GetSymbol()->GetUnitCount() > 1 ) @@ -167,8 +166,7 @@ public: } /** - * Function IsSameInstance - * returns whether this reference refers to the same symbol instance (symbol and sheet) as + * Return whether this reference refers to the same symbol instance (symbol and sheet) as * another. */ bool IsSameInstance( const SCH_REFERENCE& other ) const @@ -186,15 +184,14 @@ public: /** - * Defines a standard error handler for annotation errors. + * Define a standard error handler for annotation errors. */ typedef std::function ANNOTATION_ERROR_HANDLER; /** - * SCH_REFERENCE_LIST - * is used to create a flattened list of symbols because in a complex hierarchy, a symbol + * Container to create a flattened list of symbols because in a complex hierarchy, a symbol * can be used more than once and its reference designator is dependent on the sheet path for * the same symbol. This flattened list is used for netlist generation, BOM generation, and * schematic annotation. @@ -206,8 +203,6 @@ private: std::vector flatList; public: - /** Constructor - */ SCH_REFERENCE_LIST() { } @@ -229,8 +224,7 @@ public: void AddItem( SCH_REFERENCE& aItem ) { flatList.push_back( aItem ); } /** - * Function RemoveItem - * removes an item from the list of references. + * Remove an item from the list of references. * * @param aIndex is the index of the item to be removed. */ @@ -241,13 +235,12 @@ public: * sorting depends on what we want to do, there are many sort functions. * Note: * When creating BOM, symbols are fully annotated. References are something like U3, - * U5 or R4, R8. When annotating, some or all suymbols are not annotated, i.e. ref is + * U5 or R4, R8. When annotating, some or all symbols are not annotated, i.e. ref is * only U or R, with no number. */ /** - * Function SplitReferences - * attempts to split all reference designators into a name (U) and number (1). If the + * Attempt to split all reference designators into a name (U) and number (1). If the * last character is '?' or not a digit, the reference is tagged as not annotated. For * symbols with multiple parts per package that are not already annotated, set m_unit to * a max value (0x7FFFFFFF). @@ -260,10 +253,11 @@ public: } /** - * function UpdateAnnotation - * Updates the symbol references for the schematic project (or the current sheet). - * Note: this function does not calculate the reference numbers stored in m_numRef so it - * must be called after calculation of new reference numbers + * Update the symbol references for the schematic project (or the current sheet). + * + * @note This function does not calculate the reference numbers stored in m_numRef so it + * must be called after calculation of new reference numbers. + * * @see SCH_REFERENCE::Annotate() */ void UpdateAnnotation() @@ -274,8 +268,8 @@ public: } /** - * Function Annotate - * set the reference designators in the list that have not been annotated. + * Set the reference designators in the list that have not been annotated. + * * @param aUseSheetNum Set to true to start annotation for each sheet at the sheet number * times \a aSheetIntervalId. Otherwise annotate incrementally. * @param aSheetIntervalId The per sheet reference designator multiplier. @@ -294,8 +288,7 @@ public: SCH_MULTI_UNIT_REFERENCE_MAP aLockedUnitMap ); /** - * Function CheckAnnotation - * check for annotations errors. + * Check for annotations errors. *

* The following annotation error conditions are tested: *

    @@ -311,8 +304,7 @@ public: int CheckAnnotation( ANNOTATION_ERROR_HANDLER aErrorHandler ); /** - * Function SortByXCoordinate - * sorts the list of references by X position. + * Sort the list of references by X position. *

    * Symbols are sorted as follows: *

      @@ -330,8 +322,7 @@ public: } /** - * Function SortByYCoordinate - * sorts the list of references by Y position. + * Sort the list of references by Y position. *

      * Symbols are sorted as follows: *

        @@ -349,8 +340,8 @@ public: } /** - * Function SortByTimeStamp - * sort the flat list by Time Stamp (sheet path + timestamp). + * Sort the flat list by Time Stamp (sheet path + timestamp). + * * Useful to detect duplicate Time Stamps */ void SortByTimeStamp() @@ -359,8 +350,7 @@ public: } /** - * Function SortByRefAndValue - * sorts the list of references by value. + * Sort the list of references by value. *

        * Symbols are sorted in the following order: *

          @@ -379,8 +369,7 @@ public: } /** - * Function SortByReferenceOnly - * sorts the list of references by reference. + * Sort the list of references by reference. *

          * Symbols are sorted in the following order: *

            @@ -395,15 +384,14 @@ public: } /** - * searches the list for a symbol with a given reference. - * @param aPath - * @return + * Search the list for a symbol with a given reference. */ int FindRef( const wxString& aPath ) const; /** - * searches the sorted list of symbols for a another symbol with the same reference and a + * Search the sorted list of symbols for a another symbol with the same reference and a * given part unit. Use this method to manage symbols with multiple parts per package. + * * @param aIndex = index in aSymbolsList for of given SCH_REFERENCE item to test. * @param aUnit = the given unit number to search * @return index in aSymbolsList if found or -1 if not found @@ -411,16 +399,17 @@ public: int FindUnit( size_t aIndex, int aUnit ); /** - * searches the list for a symbol with the given KIID path + * Search the list for a symbol with the given KIID path. + * * @param aPath path to search * @return index in aSymbolsList if found or -1 if not found */ int FindRefByPath( const wxString& aPath ) const; /** - * Function GetRefsInUse - * adds all the reference designator numbers greater than \a aMinRefId to \a aIdList + * Add all the reference designator numbers greater than \a aMinRefId to \a aIdList * skipping the reference at \a aIndex. + * * @param aIndex = the current symbol's index to use for reference prefix filtering. * @param aIdList = the buffer to fill * @param aMinRefId = the min id value to store. all values < aMinRefId are ignored @@ -428,8 +417,7 @@ public: void GetRefsInUse( int aIndex, std::vector< int >& aIdList, int aMinRefId ); /** - * Function GetLastReference - * returns the last used (greatest) reference number in the reference list for the prefix + * Return the last used (greatest) reference number in the reference list for the prefix * used by the symbol pointed to by \a aIndex. The symbol list must be sorted. * * @param aIndex The index of the reference item used for the search pattern. @@ -456,19 +444,14 @@ public: #endif /** - * Function Shorthand - * Returns a shorthand string representing all the references in the list. For instance, + * Return a shorthand string representing all the references in the list. For instance, * "R1, R2, R4 - R7, U1" - * @param aList */ static wxString Shorthand( std::vector aList ); friend class BACK_ANNOTATION; private: - /* sort functions used to sort flatList - */ - static bool sortByRefAndValue( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 ); static bool sortByXPosition( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 ); @@ -480,11 +463,12 @@ private: static bool sortByReferenceOnly( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 ); /** - * Function CreateFirstFreeRefId - * searches for the first free reference number in \a aListId of reference numbers in use. + * Search for the first free reference number in \a aListId of reference numbers in use. + * * This function just searches for a hole in a list of incremented numbers, this list must * be sorted by increasing values and each value can be stored only once. The new value * is added to the list. + * * @see BuildRefIdInUseList to prepare this list * @param aIdList The buffer that contains the reference numbers in use. * @param aFirstValue The first expected free value diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h index 9806a30e20..7c7b295633 100644 --- a/eeschema/sch_sheet_path.h +++ b/eeschema/sch_sheet_path.h @@ -3,7 +3,7 @@ * * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2011 Wayne Stambaugh - * 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 * modify it under the terms of the GNU General Public License @@ -25,7 +25,7 @@ /** * @file sch_sheet_path.h - * @brief Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema. + * Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema. */ #ifndef CLASS_DRAWSHEET_PATH_H @@ -38,7 +38,7 @@ /** - * A simple container for schematic symbol instance infromation. + * A simple container for schematic symbol instance information. */ struct SYMBOL_INSTANCE_REFERENCE { @@ -55,7 +55,7 @@ struct SYMBOL_INSTANCE_REFERENCE /** - * A simple container for sheet instance infromation. + * A simple container for sheet instance information. */ struct SCH_SHEET_INSTANCE { @@ -236,7 +236,7 @@ public: SCH_SCREEN* LastScreen(); - ///> @copydoc SCH_SHEET_PATH::LastScreen() + ///< @copydoc SCH_SHEET_PATH::LastScreen() SCH_SCREEN* LastScreen() const; /** @@ -263,7 +263,7 @@ public: KIID_PATH PathWithoutRootUuid() const; /** - * Return the sheet path in a human readable form made from thesheet names. + * Return the sheet path in a human readable form made from the sheet names. * * The the "normal" path instead uses the #KIID objects in the path that do not change * even when editing sheet parameters. @@ -438,10 +438,10 @@ public: * Build the list of sheets and their sheet path from \a aSheet. * * If \a aSheet is the root sheet, the full sheet path and sheet list are built. - * + * * The list will be ordered as per #SCH_SCREEN::GetSheets which results in sheets being ordered * in the legacy way of using the X and Y positions of the sheets. - * + * * @see #SortByPageNumbers to sort by page numbers * * @param aSheet is the starting sheet from which the list is built, or NULL @@ -449,10 +449,10 @@ public: * @throw std::bad_alloc if the memory for the sheet path list could not be allocated. */ void BuildSheetList( SCH_SHEET* aSheet, bool aCheckIntegrity ); - + /** * Sorts the list of sheets by page number. This should be called after #BuildSheetList - * + * * @param aUpdateVirtualPageNums If true, updates the virtual page numbers to match the new * ordering */ @@ -506,7 +506,7 @@ public: * Set initial sheet page numbers. * * The number scheme is base on the old psuedo sheet numbering algorithm prior to - * the implementation of user defineable sheet page numbers. + * the implementation of user definable sheet page numbers. */ void SetInitialPageNumbers(); }; diff --git a/eeschema/sim/netlist_exporter_pspice_sim.h b/eeschema/sim/netlist_exporter_pspice_sim.h index d1e780b591..a1bd47aedf 100644 --- a/eeschema/sim/netlist_exporter_pspice_sim.h +++ b/eeschema/sim/netlist_exporter_pspice_sim.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 CERN - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. * * @author Maciej Suminski * @@ -52,19 +52,21 @@ public: } /** - * @brief Returns name of Spice dataset for a specific plot. + * Return name of Spice dataset for a specific plot. + * * @param aName is name of the measured net or device * @param aType describes the type of expected plot * @param aParam is an optional parameter for devices, if absent it will return current (only - * for passive devices). + * for passive devices). * @return Empty string if query is invalid, otherwise a plot name that - * can be requested from the simulator. + * can be requested from the simulator. */ wxString ComponentToVector( const wxString& aName, SIM_PLOT_TYPE aType, const wxString& aParam = wxEmptyString ) const; /** - * @brief Returns name of Spice dataset for a specific plot. + * Return name of Spice dataset for a specific plot. + * * @param aVector is name of the vector produced by ngspice * @param [out] aSignal is output in form: V(R1), Ib(Q2), I(L8) * @return [SPT_VOLTAGE, SPT_CURRENT]. Otherwise SPT_UNKNOWN if vector is @@ -73,12 +75,12 @@ public: SIM_PLOT_TYPE VectorToSignal( const std::string& aVector, wxString& aSignal ) const; /** - * @brief Returns a list of currents that can be probed in a Spice primitive. + * Return a list of currents that can be probed in a Spice primitive. */ static const std::vector& GetCurrents( SPICE_PRIMITIVE aPrimitive ); /** - * @brief Overrides the simulation command directive. + * Override the simulation command directive. */ void SetSimCommand( const wxString& aCmd ) { @@ -86,7 +88,7 @@ public: } /** - * @brief Returns the simulation command directive. + * Return the simulation command directive. */ const wxString& GetSimCommand() const { @@ -94,7 +96,7 @@ public: } /** - * @brief Clears the simulation command directive. + * Clear the simulation command directive. */ void ClearSimCommand() { @@ -102,25 +104,26 @@ public: } /** - * Returns the command directive that is in use (either from the sheet or from m_simCommand + * Return the command directive that is in use (either from the sheet or from m_simCommand * @return */ wxString GetUsedSimCommand(); /** - * @brief Returns simulation type basing on the simulation command directives. + * Return simulation type basing on the simulation command directives. + * * Simulation directives set using SetSimCommand() have priority over the ones placed in * schematic sheets. */ SIM_TYPE GetSimType(); /** - * @brief Returns simulation command directives placed in schematic sheets (if any). + * Return simulation command directives placed in schematic sheets (if any). */ wxString GetSheetSimCommand(); /** - * Parses a two-source .dc command directive into its components + * Parse a two-source .dc command directive into its components * * @param aCmd is the input command string * @return true if the command was parsed successfully @@ -129,7 +132,7 @@ public: SPICE_DC_PARAMS* aSource2 ); /** - * @brief Determines if a directive is a simulation command. + * Determine if a directive is a simulation command. */ static bool IsSimCommand( const wxString& aCmd ) { @@ -137,7 +140,7 @@ public: } /** - * @brief Returns simulation type basing on a simulation command directive. + * Return simulation type basing on a simulation command directive. */ static SIM_TYPE CommandToSimType( const wxString& aCmd ); @@ -146,7 +149,7 @@ protected: private: - ///> Custom simulation command (has priority over the schematic sheet simulation commands) + ///< Custom simulation command (has priority over the schematic sheet simulation commands) wxString m_simCommand; }; diff --git a/eeschema/sim/ngspice.h b/eeschema/sim/ngspice.h index 36443a8c05..883c8eaf9e 100644 --- a/eeschema/sim/ngspice.h +++ b/eeschema/sim/ngspice.h @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Tomasz Wlostowski * * This program is free software; you can redistribute it and/or @@ -38,46 +40,46 @@ public: NGSPICE(); virtual ~NGSPICE(); - ///> @copydoc SPICE_SIMULATOR::Init() + ///< @copydoc SPICE_SIMULATOR::Init() void Init() override; - ///> @copydoc SPICE_SIMULATOR::LoadNetlist() + ///< @copydoc SPICE_SIMULATOR::LoadNetlist() bool LoadNetlist( const std::string& aNetlist ) override; - ///> @copydoc SPICE_SIMULATOR::Run() + ///< @copydoc SPICE_SIMULATOR::Run() bool Run() override; - ///> @copydoc SPICE_SIMULATOR::Stop() + ///< @copydoc SPICE_SIMULATOR::Stop() bool Stop() override; - ///> @copydoc SPICE_SIMULATOR::IsRunning() + ///< @copydoc SPICE_SIMULATOR::IsRunning() bool IsRunning() override; - ///> @copydoc SPICE_SIMULATOR::Command() + ///< @copydoc SPICE_SIMULATOR::Command() bool Command( const std::string& aCmd ) override; - ///> @copydoc SPICE_SIMULATOR::GetXAxis() + ///< @copydoc SPICE_SIMULATOR::GetXAxis() std::string GetXAxis( SIM_TYPE aType ) const override; ///> @copydoc SPICE_SIMULATOR::AllPlots() std::vector AllPlots() const override; - ///> @copydoc SPICE_SIMULATOR::GetPlot() + ///< @copydoc SPICE_SIMULATOR::GetPlot() std::vector GetPlot( const std::string& aName, int aMaxLen = -1 ) override; - ///> @copydoc SPICE_SIMULATOR::GetRealPlot() + ///< @copydoc SPICE_SIMULATOR::GetRealPlot() std::vector GetRealPlot( const std::string& aName, int aMaxLen = -1 ) override; - ///> @copydoc SPICE_SIMULATOR::GetImagPlot() + ///< @copydoc SPICE_SIMULATOR::GetImagPlot() std::vector GetImagPlot( const std::string& aName, int aMaxLen = -1 ) override; - ///> @copydoc SPICE_SIMULATOR::GetMagPlot() + ///< @copydoc SPICE_SIMULATOR::GetMagPlot() std::vector GetMagPlot( const std::string& aName, int aMaxLen = -1 ) override; - ///> @copydoc SPICE_SIMULATOR::GetPhasePlot() + ///< @copydoc SPICE_SIMULATOR::GetPhasePlot() std::vector GetPhasePlot( const std::string& aName, int aMaxLen = -1 ) override; - ///> @copydoc SPICE_SIMULATOR::GetNetlist() + ///< @copydoc SPICE_SIMULATOR::GetNetlist() virtual const std::string GetNetlist() const override; private: @@ -97,7 +99,7 @@ private: typedef char** (*ngSpice_AllVecs)( char* plotname ); typedef bool (*ngSpice_Running)( void ); - ///> Handles to DLL functions + ///< Handle to DLL functions ngSpice_Init m_ngSpice_Init; ngSpice_Circ m_ngSpice_Circ; ngSpice_Command m_ngSpice_Command; @@ -109,32 +111,32 @@ private: wxDynamicLibrary m_dll; - ///> Executes commands from a file + ///< Execute commands from a file bool loadSpinit( const std::string& aFileName ); - ///> Checks a few different locations for codemodel files and returns one - ///> if it exists + ///< Check a few different locations for codemodel files and returns one if it exists. std::string findCmPath() const; - ///> Loads codemodel files from a directory + ///< Load codemodel files from a directory. bool loadCodemodels( const std::string& aPath ); // Callback functions static int cbSendChar( char* what, int id, void* user ); static int cbSendStat( char* what, int id, void* user ); static int cbBGThreadRunning( bool is_running, int id, void* user ); - static int cbControlledExit( int status, bool immediate, bool exit_upon_quit, int id, void* user ); + static int cbControlledExit( int status, bool immediate, bool exit_upon_quit, int id, + void* user ); - // Assures ngspice is in a valid state and reinitializes it if need be + // Assure ngspice is in a valid state and reinitializes it if need be void validate(); - ///> Error flag indicating that ngspice needs to be reloaded + ///< Error flag indicating that ngspice needs to be reloaded bool m_error; - ///> NGspice should be initialized only once + ///< NGspice should be initialized only once static bool m_initialized; - ///> current netlist + ///< current netlist std::string m_netlist; }; diff --git a/eeschema/sim/sim_plot_frame.h b/eeschema/sim/sim_plot_frame.h index 7796ab1856..efa38d1140 100644 --- a/eeschema/sim/sim_plot_frame.h +++ b/eeschema/sim/sim_plot_frame.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 CERN - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. * * @author Tomasz Wlostowski * @author Maciej Suminski @@ -70,14 +70,14 @@ enum SIM_COLOR_SET }; -///> Trace descriptor class +///< Trace descriptor class class TRACE_DESC { public: TRACE_DESC( const NETLIST_EXPORTER_PSPICE_SIM& aExporter, const wxString& aName, SIM_PLOT_TYPE aType, const wxString& aParam ); - ///> Modifies an existing TRACE_DESC simulation type + ///< Modifies an existing TRACE_DESC simulation type TRACE_DESC( const NETLIST_EXPORTER_PSPICE_SIM& aExporter, const TRACE_DESC& aDescription, SIM_PLOT_TYPE aNewType ) : TRACE_DESC( aExporter, aDescription.GetName(), aNewType, aDescription.GetParam() ) @@ -106,17 +106,17 @@ public: private: // Three basic parameters - ///> Name of the measured net/device + ///< Name of the measured net/device wxString m_name; - ///> Type of the signal + ///< Type of the signal SIM_PLOT_TYPE m_type; - ///> Name of the signal parameter + ///< Name of the signal parameter wxString m_param; // Generated data - ///> Title displayed in the signal list/plot legend + ///< Title displayed in the signal list/plot legend wxString m_title; }; @@ -134,33 +134,37 @@ public: bool IsSimulationRunning(); /** - * @brief Creates a new plot panel for a given simulation type and adds it to the main - * notebook. - * @param aSimCommand is the SPICE command used for simulation. + * Create a new plot panel for a given simulation type and adds it to the main notebook. + * + * @param aSimType is requested simulation type. * @return The new plot panel. */ SIM_PANEL_BASE* NewPlotPanel( wxString aSimCommand ); /** - * @brief Adds a voltage plot for a given net name. + * Add a voltage plot for a given net name. + * * @param aNetName is the net name for which a voltage plot should be created. */ void AddVoltagePlot( const wxString& aNetName ); /** - * @brief Adds a current plot for a particular device. + * Add a current plot for a particular device. + * * @param aDeviceName is the device name (e.g. R1, C1). * @param aParam is the current type (e.g. I, Ic, Id). */ void AddCurrentPlot( const wxString& aDeviceName, const wxString& aParam ); /** - * @brief Adds a tuner for a component. + * Add a tuner for a component. + * */ void AddTuner( SCH_COMPONENT* aComponent ); /** - * @brief Removes an existing tuner. + * Remove an existing tuner. + * * @param aTuner is the tuner to be removed. * @param aErase decides whether the tuner should be also removed from the tuners list. * Otherwise it is removed only from the SIM_PLOT_FRAME pane. @@ -168,12 +172,12 @@ public: void RemoveTuner( TUNER_SLIDER* aTuner, bool aErase = true ); /** - * @brief Returns the currently opened plot panel (or NULL if there is none). + * Return the currently opened plot panel (or NULL if there is none). */ SIM_PLOT_PANEL* CurrentPlot() const; /** - * Returns the netlist exporter object used for simulations. + * Return the netlist exporter object used for simulations. */ const NETLIST_EXPORTER_PSPICE_SIM* GetExporter() const; @@ -204,19 +208,20 @@ public: wxWindow* GetToolCanvas() const override { return nullptr; } private: - - /** Give icons to menuitems of the main menubar + /** + * Give icons to menuitems of the main menubar */ void setIconsForMenuItems(); - /** Fills m_colorList by a default set of colors. - * @param aWhiteBg = true to use a white (or clear) background - * false to use a dark background + /** + * Fill m_colorList by a default set of colors. + * + * @param aWhiteBg true to use a white (or clear) background false to use a dark background. */ void fillDefaultColorList( bool aWhiteBg ); /** - * @brief Returns the currently opened plot panel (or NULL if there is none). + * Return the currently opened plot panel (or NULL if there is none). */ SIM_PANEL_BASE* currentPlotWindow() const { @@ -224,7 +229,8 @@ private: } /** - * @brief Adds a new plot to the current panel. + * Add a new plot to the current panel. + * * @param aName is the device/net name. * @param aType describes the type of plot. * @param aParam is the parameter for the device/net (e.g. I, Id, V). @@ -232,20 +238,22 @@ private: void addPlot( const wxString& aName, SIM_PLOT_TYPE aType, const wxString& aParam ); /** - * @brief Removes a plot with a specific title. + * Remove a plot with a specific title. + * * @param aPlotName is the full plot title (e.g. I(Net-C1-Pad1)). * @param aErase decides if plot should be removed from corresponding TRACE_MAP (see m_plots). */ void removePlot( const wxString& aPlotName, bool aErase = true ); /** - * @brief Reloads the current schematic for the netlist exporter. + * Reload the current schematic for the netlist exporter. */ void updateNetlistExporter(); /** - * @brief Updates plot in a particular SIM_PLOT_PANEL. If the panel does not contain + * Update plot in a particular SIM_PLOT_PANEL. If the panel does not contain * the plot, it will be added. + * * @param aDescriptor contains the plot description. * @param aPanel is the panel that should receive the update. * @return True if a plot was successfully added/updated. @@ -253,37 +261,39 @@ private: bool updatePlot( const TRACE_DESC& aDescriptor, SIM_PLOT_PANEL* aPanel ); /** - * @brief Updates the list of currently plotted signals. + * Update the list of currently plotted signals. */ void updateSignalList(); /** - * @brief Filters out tuners for components that do not exist anymore. + * Filter out tuners for components that do not exist anymore. * Decisions are based on the current NETLIST_EXPORTER_BASE data. */ void updateTuners(); /** - * @brief Applies component values specified using tunder sliders to the current netlist. + * Apply component values specified using tuner sliders to the current netlist. */ void applyTuners(); /** - * @brief Loads plot settings from a file. + * Load plot settings from a file. + * * @param aPath is the file name. * @return True if successful. */ bool loadWorkbook( const wxString& aPath ); /** - * @brief Saves plot settings to a file. + * Save plot settings to a file. + * * @param aPath is the file name. * @return True if successful. */ bool saveWorkbook( const wxString& aPath ); /** - * @brief Returns X axis for a given simulation type. + * Return X axis for a given simulation type. */ SIM_PLOT_TYPE GetXAxisType( SIM_TYPE aType ) const; @@ -358,17 +368,17 @@ private: struct PLOT_INFO { - ///> Map of the traces displayed on the plot + ///< Map of the traces displayed on the plot TRACE_MAP m_traces; - ///> Spice directive used to execute the simulation + ///< Spice directive used to execute the simulation wxString m_simCommand; }; - ///> Map of plot panels and associated data + ///< Map of plot panels and associated data std::map m_plots; - ///> List of currently displayed tuners + ///< List of currently displayed tuners std::list m_tuners; // Trick to preserve settings between runs: @@ -397,17 +407,17 @@ private: }; }; - ///> Panel that was used as the most recent one for simulations + ///< Panel that was used as the most recent one for simulations SIM_PLOT_PANEL* m_lastSimPlot; - ///> imagelists uset to add a small coloured icon to signal names - ///> and cursors name, the same color as the corresponding signal traces + ///< imagelists used to add a small colored icon to signal names + ///< and cursors name, the same color as the corresponding signal traces wxImageList* m_signalsIconColorList; - ///> A string to store the path of saved workbooks during a session + ///< A string to store the path of saved workbooks during a session static wxString m_savedWorkbooksPath; - ///> Info panel + ///< Info panel SIM_PANEL_BASE* m_welcomePanel; // Variables for temporary storage: @@ -418,7 +428,7 @@ private: bool m_plotUseWhiteBg; unsigned int m_plotNumber; - ///> The color list to draw traces, bg, fg, axis... + ///< The color list to draw traces, bg, fg, axis... std::vector m_colorList; }; diff --git a/eeschema/sim/sim_plot_panel.h b/eeschema/sim/sim_plot_panel.h index 8825cd15e6..9163f894ca 100644 --- a/eeschema/sim/sim_plot_panel.h +++ b/eeschema/sim/sim_plot_panel.h @@ -2,7 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 CERN - * Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Tomasz Wlostowski * @author Maciej Suminski * @@ -37,7 +38,7 @@ class SIM_PLOT_FRAME; class SIM_PLOT_PANEL; class TRACE; -///> Cursor attached to a trace to follow its values: +///< Cursor attached to a trace to follow its values: class CURSOR : public mpInfoLayer { public: @@ -101,7 +102,8 @@ public: } /** - * @brief Assigns new data set for the trace. aX and aY need to have the same length. + * Assigns new data set for the trace. aX and aY need to have the same length. + * * @param aX are the X axis values. * @param aY are the Y axis values. */ @@ -174,7 +176,7 @@ public: virtual ~SIM_PLOT_PANEL(); - ///> set the pointer to the sim plot frame + ///< set the pointer to the sim plot frame void SetMasterFrame( SIM_PLOT_FRAME* aFrame ) { m_masterFrame = aFrame; @@ -195,8 +197,8 @@ public: return m_axis_y2 ? m_axis_y2->GetName() : ""; } - bool AddTrace( const wxString& aName, int aPoints, - const double* aX, const double* aY, SIM_PLOT_TYPE aFlags ); + bool AddTrace( const wxString& aName, int aPoints, const double* aX, + const double* aY, SIM_PLOT_TYPE aFlags ); bool DeleteTrace( const wxString& aName ); @@ -264,16 +266,16 @@ public: return m_dotted_cp; } - ///> Returns true if the trace has cursor shown. + ///< Returns true if the trace has cursor shown. bool HasCursorEnabled( const wxString& aName ) const; - ///> Toggles cursor for a particular trace. + ///< Toggles cursor for a particular trace. void EnableCursor( const wxString& aName, bool aEnable ); - ///> Resets scale ranges to fit the current traces + ///< Resets scale ranges to fit the current traces void ResetScales(); - ///> Update trace line style + ///< Update trace line style void UpdateTraceStyle( TRACE* trace ); /** @@ -283,17 +285,17 @@ public: */ wxColour GetPlotColor( int aIndex ); - ///> Update plot colors + ///< Update plot colors void UpdatePlotColors(); - ///> Getter for math plot window + ///< Getter for math plot window mpWindow* GetPlotWin() const { return m_plotWin; } private: - ///> @return a new color from the palette + ///< @return a new color from the palette wxColour generateColor(); ///> @brief Constructs the plot axes for DC simulation plot diff --git a/eeschema/sim/sim_types.h b/eeschema/sim/sim_types.h index ba920de6fc..4e5d322541 100644 --- a/eeschema/sim/sim_types.h +++ b/eeschema/sim/sim_types.h @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -25,7 +27,7 @@ #ifndef SIM_TYPES_H #define SIM_TYPES_H -///> Possible simulation types +///< Possible simulation types enum SIM_TYPE { ST_UNKNOWN, @@ -40,7 +42,7 @@ enum SIM_TYPE ST_TRANSIENT }; -///> Possible plot types +///< Possible plot types enum SIM_PLOT_TYPE { // Y axis diff --git a/eeschema/sim/spice_simulator.h b/eeschema/sim/spice_simulator.h index 16bb509a6f..a84987d4cc 100644 --- a/eeschema/sim/spice_simulator.h +++ b/eeschema/sim/spice_simulator.h @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 CERN + * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Tomasz Wlostowski * * This program is free software; you can redistribute it and/or @@ -45,61 +47,67 @@ public: SPICE_SIMULATOR() : m_reporter( NULL ) {} virtual ~SPICE_SIMULATOR() {} - ///> Creates a simulator instance of particular type (currently only ngspice is handled) + ///< Create a simulator instance of particular type (currently only ngspice is handled) static std::shared_ptr CreateInstance( const std::string& aName ); - ///> Initializes the simulator + ///< Initialize the simulator virtual void Init() = 0; /* - * @brief Loads a netlist for the simulation. + * Load a netlist for the simulation. + * * @return True in case of success, false otherwise. */ virtual bool LoadNetlist( const std::string& aNetlist ) = 0; /** - * @brief Executes the simulation with currently loaded netlist. + * Execute the simulation with currently loaded netlist. + * * @return True in case of success, false otherwise. */ virtual bool Run() = 0; /** - * @brief Halts the simulation. + * Halt the simulation. + * * @return True in case of success, false otherwise. */ virtual bool Stop() = 0; /** - * @brief Checks if simulation is running at the moment. + * Check if simulation is running at the moment. + * * @return True if simulation is currently executed. */ virtual bool IsRunning() = 0; /** - * @brief Executes a Spice command as if it was typed into console. + * Execute a Spice command as if it was typed into console. + * * @param aCmd is the command to be issued. */ virtual bool Command( const std::string& aCmd ) = 0; - ///> Returns X axis name for a given simulation type + ///< Return X axis name for a given simulation type virtual std::string GetXAxis( SIM_TYPE aType ) const = 0; - ///> Sets a SPICE_REPORTER object to receive the simulation log. + ///< Set a SPICE_REPORTER object to receive the simulation log. virtual void SetReporter( SPICE_REPORTER* aReporter ) { m_reporter = aReporter; } /** - * @brief Returns a list with all vectors generated in current simulation. + * Return a list with all vectors generated in current simulation. * @param none * @return List of vector names. ?May not match to the net name elements. */ virtual std::vector AllPlots() const = 0; /** - * @brief Returns a requested vector with complex values. If the vector is real, then + * Return a requested vector with complex values. If the vector is real, then * the imaginary part is set to 0 in all values. + * * @param aName is the vector named in Spice convention (e.g. V(3), I(R1)). * @param aMaxLen is max count of returned values. * if -1 (default) all available values are returned. @@ -108,8 +116,9 @@ public: virtual std::vector GetPlot( const std::string& aName, int aMaxLen = -1 ) = 0; /** - * @brief Returns a requested vector with real values. If the vector is complex, then + * Return a requested vector with real values. If the vector is complex, then * the real part is returned. + * * @param aName is the vector named in Spice convention (e.g. V(3), I(R1)). * @param aMaxLen is max count of returned values. * if -1 (default) all available values are returned. @@ -118,8 +127,9 @@ public: virtual std::vector GetRealPlot( const std::string& aName, int aMaxLen = -1 ) = 0; /** - * @brief Returns a requested vector with imaginary values. If the vector is complex, then + * Return a requested vector with imaginary values. If the vector is complex, then * the imaginary part is returned. If the vector is reql, then only zeroes are returned. + * * @param aName is the vector named in Spice convention (e.g. V(3), I(R1)). * @param aMaxLen is max count of returned values. * if -1 (default) all available values are returned. @@ -128,7 +138,8 @@ public: virtual std::vector GetImagPlot( const std::string& aName, int aMaxLen = -1 ) = 0; /** - * @brief Returns a requested vector with magnitude values. + * Return a requested vector with magnitude values. + * * @param aName is the vector named in Spice convention (e.g. V(3), I(R1)). * @param aMaxLen is max count of returned values. * if -1 (default) all available values are returned. @@ -137,7 +148,8 @@ public: virtual std::vector GetMagPlot( const std::string& aName, int aMaxLen = -1 ) = 0; /** - * @brief Returns a requested vector with phase values. + * Return a requested vector with phase values. + * * @param aName is the vector named in Spice convention (e.g. V(3), I(R1)). * @param aMaxLen is max count of returned values. * if -1 (default) all available values are returned. @@ -146,13 +158,15 @@ public: virtual std::vector GetPhasePlot( const std::string& aName, int aMaxLen = -1 ) = 0; /** - * @brief Returns current SPICE netlist used by the simulator. + * Return current SPICE netlist used by the simulator. + * * @return The netlist. */ virtual const std::string GetNetlist() const = 0; /** - * @brief Returns a string with simulation name based on enum. + * Return a string with simulation name based on enum. + * * @param aType is the enum describing simulation type * @param aShortName if true - return is in format "TRAN", "OP". * if false - return is in format "Transient", "Operating Point". @@ -161,7 +175,7 @@ public: static wxString TypeToName( SIM_TYPE aType, bool aShortName ); protected: - ///> Reporter object to receive simulation log + ///< Reporter object to receive simulation log. SPICE_REPORTER* m_reporter; }; diff --git a/eeschema/sim/spice_value.h b/eeschema/sim/spice_value.h index 0ebead1f83..a37a8a2bc4 100644 --- a/eeschema/sim/spice_value.h +++ b/eeschema/sim/spice_value.h @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -28,7 +30,7 @@ #include #include -///> Helper class to handle Spice way of expressing values (e.g. 10.5 Meg) +///< Helper class to handle Spice way of expressing values (e.g. 10.5 Meg) class SPICE_VALUE { public: @@ -51,7 +53,7 @@ public: { } - ///> Parses the string to create a Spice value (e.g. 100n) + ///< Parses the string to create a Spice value (e.g. 100n) SPICE_VALUE( const wxString& aString ); SPICE_VALUE( int aInt, UNIT_PREFIX aPrefix = PFX_NONE ) @@ -67,24 +69,24 @@ public: } /** - * @brief Normalizes the value. The unit prefix is picked so the base is (0.001 <= base < 1000). + * Normalize the value. The unit prefix is picked so the base is (0.001 <= base < 1000). */ void Normalize(); double ToDouble() const; /** - * @brief Returns string value as when converting double to string (e.g. 123456.789). + * Return string value as when converting double to string (e.g. 123456.789). */ wxString ToString() const; /** - * @brief Returns string value in Spice format (e.g. 123.3456789k). + * Return string value in Spice format (e.g. 123.3456789k). */ wxString ToSpiceString() const; /** - * @brief Returns either a normal string or Spice format string, depending on the original + * Return either a normal string or Spice format string, depending on the original * value format. */ wxString ToOrigString() const @@ -93,7 +95,7 @@ public: } /** - * Returns true if the object was initiated with a Spice formatted string value. + * Return true if the object was initiated with a Spice formatted string value. */ bool IsSpiceString() const { @@ -131,18 +133,18 @@ public: SPICE_VALUE operator/( const SPICE_VALUE& aOther ) const; private: + ///< Remove redundant zeros from the end of a string. + static void stripZeros( wxString& aString ); + double m_base; UNIT_PREFIX m_prefix; - ///> Was the value defined using the Spice notation? + ///< Was the value defined using the Spice notation? bool m_spiceStr; - - ///> Removes redundant zeros from the end of a string. - static void stripZeros( wxString& aString ); }; -///> Helper class to recognize Spice formatted values +///< Helper class to recognize Spice formatted values class SPICE_VALIDATOR : public wxTextValidator { public: @@ -159,7 +161,7 @@ public: bool Validate( wxWindow* aParent ) override; private: - ///> Is it valid to get an empty value? + ///< Is it valid to get an empty value? bool m_emptyAllowed; }; diff --git a/eeschema/symbol_editor/symbol_library_manager.h b/eeschema/symbol_editor/symbol_library_manager.h index 4e54d1456c..d14af3aa27 100644 --- a/eeschema/symbol_editor/symbol_library_manager.h +++ b/eeschema/symbol_editor/symbol_library_manager.h @@ -2,7 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 CERN - * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -102,7 +103,7 @@ public: SYMBOL_LIBRARY_MANAGER( SYMBOL_EDIT_FRAME& aFrame ); /** - * Updates the SYMBOL_LIBRARY_MANAGER data to synchronize with Symbol Library Table. + * Updates the #SYMBOL_LIBRARY_MANAGER data to synchronize with Symbol Library Table. */ void Sync( bool aForce = false, std::function aProgressCallback @@ -115,7 +116,7 @@ public: bool HasModifications() const; /** - * Returns a library hash value to determine if it has changed. + * Return a library hash value to determine if it has changed. * * For buffered libraries, it returns a number corresponding to the number of modifications. * For original libraries, hash is computed basing on the library URI. Returns -1 when the @@ -124,19 +125,19 @@ public: int GetLibraryHash( const wxString& aLibrary ) const; /** - * Returns the array of library names. + * Return the array of library names. */ wxArrayString GetLibraryNames() const; /** - * Finds a single library within the (aggregate) library table. + * Find a single library within the (aggregate) library table. */ SYMBOL_LIB_TABLE_ROW* GetLibrary( const wxString& aLibrary ) const; std::list GetAliases( const wxString& aLibrary ) const; /** - * Creates an empty library and adds it to the library table. The library file is created. + * Create an empty library and adds it to the library table. The library file is created. */ bool CreateLibrary( const wxString& aFilePath, SYMBOL_LIB_TABLE* aTable ) { @@ -144,7 +145,7 @@ public: } /** - * Adds an existing library. The library is added to the library table as well. + * Add an existing library. The library is added to the library table as well. */ bool AddLibrary( const wxString& aFilePath, SYMBOL_LIB_TABLE* aTable ) { @@ -152,94 +153,98 @@ public: } /** - * Updates the part buffer with a new version of the part. + * Update the part buffer with a new version of the part. * The library buffer creates a copy of the part. * It is required to save the library to use the updated part in the schematic editor. */ bool UpdatePart( LIB_PART* aPart, const wxString& aLibrary ); /** - * Updates the part buffer with a new version of the part when the name has changed. + * Update the part buffer with a new version of the part when the name has changed. * The old library buffer will be deleted and a new one created with the new name. */ bool UpdatePartAfterRename( LIB_PART* aPart, const wxString& oldAlias, const wxString& aLibrary ); /** - * Removes the part from the part buffer. + * Remove the part from the part buffer. * It is required to save the library to have the part removed in the schematic editor. */ bool RemovePart( const wxString& aName, const wxString& aLibrary ); /** - * Returns either an alias of a working LIB_PART copy, or alias of the original part if there + * Return either an alias of a working LIB_PART copy, or alias of the original part if there * is no working copy. */ LIB_PART* GetAlias( const wxString& aAlias, const wxString& aLibrary ) const; /** - * Returns the part copy from the buffer. In case it does not exist yet, the copy is created. - * SYMBOL_LIBRARY_MANAGER retains the ownership. + * Return the part copy from the buffer. In case it does not exist yet, the copy is created. + * #SYMBOL_LIBRARY_MANAGER retains the ownership. */ LIB_PART* GetBufferedPart( const wxString& aAlias, const wxString& aLibrary ); /** - * Returns the screen used to edit a specific part. SYMBOL_LIBRARY_MANAGER retains the ownership. + * Return the screen used to edit a specific part. #SYMBOL_LIBRARY_MANAGER retains the + * ownership. */ SCH_SCREEN* GetScreen( const wxString& aAlias, const wxString& aLibrary ); /** - * Returns true if part with a specific alias exists in library (either original one or + * Return true if part with a specific alias exists in library (either original one or * buffered). */ bool PartExists( const wxString& aAlias, const wxString& aLibrary ) const; /** - * Returns true if library exists. If \a aCheckEnabled is set, then the library must + * Return true if library exists. If \a aCheckEnabled is set, then the library must * also be enabled in the library table. */ bool LibraryExists( const wxString& aLibrary, bool aCheckEnabled = false ) const; /** - * Returns true if the library was successfully loaded + * Return true if the library was successfully loaded. */ bool IsLibraryLoaded( const wxString& aLibrary ) const; /** - * Returns true if library has unsaved modifications. + * Return true if library has unsaved modifications. */ bool IsLibraryModified( const wxString& aLibrary ) const; /** - * Returns true if part has unsaved modifications. + * Return true if part has unsaved modifications. */ bool IsPartModified( const wxString& aAlias, const wxString& aLibrary ) const; /** - * Clears the modified flag for all parts in a library. + * Clear the modified flag for all parts in a library. */ bool ClearLibraryModified( const wxString& aLibrary ) const; /** - * Clears the modified flag for a part. + * Clear the modified flag for a part. */ bool ClearPartModified( const wxString& aAlias, const wxString& aLibrary ) const; /** - * Returns true if the library is stored in a read-only file. + * Return true if the library is stored in a read-only file. + * * @return True on success, false otherwise. */ bool IsLibraryReadOnly( const wxString& aLibrary ) const; /** - * Saves part changes to the library copy used by the schematic editor. Not it is not + * Save part changes to the library copy used by the schematic editor. Not it is not * necessarily saved to the file. + * * @return True on success, false otherwise. */ bool FlushPart( const wxString& aAlias, const wxString& aLibrary ); /** - * Saves library to a file, including unsaved changes. + * Save library to a file, including unsaved changes. + * * @param aLibrary is the library name. * @param aFileName is the target file name. * @return True on success, false otherwise. @@ -248,14 +253,16 @@ public: SCH_IO_MGR::SCH_FILE_T aFileType = SCH_IO_MGR::SCH_FILE_T::SCH_LEGACY ); /** - * Reverts unsaved changes for a particular part. + * Revert unsaved changes for a particular part. + * * @return The LIB_ID of the reverted part (which may be different in the case * of a rename) */ LIB_ID RevertPart( const wxString& aAlias, const wxString& aLibrary ); /** - * Reverts unsaved changes for a particular library. + * Revert unsaved changes for a particular library. + * * @return True on success, false otherwise. */ bool RevertLibrary( const wxString& aLibrary ); @@ -268,13 +275,13 @@ public: bool RevertAll(); /** - * Returns a library name that is not currently in use. + * Return a library name that is not currently in use. * Used for generating names for new libraries. */ wxString GetUniqueLibraryName() const; /** - * Returns the adapter object that provides the stored data. + * Return the adapter object that provides the stored data. */ wxObjectDataPtr& GetAdapter() { return m_adapter; } @@ -289,13 +296,13 @@ public: bool HasDerivedSymbols( const wxString& aSymbolName, const wxString& aLibraryName ); private: - ///> Extracts library name basing on the file name + ///< Extract library name basing on the file name. static wxString getLibraryName( const wxString& aFilePath ); - ///> Helper function to add either existing or create new library + ///< Helper function to add either existing or create new library bool addLibrary( const wxString& aFilePath, bool aCreate, SYMBOL_LIB_TABLE* aTable ); - ///> Returns the current Symbol Library Table + ///< Return the current Symbol Library Table. SYMBOL_LIB_TABLE* symTable() const; SYMBOL_TREE_SYNCHRONIZING_ADAPTER* getAdapter() @@ -303,7 +310,7 @@ private: return static_cast( m_adapter.get() ); } - ///> Class to store a working copy of a LIB_PART object and editor context. + ///< Class to store a working copy of a LIB_PART object and editor context. class PART_BUFFER { public: @@ -319,7 +326,7 @@ private: bool IsModified() const; SCH_SCREEN* GetScreen() const { return m_screen.get(); } - ///> Transfer the screen ownership + ///< Transfer the screen ownership std::unique_ptr RemoveScreen() { return std::move( m_screen ); @@ -343,7 +350,7 @@ private: }; - ///> Class to store a working copy of a library + ///< Store a working copy of a library. class LIB_BUFFER { public: @@ -368,13 +375,13 @@ private: int GetHash() const { return m_hash; } - ///> Returns the working copy of a LIB_PART root object with specified alias. + ///< Return the working copy of a LIB_PART root object with specified alias. LIB_PART* GetPart( const wxString& aAlias ) const; - ///> Creates a new buffer to store a part. LIB_BUFFER takes ownership of aCopy. + ///< Create a new buffer to store a part. LIB_BUFFER takes ownership of aCopy. bool CreateBuffer( LIB_PART* aCopy, SCH_SCREEN* aScreen ); - ///> Updates the buffered part with the contents of \a aCopy. + ///< Update the buffered part with the contents of \a aCopy. bool UpdateBuffer( PART_BUFFER::PTR aPartBuf, LIB_PART* aCopy ); bool DeleteBuffer( PART_BUFFER::PTR aPartBuf ); @@ -384,32 +391,31 @@ private: m_deleted.clear(); } - ///> Saves stored modifications to Symbol Lib Table. It may result in saving the symbol - ///> to disk as well, depending on the row properties. + ///< Save stored modifications to Symbol Lib Table. It may result in saving the symbol + ///< to disk as well, depending on the row properties. bool SaveBuffer( PART_BUFFER::PTR aPartBuf, SYMBOL_LIB_TABLE* aLibTable ); - ///> Saves stored modifications using a plugin. aBuffer decides whether the changes - ///> should be cached or stored directly to the disk (for SCH_LEGACY_PLUGIN). + ///< Save stored modifications using a plugin. aBuffer decides whether the changes + ///< should be cached or stored directly to the disk (for SCH_LEGACY_PLUGIN). bool SaveBuffer( PART_BUFFER::PTR aPartBuf, SCH_PLUGIN* aPlugin, bool aBuffer ); - ///> Returns a part buffer with LIB_PART holding a particular alias + ///< Return a part buffer with LIB_PART holding a particular alias PART_BUFFER::PTR GetBuffer( const wxString& aAlias ) const; - ///> Returns all buffered parts + ///< Return all buffered parts const std::deque& GetBuffers() const { return m_parts; } /** - * Checks to see any parts in the buffer are derived from a parent named \a aParentName. + * Check to see any parts in the buffer are derived from a parent named \a aParentName. * * @param aParentName is the name of the parent to test. - * * @return true if any symbols are found derived from a symbol named \a aParent, otherwise * false. */ bool HasDerivedSymbols( const wxString& aParentName ) const; /** - * Fetchs a list of root symbols names from the library buffer. + * Fetch a list of root symbols names from the library buffer. * * @param aRootSymbolNames is a reference to a list to populate with root symbol names. */ @@ -421,7 +427,6 @@ private: * @param aSymbolName is the name of the symbol to search for derived parts in this * buffer. * @param aList is the list of symbols names derived from \a aSymbolName. - * * @return a size_t count of the number of symbols derived from \a aSymbolName. */ size_t GetDerivedSymbolNames( const wxString& aSymbolName, wxArrayString& aList ); @@ -431,7 +436,6 @@ private: * Remove all symbols derived from \a aParent from the library buffer. * * @param aParent is the #PART_BUFFER to check against. - * * @return the count of #PART_BUFFER objects removed from the library. */ int removeChildSymbols( PART_BUFFER::PTR aPartBuf ); @@ -443,17 +447,17 @@ private: }; /** - * Returns a set of LIB_PART objects belonging to the original library + * Return a set of #LIB_PART objects belonging to the original library. */ std::set getOriginalParts( const wxString& aLibrary ); /** - * Returns an existing library buffer or creates one to using Symbol Library Table to get + * Return an existing library buffer or creates one to using Symbol Library Table to get * the original data. */ LIB_BUFFER& getLibraryBuffer( const wxString& aLibrary ); - ///> The library buffers + ///< The library buffers std::map m_libs; SYMBOL_EDIT_FRAME& m_frame; ///< Parent frame diff --git a/eeschema/symbol_tree_synchronizing_adapter.h b/eeschema/symbol_tree_synchronizing_adapter.h index 43cf32828e..c3689c690c 100644 --- a/eeschema/symbol_tree_synchronizing_adapter.h +++ b/eeschema/symbol_tree_synchronizing_adapter.h @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -40,10 +42,10 @@ public: bool IsContainer( const wxDataViewItem& aItem ) const override; void Sync( bool aForce = false, - std::function aProgressCallback = [](int, int, const wxString&){} ); + std::function aProgressCallback = [](int, int, const wxString&){} ); int GetLibrariesCount() const override; - + TOOL_INTERACTIVE* GetContextMenuTool() override; protected: @@ -56,16 +58,17 @@ protected: bool GetAttr( wxDataViewItem const& aItem, unsigned int aCol, wxDataViewItemAttr& aAttr ) const override; - SYMBOL_TREE_SYNCHRONIZING_ADAPTER( SYMBOL_EDIT_FRAME* aParent, SYMBOL_LIBRARY_MANAGER* aLibMgr ); + SYMBOL_TREE_SYNCHRONIZING_ADAPTER( SYMBOL_EDIT_FRAME* aParent, + SYMBOL_LIBRARY_MANAGER* aLibMgr ); protected: SYMBOL_EDIT_FRAME* m_frame; SYMBOL_LIBRARY_MANAGER* m_libMgr; - ///> Hashes to decide whether a library needs an update + ///< Hashes to decide whether a library needs an update. std::map m_libHashes; - ///> SYMBOL_LIBRARY_MANAGER hash value returned in the last synchronization + ///< SYMBOL_LIBRARY_MANAGER hash value returned in the last synchronization. int m_lastSyncHash; }; diff --git a/eeschema/tools/backannotate.h b/eeschema/tools/backannotate.h index 9b2771b5aa..2fbb73c463 100644 --- a/eeschema/tools/backannotate.h +++ b/eeschema/tools/backannotate.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 Alexander Shuklin - * Copyright (C) 2004-2020 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 * modify it under the terms of the GNU General Public License @@ -40,23 +40,23 @@ class SCH_EDIT_FRAME; /** - * @brief Back annotation algorithm class used to recieve, check, and apply a \ref NETLIST from - * PCBNEW. + * Back annotation algorithm class used to receive, check, and apply a \ref NETLIST from + * Pcbnew. + * * The following checks are made: - * - Schematic symbol exists, but linked PCBnew footprint missing - * - PCBnew footprint exists but no schematic symbol connected to - * - PCBnew footprint is standalone + * - Schematic symbol exists, but linked Pcbnew footprint missing. + * - Pcbnew footprint exists but no schematic symbol connected to. + * - Pcbnew footprint is standalone. * - Schematic sheet is reused one or more times and user trying to change footprint or value - * only for few of them. - * - Schematic symbols share same path - * - More than one PCBnew footprint linked to same path - + * only for few of them. + * - Schematic symbols share same path. + * - More than one Pcbnew footprint linked to same path. */ class BACK_ANNOTATE { public: /** - * @brief Struct to hold PCBnew footprint data + * Struct to hold Pcbnew footprint data. */ struct PCB_FP_DATA { @@ -74,7 +74,7 @@ public: std::map m_pinMap; }; - ///> Map to hold NETLIST footprints data + ///< Map to hold NETLIST footprints data using PCB_FOOTPRINTS_MAP = std::map>; using CHANGELIST_ITEM = std::pair>; @@ -85,7 +85,8 @@ public: ~BACK_ANNOTATE(); /** - * @brief Get netlist from the PCBnew. + * Get netlist from the Pcbnew. + * * @param aNetlist reference to where netlist will be stored * @return true if success */ @@ -94,14 +95,40 @@ public: void PushNewLinksToPCB(); /** - * @brief Run back annotation algorithm. If any errors, back annotation doesn't run. - * only report + * Run back annotation algorithm. If any errors, back annotation doesn't run. + * * @param aNetlist netlist to run back annotation from * @return true if success */ bool BackAnnotateSymbols( const std::string& aNetlist ); private: + /** + * Parse netlist sent over KiWay express mail interface and fill \ref m_pcbModules. + * + * @param aPayload - netlist from Pcbnew + * @return number of errors during parsing + */ + void getPcbModulesFromString( const std::string& aPayload ); + + ///< Create changelist + void getChangeList(); + + /** + * Check if some symbols are not represented in PCB footprints and vice versa. + * \ref m_refs must be sorted by path + */ + void checkForUnusedSymbols(); + + /** + * Apply changelist to the schematic + */ + void applyChangelist(); + + void processNetNameChange( const wxString& aRef, SCH_PIN* aPin, + const SCH_CONNECTION* aConnection, const wxString& aOldName, + const wxString& aNewName ); + REPORTER& m_reporter; bool m_matchByReference; @@ -119,31 +146,6 @@ private: int m_changesCount; // Number of user-level changes bool m_appendUndo; - - /** - * @brief Parse netlist sent over KiWay epress mail interface and fill \ref m_pcbModules - * @param aPayload - netlist from PCBnew - * @return number of errors during parsing - */ - void getPcbModulesFromString( const std::string& aPayload ); - - ///> Create changelist - void getChangeList(); - - /** - * @brief Check if some symbols are not represented in PCB footprints and vice versa. - * \ref m_refs must be sorted by path - */ - void checkForUnusedSymbols(); - - /** - * @brief Apply changelist to the schematic - */ - void applyChangelist(); - - void processNetNameChange( const wxString& aRef, SCH_PIN* aPin, - const SCH_CONNECTION* aConnection, const wxString& aOldName, - const wxString& aNewName ); }; #endif diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h index 963dcc8a35..c9971a92a8 100644 --- a/eeschema/tools/ee_actions.h +++ b/eeschema/tools/ee_actions.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * Copyright (C) 2019-2020 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 * modify it under the terms of the GNU General Public License @@ -33,9 +33,7 @@ class TOOL_EVENT; class TOOL_MANAGER; /** - * EESCHEMA_ACTIONS - * - * Gathers all the actions that are shared by tools. The instance of SCH_ACTIONS is created + * Gather all the actions that are shared by tools. The instance of SCH_ACTIONS is created * inside of ACTION_MANAGER object that registers the actions. */ class EE_ACTIONS : public ACTIONS @@ -219,7 +217,7 @@ public: static TOOL_ACTION updateNetHighlighting; static TOOL_ACTION highlightNetTool; - ///> @copydoc COMMON_ACTIONS::TranslateLegacyId() + ///< @copydoc COMMON_ACTIONS::TranslateLegacyId() virtual OPT TranslateLegacyId( int aId ) override { return OPT(); diff --git a/eeschema/tools/ee_inspection_tool.h b/eeschema/tools/ee_inspection_tool.h index 9dd7ea6676..e476d8056e 100644 --- a/eeschema/tools/ee_inspection_tool.h +++ b/eeschema/tools/ee_inspection_tool.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * 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 * modify it under the terms of the GNU General Public License @@ -63,7 +63,7 @@ public: int UpdateMessagePanel( const TOOL_EVENT& aEvent ); private: - ///> @copydoc TOOL_INTERACTIVE::setTransitions(); + ///< @copydoc TOOL_INTERACTIVE::setTransitions(); void setTransitions() override; private: diff --git a/eeschema/tools/ee_point_editor.h b/eeschema/tools/ee_point_editor.h index a9c50bd3af..969a8ef34b 100644 --- a/eeschema/tools/ee_point_editor.h +++ b/eeschema/tools/ee_point_editor.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * 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 * modify it under the terms of the GNU General Public License @@ -33,8 +33,6 @@ class EE_SELECTION_TOOL; class SCH_BASE_FRAME; /** - * EE_POINT_EDITOR - * * Tool that displays edit points allowing to modify items by dragging the points. */ class EE_POINT_EDITOR : public EE_TOOL_BASE @@ -51,28 +49,28 @@ public: int Main( const TOOL_EVENT& aEvent ); /** - * Indicates the cursor is over an edit point. Used to coordinate cursor shapes with + * Indicate the cursor is over an edit point. Used to coordinate cursor shapes with * other tools. */ bool HasPoint() { return m_editedPoint != nullptr; } - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; private: - ///> Updates item's points with edit points. + ///< Update item's points with edit points. void updateParentItem() const; - ///> Updates edit points with item's points. + ///< Update edit points with item's points. void updatePoints(); - ///> Updates which point is being edited. + ///< Update which point is being edited. void updateEditedPoint( const TOOL_EVENT& aEvent ); - ///> Sets the current point being edited. NULL means none. + ///< Set the current point being edited. NULL means none. void setEditedPoint( EDIT_POINT* aPoint ); - ///> Returns true if aPoint is the currently modified point. + ///< Return true if \a aPoint is the currently modified point. inline bool isModified( const EDIT_POINT& aPoint ) const { return m_editedPoint == &aPoint; @@ -101,10 +99,10 @@ private: void rollbackFromUndo(); private: - ///> Currently edited point, NULL if there is none. + ///< Currently edited point, NULL if there is none. EDIT_POINT* m_editedPoint; - ///> Currently available edit points. + ///< Currently available edit points. std::shared_ptr m_editPoints; }; diff --git a/eeschema/tools/ee_selection_tool.h b/eeschema/tools/ee_selection_tool.h index 22d2316491..fb3bf32af1 100644 --- a/eeschema/tools/ee_selection_tool.h +++ b/eeschema/tools/ee_selection_tool.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * 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 * modify it under the terms of the GNU General Public License @@ -66,8 +66,6 @@ public: int UpdateMenu( const TOOL_EVENT& aEvent ); /** - * Function Main() - * * The main loop. */ int Main( const TOOL_EVENT& aEvent ); @@ -75,30 +73,25 @@ public: void OnIdle( wxIdleEvent& aEvent ); /** - * Function GetSelection() - * - * Returns the set of currently selected items. + * Return the set of currently selected items. */ EE_SELECTION& GetSelection(); /** - * Function RequestSelection() - * - * Returns either an existing selection (filtered), or the selection at the current + * Return either an existing selection (filtered), or the selection at the current * cursor if the existing selection is empty. */ EE_SELECTION& RequestSelection( const KICAD_T* aFilterList = EE_COLLECTOR::AllItems ); /** - * Function SelectPoint() - * This overload of SelectPoint will create an EE_COLLECTOR and collect hits at location aWhere + * This overload of SelectPoint will create an EE_COLLECTOR and collect hits at location aWhere * before calling the primary SelectPoint method. * * @param aWhere is the location where the item(s) should be collected * @param aItem is set to the newly selected item if only one was selected, otherwise is * unchanged. * @param aSelectionCancelledFlag allows the function to inform its caller that a selection - * was cancelled (for instance, by clicking outside of the + * was canceled (for instance, by clicking outside of the * disambiguation menu). * @param aCheckLocked indicates if locked items should be excluded. * @param aAdd indicates if found item(s) should be added to the selection @@ -125,26 +118,26 @@ public: void SelectHighlightItem( EDA_ITEM* aItem ) { highlight( aItem, SELECTED ); } - ///> Find (but don't select) node under cursor + ///< Find (but don't select) node under cursor EDA_ITEM* GetNode( VECTOR2I aPosition ); - ///> Select node under cursor + ///< Select node under cursor int SelectNode( const TOOL_EVENT& aEvent ); - ///> If node selected then expand to connection, otherwise select connection under cursor + ///< If node selected then expand to connection, otherwise select connection under cursor int SelectConnection( const TOOL_EVENT& aEvent ); - ///> Clear current selection event handler. + ///< Clear current selection event handler. int ClearSelection( const TOOL_EVENT& aEvent ); - ///> Select all visible items in sheet + ///< Select all visible items in sheet int SelectAll( const TOOL_EVENT& aEvent ); void ClearSelection(); /** - * Function Selectable() - * Checks conditions for an item to be selected. + * Check conditions for an item to be selected. + * * @return True if the item fulfills conditions to be selected. */ bool Selectable( const EDA_ITEM* aItem, bool checkVisibilityOnly = false ) const; @@ -156,23 +149,23 @@ public: void GuessSelectionCandidates( EE_COLLECTOR& collector, const VECTOR2I& aPos ); /** - * Function SelectionMenu() - * Shows a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single + * Show a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single * item. * - * NOTE: this routine DOES NOT modify the selection. + * @note This routine **does not** modify the selection. */ int SelectionMenu( const TOOL_EVENT& aEvent ); /** - * Rebuilds the selection from the EDA_ITEMs' selection flags. Commonly called after - * rolling back an undo state to make sure there aren't any stale pointers. + * Rebuild the selection from the EDA_ITEMs' selection flags. + * + * Commonly called after rolling back an undo state to make sure there aren't any stale + * pointers. */ void RebuildSelection(); /** - * Function CollectHits() - * Selects one or more items at the location given by parameter aWhere. + * Select one or more items at the location given by parameter aWhere. * * This method does not attempt to disambiguate multiple items and is simply "collecting" * @@ -186,16 +179,12 @@ public: private: /** - * Applies rules to narrow the collection down to selectable objects, and then heuristics + * Apply rules to narrow the collection down to selectable objects, and then heuristics * to try and narrow it to a single object. - * @param collector - * @param aWhere - * @param aCheckLocked */ void narrowSelection( EE_COLLECTOR& collector, const VECTOR2I& aWhere, bool aCheckLocked ); /** - * Function SelectPoint() * This is the primary SelectPoint method that will prompt the user with a menu to disambiguate * multiple selections and then finish by adding, subtracting or toggling the item(s) to the * actual selection group. @@ -204,7 +193,7 @@ private: * @param aItem is set to the newly selected item if only one was selected, otherwise is * unchanged. * @param aSelectionCancelledFlag allows the function to inform its caller that a selection - * was cancelled (for instance, by clicking outside of the + * was canceled (for instance, by clicking outside of the * disambiguation menu). * @param aAdd indicates if found item(s) should be added to the selection * @param aSubtract indicates if found item(s) should be subtracted from the selection @@ -215,41 +204,38 @@ private: bool aSubtract = false, bool aExclusiveOr = false ); /** - * Function selectMultiple() - * Handles drawing a selection box that allows one to select many items at - * the same time. + * Handle drawing a selection box that allows one to select many items at the same time. * - * @return true if the function was cancelled (i.e. CancelEvent was received). + * @return true if the function was canceled (i.e. CancelEvent was received). */ bool selectMultiple(); /** - * Allows the selection of a single item from a list via pop-up menu. The items are + * Allow the selection of a single item from a list via pop-up menu. The items are * highlighted on the canvas when hovered in the menu. The collector is trimmed to * the picked item. + * * @return true if an item was picked */ bool doSelectionMenu( EE_COLLECTOR* aItems ); /** - * Function select() - * Takes necessary action mark an item as selected. + * Take necessary action mark an item as selected. * * @param aItem is an item to be selected. */ void select( EDA_ITEM* aItem ); /** - * Function unselect() - * Takes necessary action mark an item as unselected. + * Take necessary action mark an item as unselected. * * @param aItem is an item to be unselected. */ void unselect( EDA_ITEM* aItem ); /** - * Function highlight() - * Highlights the item visually. + * Highlight the item visually. + * * @param aItem is an item to be be highlighted. * @param aHighlightMode should be either SELECTED or BRIGHTENED * @param aGroup is the group to add the item to in the BRIGHTENED mode. @@ -257,8 +243,8 @@ private: void highlight( EDA_ITEM* aItem, int aHighlightMode, EE_SELECTION* aGroup = nullptr ); /** - * Function unhighlight() - * Unhighlights the item visually. + * Unhighlight the item visually. + * * @param aItem is an item to be be highlighted. * @param aHighlightMode should be either SELECTED or BRIGHTENED * @param aGroup is the group to remove the item from. @@ -266,17 +252,16 @@ private: void unhighlight( EDA_ITEM* aItem, int aHighlightMode, EE_SELECTION* aGroup = nullptr ); /** - * Sets the reference point to the anchor of the top-left item. + * Set the reference point to the anchor of the top-left item. */ void updateReferencePoint(); /** - * Function selectionContains() * @return True if the given point is contained in any of selected items' bounding box. */ bool selectionContains( const VECTOR2I& aPoint ) const; - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; private: diff --git a/eeschema/tools/ee_tool_base.h b/eeschema/tools/ee_tool_base.h index 3892adeab9..49c472ce48 100644 --- a/eeschema/tools/ee_tool_base.h +++ b/eeschema/tools/ee_tool_base.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * Copyright (C) 2019-2020 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 * modify it under the terms of the GNU General Public License @@ -40,10 +40,8 @@ class EE_SELECTION; /** - * EE_TOOL_BASE - * - * A foundation class for a tool operating on a schematic or symbol -**/ + * A foundation class for a tool operating on a schematic or symbol. + */ template @@ -51,9 +49,7 @@ class EE_TOOL_BASE : public TOOL_INTERACTIVE { public: /** - * Constructor - * - * Creates a tool with given name. The name must be unique. + * Create a tool with given name. The name must be unique. */ EE_TOOL_BASE( const std::string& aName ) : TOOL_INTERACTIVE ( aName ), @@ -72,8 +68,7 @@ public: m_selectionTool = m_toolMgr->GetTool(); m_isSymbolEditor = m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ); - // A basic context manu. Many (but not all) tools will choose to override this. - + // A basic context menu. Many (but not all) tools will choose to override this. auto& ctxMenu = m_menu.GetMenu(); // cancel current tool goes in main context menu at the top if present @@ -133,8 +128,8 @@ protected: } } - ///> Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their - ///> parents. + ///< Similar to m_frame->SaveCopyInUndoList(), but handles items that are owned by their + ///< parents. void saveCopyInUndoList( EDA_ITEM* aItem, UNDO_REDO aType, bool aAppend = false ) { KICAD_T itemType = aItem->Type(); diff --git a/eeschema/tools/reannotate.h b/eeschema/tools/reannotate.h index c76d2315f5..ea0ba9d7c1 100644 --- a/eeschema/tools/reannotate.h +++ b/eeschema/tools/reannotate.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2020 Brian Piccioni brian@documenteddesigns.com - * Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -27,8 +27,7 @@ #include /** - * Class WX_STRING_REPORTER - * is a wrapper for reporting to a wxString object. + * A wrapper for reporting to a wxString object. */ class WX_STRING_REPORTER_FILTERED : public REPORTER { @@ -43,8 +42,8 @@ public: bool HasMessage() const override; }; -///> Backannotate the schematic with a netlist sent from PCBNew. -///> Reply with a string consisting of errors or warnings. If empty no errors +///< Backannotate the schematic with a netlist sent from Pcbnew. +///< Reply with a string consisting of errors or warnings. If empty no errors void ReannotateFromPCBNew( SCH_EDIT_FRAME* aFrame, std::string& aNetlist ); #endif /* EESCHEMA_TOOLS_REANNOTATE_H_ */ diff --git a/eeschema/tools/sch_drawing_tools.h b/eeschema/tools/sch_drawing_tools.h index 94e88e1abb..aae9b610dc 100644 --- a/eeschema/tools/sch_drawing_tools.h +++ b/eeschema/tools/sch_drawing_tools.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * 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 * modify it under the terms of the GNU General Public License @@ -38,9 +38,7 @@ class EE_SELECTION_TOOL; /** - * SCH_DRAWING_TOOLS - * - * Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.) + * Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.). */ class SCH_DRAWING_TOOLS : public EE_TOOL_BASE @@ -60,7 +58,8 @@ public: private: /** - * Gets the next queued text item + * Get the next queued text item. + * * @return next SCH_TEXT* or nullptr if empty */ SCH_TEXT* createNewText( const VECTOR2I& aPosition, int aType ); @@ -71,11 +70,9 @@ private: void sizeSheet( SCH_SHEET* aSheet, VECTOR2I aPos ); - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; -private: -// History lists for PlaceComponent() std::vector m_symbolHistoryList; std::vector m_powerHistoryList; diff --git a/eeschema/tools/sch_edit_tool.h b/eeschema/tools/sch_edit_tool.h index 75677a8136..21c257c38e 100644 --- a/eeschema/tools/sch_edit_tool.h +++ b/eeschema/tools/sch_edit_tool.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * Copyright (C) 2019-2020 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 * modify it under the terms of the GNU General Public License @@ -72,16 +72,16 @@ public: int CleanupSheetPins( const TOOL_EVENT& aEvent ); int GlobalEdit( const TOOL_EVENT& aEvent ); - ///> Deletes the selected items, or the item under the cursor. + ///< Delete the selected items, or the item under the cursor. int DoDelete( const TOOL_EVENT& aEvent ); - ///> Runs the deletion tool. + ///< Run the deletion tool. int DeleteItemCursor( const TOOL_EVENT& aEvent ); private: void editFieldText( SCH_FIELD* aField ); - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; private: diff --git a/eeschema/tools/sch_editor_control.h b/eeschema/tools/sch_editor_control.h index e58b5baf04..a54fcd81ed 100644 --- a/eeschema/tools/sch_editor_control.h +++ b/eeschema/tools/sch_editor_control.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * 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 * modify it under the terms of the GNU General Public License @@ -33,9 +33,7 @@ class SCH_EDIT_FRAME; /** - * SCH_EDITOR_CONTROL - * - * Handles actions specific to the schematic editor in eeschema. + * Handle actions specific to the schematic editor. */ class SCH_EDITOR_CONTROL : public wxEvtHandler, public EE_TOOL_BASE { @@ -80,11 +78,11 @@ public: int UpdateFind( const TOOL_EVENT& aEvent ); - ///> Notifies pcbnew about the selected item. + ///< Notifies pcbnew about the selected item. int CrossProbeToPcb( const TOOL_EVENT& aEvent ); - ///> Equivalent to the above, but initiated by the user. We also do SCH_SHEETs on this - ///> one (they're too slow on big projects for the auto version above). + ///< Equivalent to the above, but initiated by the user. We also do SCH_SHEETs on this + ///< one (they're too slow on big projects for the auto version above). int ExplicitCrossProbeToPcb( const TOOL_EVENT& aEvent ); #ifdef KICAD_SPICE @@ -92,16 +90,16 @@ public: int SimTune( const TOOL_EVENT& aEvent ); #endif /* KICAD_SPICE */ - ///> Highlights net under the cursor. + ///< Highlight net under the cursor. int HighlightNet( const TOOL_EVENT& aEvent ); - ///> Removes any net highlighting + ///< Remove any net highlighting int ClearHighlight( const TOOL_EVENT& aEvent ); - ///> Updates net highlighting after an edit + ///< Update net highlighting after an edit int UpdateNetHighlighting( const TOOL_EVENT& aEvent ); - ///> Launches a tool to highlight nets. + ///< Launch a tool to highlight nets. int HighlightNetCursor( const TOOL_EVENT& aEvent ); int AssignNetclass( const TOOL_EVENT& aEvent ); @@ -109,7 +107,7 @@ public: int Undo( const TOOL_EVENT& aEvent ); int Redo( const TOOL_EVENT& aEvent ); - ///> Clipboard support. + ///< Clipboard support. int Cut( const TOOL_EVENT& aEvent ); int Copy( const TOOL_EVENT& aEvent ); int Paste( const TOOL_EVENT& aEvent ); @@ -140,7 +138,7 @@ public: void AssignFootprints( const std::string& aChangedSetOfReferences ); /** - * Finds a component in the schematic and an item in this component. + * Find a component in the schematic and an item in this component. * * @param aReference The component reference designator to find. * @param aSearchHierarchy If false, search the current sheet only. Otherwise, @@ -154,7 +152,7 @@ public: const wxString& aSearchText ); private: - ///> copy selection to clipboard + ///< copy selection to clipboard bool doCopy(); bool rescueProject( RESCUER& aRescuer, bool aRunningOnDemand ); @@ -190,11 +188,12 @@ private: bool aForceVisibilityState, bool aVisibilityState ); - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; /** - * Advances the search and returns the next matching item after aAfter + * Advance the search and returns the next matching item after \a aAfter. + * * @param aScreen Pointer to the screen used for searching * @param aAfter Starting match to compare * @param aData Search data to compare against or NULL to match the first item found @@ -204,7 +203,7 @@ private: wxFindReplaceData* aData ); private: - bool m_probingPcbToSch; // Recursion guard when cross-probing to PCBNew + bool m_probingPcbToSch; // Recursion guard when cross-probing to PcbNew EDA_ITEM* m_pickerItem; // Current item for picker highlighting. // A map of sheet filename --> screens for the clipboard contents. We use these to hook up diff --git a/eeschema/tools/sch_line_wire_bus_tool.h b/eeschema/tools/sch_line_wire_bus_tool.h index affc364431..36ddf3c3ff 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.h +++ b/eeschema/tools/sch_line_wire_bus_tool.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * 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 * modify it under the terms of the GNU General Public License @@ -67,8 +67,6 @@ struct DRAW_SEGMENT_EVENT_PARAMS }; /** - * SCH_LINE_DRAWING_TOOL - * * Tool responsible for drawing/placing items (symbols, wires, buses, labels, etc.) */ @@ -102,24 +100,24 @@ private: void finishSegments(); /** - * Iterates over the wire list and removes the null segments and - * overlapping segments to create a simplified wirelist + * Iterate over the wire list and removes the null segments and + * overlapping segments to create a simplified wire list */ void simplifyWireList(); - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; /** - * Searches for a sheet pin at a location + * Search for a sheet pin at a location. + * * @param aPosition grid point to search for existing sheet pin * @return Pointer to sheet pin or nullptr on failure */ const SCH_SHEET_PIN* getSheetPin( const wxPoint& aPosition ); /** - * Function ComputeBreakPoint - * computes the middle coordinate for 2 segments from the start point to \a aPosition + * Compute the middle coordinate for 2 segments from the start point to \a aPosition * with the segments kept in the horizontal or vertical axis only. * * @param aSegments A pair of pointers to a #SCH_LINE objects containing the first line diff --git a/eeschema/tools/sch_move_tool.h b/eeschema/tools/sch_move_tool.h index a9cc771b18..729e309322 100644 --- a/eeschema/tools/sch_move_tool.h +++ b/eeschema/tools/sch_move_tool.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * 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 * modify it under the terms of the GNU General Public License @@ -50,12 +50,13 @@ public: bool Init() override; /** - * Runs an interactive move of the selected items, or the item under the cursor. + * Run an interactive move of the selected items, or the item under the cursor. */ int Main( const TOOL_EVENT& aEvent ); /** - * Aligns selected elements to the grid + * Align selected elements to the grid. + * * @param aEvent current event that activated the tool * @return 0 */ @@ -64,27 +65,27 @@ public: private: void moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta ); - ///> Finds additional items for a drag operation. - ///> Connected items with no wire are included (as there is no wire to adjust for the drag). - ///> Connected wires are included with any un-connected ends flagged (STARTPOINT or ENDPOINT). + ///< Find additional items for a drag operation. + ///< Connected items with no wire are included (as there is no wire to adjust for the drag). + ///< Connected wires are included with any un-connected ends flagged (STARTPOINT or ENDPOINT). void getConnectedDragItems( SCH_ITEM* aOriginalItem, wxPoint aPoint, EDA_ITEMS& aList ); - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; private: - ///> Flag determining if anything is being dragged right now + ///< Flag determining if anything is being dragged right now bool m_moveInProgress; bool m_isDragOperation; - ///> Items (such as wires) which were added to the selection for a drag + ///< Items (such as wires) which were added to the selection for a drag EDA_ITEMS m_dragAdditions; - ///> Used for chaining commands + ///< Used for chaining commands VECTOR2I m_moveOffset; - ///> Last cursor position (needed for getModificationPoint() to avoid changes - ///> of edit reference point). + ///< Last cursor position (needed for getModificationPoint() to avoid changes + ///< of edit reference point). VECTOR2I m_cursor; boost::optional m_anchorPos; diff --git a/eeschema/tools/sch_navigate_tool.h b/eeschema/tools/sch_navigate_tool.h index 1f6e5db66d..58773c331d 100644 --- a/eeschema/tools/sch_navigate_tool.h +++ b/eeschema/tools/sch_navigate_tool.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * 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 * modify it under the terms of the GNU General Public License @@ -33,9 +33,7 @@ class SCH_EDIT_FRAME; /** - * SCH_NAVIGATE_TOOL - * - * Handles actions specific to the schematic editor in eeschema. + * Handle actions specific to the schematic editor. */ class SCH_NAVIGATE_TOOL : public wxEvtHandler, public EE_TOOL_BASE { @@ -52,7 +50,7 @@ public: int HypertextCommand( const TOOL_EVENT& aEvent ); private: - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; private: diff --git a/eeschema/tools/symbol_editor_control.h b/eeschema/tools/symbol_editor_control.h index 2926aeb5f3..2f31e6d457 100644 --- a/eeschema/tools/symbol_editor_control.h +++ b/eeschema/tools/symbol_editor_control.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * Copyright (C) 2019-2020 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 * modify it under the terms of the GNU General Public License @@ -70,7 +70,7 @@ public: int ToggleSyncedPinsMode( const TOOL_EVENT& aEvent ); private: - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; }; diff --git a/eeschema/tools/symbol_editor_edit_tool.h b/eeschema/tools/symbol_editor_edit_tool.h index d0de298b5f..d735940006 100644 --- a/eeschema/tools/symbol_editor_edit_tool.h +++ b/eeschema/tools/symbol_editor_edit_tool.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * 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 * modify it under the terms of the GNU General Public License @@ -55,13 +55,11 @@ public: int Paste( const TOOL_EVENT& aEvent ); /** - * Function DoDelete() - * - * Deletes the selected items, or the item under the cursor. + * Delete the selected items, or the item under the cursor. */ int DoDelete( const TOOL_EVENT& aEvent ); - ///> Runs the deletion tool. + ///< Run the deletion tool. int DeleteItemCursor( const TOOL_EVENT& aEvent ); private: @@ -70,10 +68,9 @@ private: void editFieldProperties( LIB_FIELD* aField ); void editSymbolProperties(); - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; -private: EDA_ITEM* m_pickerItem; }; diff --git a/eeschema/tools/symbol_editor_move_tool.h b/eeschema/tools/symbol_editor_move_tool.h index e55fa22380..8a948b387e 100644 --- a/eeschema/tools/symbol_editor_move_tool.h +++ b/eeschema/tools/symbol_editor_move_tool.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * 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 * modify it under the terms of the GNU General Public License @@ -45,27 +45,24 @@ public: void Reset( RESET_REASON aReason ) override; /** - * Function Main() - * - * Runs an interactive move of the selected items, or the item under the cursor. + * Run an interactive move of the selected items, or the item under the cursor. */ int Main( const TOOL_EVENT& aEvent ); private: void moveItem( EDA_ITEM* aItem, VECTOR2I aDelta ); - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; -private: - ///> Flag determining if anything is being dragged right now + ///< Flag determining if anything is being dragged right now bool m_moveInProgress; - ///> Used for chaining commands + ///< Used for chaining commands VECTOR2I m_moveOffset; - ///> Last cursor position (needed for getModificationPoint() to avoid changes - ///> of edit reference point). + ///< Last cursor position (needed for getModificationPoint() to avoid changes + ///< of edit reference point). VECTOR2I m_cursor; VECTOR2I m_anchorPos; }; diff --git a/eeschema/tools/symbol_editor_pin_tool.h b/eeschema/tools/symbol_editor_pin_tool.h index 453f7c0f0d..a771ca485c 100644 --- a/eeschema/tools/symbol_editor_pin_tool.h +++ b/eeschema/tools/symbol_editor_pin_tool.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * 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 * modify it under the terms of the GNU General Public License @@ -51,7 +51,7 @@ public: int PushPinProperties( const TOOL_EVENT& aEvent ); private: - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; }; diff --git a/eeschema/widgets/tuner_slider.h b/eeschema/widgets/tuner_slider.h index d3b5ddece9..1f02f9fe8f 100644 --- a/eeschema/widgets/tuner_slider.h +++ b/eeschema/widgets/tuner_slider.h @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 CERN + * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -35,7 +37,7 @@ class SIM_PLOT_FRAME; class SCH_COMPONENT; /** - * @brief Custom widget to handle quick component values modification and simulation on the fly. + * Custom widget to handle quick component values modification and simulation on the fly. */ class TUNER_SLIDER : public TUNER_SLIDER_BASE { @@ -88,7 +90,7 @@ private: wxString m_spiceName; - ///> Timer that restarts the simulation after the slider value has changed + ///< Timer that restarts the simulation after the slider value has changed wxTimer m_simTimer; SCH_COMPONENT* m_component; diff --git a/gerbview/dialogs/dialog_print_gerbview.cpp b/gerbview/dialogs/dialog_print_gerbview.cpp index 66f1c093fb..68cef383b6 100644 --- a/gerbview/dialogs/dialog_print_gerbview.cpp +++ b/gerbview/dialogs/dialog_print_gerbview.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010-2016 Jean-Pierre Charras jp.charras at wanadoo.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 * Author: Maciej Suminski * @@ -61,16 +61,16 @@ private: void onSelectAllClick( wxCommandEvent& event ); void onDeselectAllClick( wxCommandEvent& event ); - ///> (Un)check all items in a checklist box + ///< (Un)check all items in a checklist box void setListBoxValue( wxCheckListBox* aList, bool aValue ); - ///> Check whether a layer is enabled in a listbox + ///< Check whether a layer is enabled in a listbox bool isLayerEnabled( unsigned int aLayer ) const; - ///> Enable/disable layer in a listbox + ///< Enable/disable layer in a listbox void enableLayer( unsigned int aLayer, bool aValue ); - ///> Update layerset basing on the selected layers + ///< Update layerset basing on the selected layers int setLayerSetFromList(); void saveSettings() override; @@ -190,7 +190,8 @@ void DIALOG_PRINT_GERBVIEW::createLeftPanel() // Select/Unselect all buttons m_buttonSelectAll = new wxButton( sbLayersSizer->GetStaticBox(), wxID_ANY, _( "Select all" ) ); - m_buttonDeselectAll = new wxButton( sbLayersSizer->GetStaticBox(), wxID_ANY, _( "Deselect all" ) ); + m_buttonDeselectAll = new wxButton( sbLayersSizer->GetStaticBox(), wxID_ANY, + _( "Deselect all" ) ); m_buttonSelectAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_GERBVIEW::onSelectAllClick ), NULL, this ); diff --git a/gerbview/gbr_layout.h b/gerbview/gbr_layout.h index 90f0f51bf5..61539d71f0 100644 --- a/gerbview/gbr_layout.h +++ b/gerbview/gbr_layout.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012-2014 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 * modify it under the terms of the GNU General Public License @@ -40,8 +40,7 @@ class GERBER_FILE_IMAGE_LIST; /** - * GBR_LAYOUT - * holds list of GERBER_DRAW_ITEM currently loaded. + * A list of #GERBER_DRAW_ITEM objects currently loaded. */ class GBR_LAYOUT : public EDA_ITEM { @@ -70,15 +69,12 @@ public: void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; } /** - * Function ComputeBoundingBox - * calculates the bounding box containing all Gerber items. - * @return EDA_RECT - the full item list bounding box + * Calculate the bounding box containing all Gerber items. + * + * @return the full item list bounding box. */ EDA_RECT ComputeBoundingBox() const; - /** - * Function GetBoundingBox - */ const EDA_RECT GetBoundingBox() const override { return ComputeBoundingBox(); @@ -86,7 +82,7 @@ public: void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; } - ///> @copydoc EDA_ITEM::Visit() + ///< @copydoc EDA_ITEM::Visit() SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; #if defined(DEBUG) diff --git a/gerbview/gerber_draw_item.h b/gerbview/gerber_draw_item.h index aaa320e9d0..5d9bdf9d53 100644 --- a/gerbview/gerber_draw_item.h +++ b/gerbview/gerber_draw_item.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 1992-2016 - * Copyright (C) 1992-2016 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 * modify it under the terms of the GNU General Public License @@ -63,60 +63,8 @@ enum Gbr_Basic_Shapes { GBR_LAST // last value for this list }; -/***/ - class GERBER_DRAW_ITEM : public EDA_ITEM { - // make SetNext() and SetBack() private so that they may not be called from anywhere. - // list management is done on GERBER_DRAW_ITEMs using DLIST only. -private: - - -public: - bool m_UnitsMetric; // store here the gerber units (inch/mm). Used - // only to calculate aperture macros shapes sizes - int m_Shape; // Shape and type of this gerber item - wxPoint m_Start; // Line or arc start point or position of the shape - // for flashed items - wxPoint m_End; // Line or arc end point - wxPoint m_ArcCentre; // for arcs only: Centre of arc - SHAPE_POLY_SET m_Polygon; // Polygon shape data (G36 to G37 coordinates) - // or for complex shapes which are converted to polygon - wxSize m_Size; // Flashed shapes: size of the shape - // Lines : m_Size.x = m_Size.y = line width - bool m_Flashed; // True for flashed items - int m_DCode; // DCode used to draw this item. - // Allowed values are >= 10. 0 when unknown - // values 0 to 9 can be used for special purposes - // Regions (polygons) doo not use DCode, - // so it is set to 0 - wxString m_AperFunction; // the aperture function set by a %TA.AperFunction, xxx - // (stores thre xxx value). - // used for regions that do not have a attached DCode, but - // have a TA.AperFunction defined - GERBER_FILE_IMAGE* m_GerberImageFile; /* Gerber file image source of this item - * Note: some params stored in this class are common - * to the whole gerber file (i.e) the whole graphic - * layer and some can change when reading the file, - * so they are stored inside this item if there is no - * redundancy for these parameters - */ - -private: - // These values are used to draw this item, according to gerber layers parameters - // Because they can change inside a gerber image, they are stored here - // for each item - bool m_LayerNegative; // true = item in negative Layer - bool m_swapAxis; // false if A = X, B = Y; true if A =Y, B = Y - bool m_mirrorA; // true: mirror / axe A - bool m_mirrorB; // true: mirror / axe B - wxRealPoint m_drawScale; // A and B scaling factor - wxPoint m_layerOffset; // Offset for A and B axis, from OF parameter - double m_lyrRotation; // Fine rotation, from OR parameter, in degrees - GBR_NETLIST_METADATA m_netAttributes; ///< the string given by a %TO attribute set in aperture - ///< (dcode). Stored in each item, because %TO is - ///< a dynamic object attribute - public: GERBER_DRAW_ITEM( GERBER_FILE_IMAGE* aGerberparams ); ~GERBER_DRAW_ITEM(); @@ -125,8 +73,7 @@ public: const GBR_NETLIST_METADATA& GetNetAttributes() const { return m_netAttributes; } /** - * Function GetLayer - * returns the layer this item is on. + * Return the layer this item is on. */ int GetLayer() const; @@ -136,7 +83,8 @@ public: } /** - * Returns the best size and orientation to display the D_Code on screen + * Return the best size and orientation to display the D_Code on screen. + * * @param aSize is a reference to return the text size * @param aPos is a reference to return the text position * @param aOrientation is a reference to return the text orientation @@ -145,24 +93,21 @@ public: bool GetTextD_CodePrms( int& aSize, wxPoint& aPos, double& aOrientation ); /** - * Returns the best size and orientation to display the D_Code in GAL - * aOrientation is returned in radians + * Return the best size and orientation to display the D_Code in GAL + * aOrientation is returned in radians. */ bool GetTextD_CodePrms( double& aSize, VECTOR2D& aPos, double& aOrientation ); /** - * Function HasNegativeItems + * Optimize screen refresh (when no items are in background color refresh can be faster). + * * @return true if this item or at least one shape (when using aperture macros - * must be drawn in background color - * used to optimize screen refresh (when no items are in background color - * refresh can be faster) + * must be drawn in background color. */ bool HasNegativeItems(); /** - * Function SetLayerParameters - * Initialize parameters from Image and Layer parameters - * found in the gerber file: + * Initialize parameters from Image and Layer parameters found in the gerber file: * m_UnitsMetric, * m_MirrorA, m_MirrorB, * m_DrawScale, m_DrawOffset @@ -175,35 +120,37 @@ public: } /** - * Function MoveAB - * move this object. - * @param aMoveVector - the move vector for this object. + * Move this object. + * + * @param aMoveVector the move vector for this object. */ void MoveAB( const wxPoint& aMoveVector ); /** - * Function MoveXY - * move this object. - * @param aMoveVector - the move vector for this object, in XY gerber axis. - */ + * Move this object. + * + * @param aMoveVector the move vector for this object, in XY gerber axis. + */ void MoveXY( const wxPoint& aMoveVector ); /** - * Function GetPosition - * returns the position of this object. - * @return const wxPoint& - The position of this object. + * Return the position of this object. + * * This function exists mainly to satisfy the virtual GetPosition() in parent class + * + * @return The position of this object. */ wxPoint GetPosition() const override { return m_Start; } void SetPosition( const wxPoint& aPos ) override { m_Start = aPos; } /** - * Function GetABPosition - * returns the image position of aPosition for this object. + * Return the image position of aPosition for this object. + * * Image position is the value of aPosition, modified by image parameters: * offsets, axis selection, scale, rotation - * @param aXYPosition = position in X,Y gerber axis - * @return const wxPoint - The given position in plotter A,B axis. + * + * @param aXYPosition is position in X,Y gerber axis + * @return The given position in plotter A,B axis. */ wxPoint GetABPosition( const wxPoint& aXYPosition ) const; @@ -213,19 +160,20 @@ public: } /** - * Function GetXYPosition - * returns the image position of aPosition for this object. + * Return the image position of aPosition for this object. + * * Image position is the value of aPosition, modified by image parameters: * offsets, axis selection, scale, rotation + * * @param aABPosition = position in A,B plotter axis - * @return const wxPoint - The given position in X,Y axis. + * @return The given position in X,Y axis. */ wxPoint GetXYPosition( const wxPoint& aABPosition ) const; /** - * Function GetDcodeDescr - * returns the GetDcodeDescr of this object, or NULL. - * @return D_CODE* - a pointer to the DCode description (for flashed items). + * Return the GetDcodeDescr of this object, or NULL. + * + * @return a pointer to the DCode description (for flashed items). */ D_CODE* GetDcodeDescr() const; @@ -234,20 +182,18 @@ public: void Print( wxDC* aDC, const wxPoint& aOffset, GBR_DISPLAY_OPTIONS* aOptions ); /** - * Function ConvertSegmentToPolygon - * convert a line to an equivalent polygon. + * Convert a line to an equivalent polygon. + * * Useful when a line is plotted using a rectangular pen. * In this case, the usual segment plot function cannot be used */ void ConvertSegmentToPolygon(); /** - * Function PrintGerberPoly - * a helper function used to print the polygon stored in m_PolyCorners + * Print the polygon stored in m_PolyCorners. */ void PrintGerberPoly( wxDC* aDC, COLOR4D aColor, const wxPoint& aOffset, bool aFilledShape ); - /* divers */ int Shape() const { return m_Shape; } void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; @@ -255,26 +201,25 @@ public: wxString ShowGBRShape() const; /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. + * Test if the given wxPoint is within the bounds of this object. + * * @param aRefPos a wxPoint to test * @return bool - true if a hit, else false */ bool HitTest( const wxPoint& aRefPos, int aAccuracy = 0 ) const override; /** - * Function HitTest (overloaded) - * tests if the given wxRect intersect this object. + * Test if the given wxRect intersect this object. + * * For now, an ending point must be inside this rect. + * * @param aRefArea a wxPoint to test - * @return bool - true if a hit, else false + * @return true if a hit, else false */ bool HitTest( const EDA_RECT& aRefArea, bool aContained, int aAccuracy = 0 ) const override; /** - * Function GetClass - * returns the class name. - * @return wxString + * @return the class name string. */ wxString GetClass() const override { @@ -294,14 +239,58 @@ public: /// @copydoc VIEW_ITEM::ViewGetLOD() double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override; - ///> @copydoc EDA_ITEM::Visit() + ///< @copydoc EDA_ITEM::Visit() SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; - ///> @copydoc EDA_ITEM::GetSelectMenuText() + ///< @copydoc EDA_ITEM::GetSelectMenuText() virtual wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; - ///> @copydoc EDA_ITEM::GetMenuImage() + ///< @copydoc EDA_ITEM::GetMenuImage() BITMAP_DEF GetMenuImage() const override; + + bool m_UnitsMetric; // store here the gerber units (inch/mm). Used + // only to calculate aperture macros shapes sizes + int m_Shape; // Shape and type of this gerber item + wxPoint m_Start; // Line or arc start point or position of the shape + // for flashed items + wxPoint m_End; // Line or arc end point + wxPoint m_ArcCentre; // for arcs only: Center of arc + SHAPE_POLY_SET m_Polygon; // Polygon shape data (G36 to G37 coordinates) + // or for complex shapes which are converted to polygon + wxSize m_Size; // Flashed shapes: size of the shape + // Lines : m_Size.x = m_Size.y = line width + bool m_Flashed; // True for flashed items + int m_DCode; // DCode used to draw this item. + // Allowed values are >= 10. 0 when unknown + // values 0 to 9 can be used for special purposes + // Regions (polygons) do not use DCode, + // so it is set to 0 + wxString m_AperFunction; // the aperture function set by a %TA.AperFunction, xxx + // (stores the xxx value). Used for regions that do + // not have a attached DCode, but + // have a TA.AperFunction defined + GERBER_FILE_IMAGE* m_GerberImageFile; /* Gerber file image source of this item + * Note: some params stored in this class are common + * to the whole gerber file (i.e) the whole graphic + * layer and some can change when reading the file, + * so they are stored inside this item if there is no + * redundancy for these parameters + */ + +private: + // These values are used to draw this item, according to gerber layers parameters + // Because they can change inside a gerber image, they are stored here + // for each item + bool m_LayerNegative; // true = item in negative Layer + bool m_swapAxis; // false if A = X, B = Y; true if A =Y, B = Y + bool m_mirrorA; // true: mirror / axis A + bool m_mirrorB; // true: mirror / ax's B + wxRealPoint m_drawScale; // A and B scaling factor + wxPoint m_layerOffset; // Offset for A and B axis, from OF parameter + double m_lyrRotation; // Fine rotation, from OR parameter, in degrees + GBR_NETLIST_METADATA m_netAttributes; ///< the string given by a %TO attribute set in aperture + ///< (dcode). Stored in each item, because %TO is + ///< a dynamic object attribute }; diff --git a/gerbview/gerber_file_image.h b/gerbview/gerber_file_image.h index 0b76c275a7..b4de84e532 100644 --- a/gerbview/gerber_file_image.h +++ b/gerbview/gerber_file_image.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010-2019 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 * modify it under the terms of the GNU General Public License @@ -42,25 +42,26 @@ typedef std::vector GERBER_DRAW_ITEMS; class GERBVIEW_FRAME; class D_CODE; -/* gerber files have different parameters to define units and how items must be plotted. - * some are for the entire file, and other can change along a file. - * In Gerber world: - * an image is the entire gerber file and its "global" parameters - * a layer (that is very different from a board layer) is just a sub set of a file that - * have specific parameters - * if a Image parameter is set more than once, only the last value is used - * Some parameters can change along a file and are not layer specific: they are stored - * in GERBER_ITEM items, when instancied. +/* Gerber files have different parameters to define units and how items must be plotted. + * some are for the entire file, and other can change along a file. + * In Gerber world: + * an image is the entire gerber file and its "global" parameters + * a layer (that is very different from a board layer) is just a sub set of a file that + * have specific parameters + * if a Image parameter is set more than once, only the last value is used + * Some parameters can change along a file and are not layer specific: they are stored + * in GERBER_ITEM items, when instanced. * - * In GerbView, to handle these parameters, there are 2 classes: - * GERBER_FILE_IMAGE : the main class containing most of parameters and data to plot a graphic layer - * Some of them can change along the file - * There is one GERBER_FILE_IMAGE per file and one graphic layer per file or GERBER_FILE_IMAGE - * GerbView does not read and merge 2 gerber file in one graphic layer: - * I believe this is not possible due to the constraints in Image parameters. - * GERBER_LAYER : containing the subset of parameters that is layer speficic - * A GERBER_FILE_IMAGE must include one GERBER_LAYER to define all parameters to plot a file. - * But a GERBER_FILE_IMAGE can use more than one GERBER_LAYER. + * In GerbView, to handle these parameters, there are 2 classes: + * GERBER_FILE_IMAGE : the main class containing most of parameters and data to plot a + * graphic layer + * Some of them can change along the file + * There is one GERBER_FILE_IMAGE per file and one graphic layer per file or GERBER_FILE_IMAGE + * GerbView does not read and merge 2 gerber file in one graphic layer: + * I believe this is not possible due to the constraints in Image parameters. + * GERBER_LAYER : containing the subset of parameters that is layer specific + * A GERBER_FILE_IMAGE must include one GERBER_LAYER to define all parameters to plot a file. + * But a GERBER_FILE_IMAGE can use more than one GERBER_LAYER. */ class GERBER_FILE_IMAGE; @@ -79,10 +80,16 @@ enum LAST_EXTRA_ARC_DATA_TYPE class GERBER_LAYER { - friend class GERBER_FILE_IMAGE; public: + GERBER_LAYER(); + ~GERBER_LAYER(); - // These parameters are layer specfic: +private: + void ResetDefaultValues(); + friend class GERBER_FILE_IMAGE; + +public: + // These parameters are layer specific: wxString m_LayerName; // Layer name, from LN * command bool m_LayerNegative; // true = Negative Layer: command LP wxRealPoint m_StepForRepeat; // X and Y offsets for Step and Repeat command @@ -93,157 +100,15 @@ public: // gerber items can have coordinates // in different units than step parameters // and the actual coordinates calculation must handle this - -public: - GERBER_LAYER(); - ~GERBER_LAYER(); -private: - void ResetDefaultValues(); }; /** - * GERBER_FILE_IMAGE - * holds the Image data and parameters for one gerber file - * and layer parameters (TODO: move them in GERBER_LAYER class + * Hold the image data and parameters for one gerber file and layer parameters. + * + * @todo: Move them in #GERBER_LAYER class. */ class GERBER_FILE_IMAGE : public EDA_ITEM { - D_CODE* m_Aperture_List[TOOLS_MAX_COUNT]; ///< Dcode (Aperture) List for this layer - ///< (max TOOLS_MAX_COUNT: see dcode.h) - bool m_Exposure; ///< whether an aperture macro tool is flashed on or off - - GERBER_LAYER m_GBRLayerParams; // hold params for the current gerber layer - GERBER_DRAW_ITEMS m_drawings; // linked list of Gerber Items to draw - -public: - bool m_InUse; // true if this image is currently in use - // (a file is loaded in it) - bool m_IsVisible; // true if the draw layer is visible and must be drawn - // false if it must be not drawn - COLOR4D m_PositiveDrawColor; // The color used to draw positive items - wxString m_FileName; // Full File Name for this layer - wxString m_ImageName; // Image name, from IN * command - bool m_IsX2_file; // true if a X2 gerber attribute was found in file - X2_ATTRIBUTE_FILEFUNCTION* m_FileFunction; // file function parameters, found in a %TF command - // or a G04 - wxString m_MD5_value; // MD5 value found in a %TF.MD5 command - wxString m_PartString; // string found in a %TF.Part command - int m_GraphicLayer; // Graphic layer Number - bool m_ImageNegative; // true = Negative image - bool m_ImageJustifyXCenter; // Image Justify Center on X axis (default = false) - bool m_ImageJustifyYCenter; // Image Justify Center on Y axis (default = false) - wxPoint m_ImageJustifyOffset; // Image Justify Offset on XY axis (default = 0,0) - bool m_GerbMetric; // false = Inches, true = metric - bool m_Relative; // false = absolute Coord, true = relative Coord - bool m_NoTrailingZeros; // true: remove tailing zeros. - wxPoint m_ImageOffset; // Coord Offset, from IO command - wxSize m_FmtScale; // Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4 - wxSize m_FmtLen; // Nb chars per coord. ex fmt 2.3, m_FmtLen = 5 - int m_ImageRotation; // Image rotation (0, 90, 180, 270 only) in degrees - double m_LocalRotation; // Local rotation, in degrees, added to m_ImageRotation - // Note this value is stored in 0.1 degrees - wxPoint m_Offset; // Coord Offset, from OF command - wxRealPoint m_Scale; // scale (X and Y) of layer. - bool m_SwapAxis; // false (default) if A = X and B = Y - // true if A = Y, B = X - bool m_MirrorA; // true: miror / axe A (X) - bool m_MirrorB; // true: miror / axe B (Y) - int m_Iterpolation; // Linear, 90 arc, Circ. - int m_Current_Tool; // Current Tool (Dcode) number selected - int m_Last_Pen_Command; // Current or last pen state (0..9, set by Dn option with n <10 - int m_CommandState; // state of gerber analysis command. - int m_LineNum; // Line number of the gerber file while reading - wxPoint m_CurrentPos; // current specified coord for plot - wxPoint m_PreviousPos; // old current specified coord for plot - wxPoint m_IJPos; // IJ coord (for arcs & circles ) - bool m_LastCoordIsIJPos; // true if a IJ coord was read (for arcs & circles ) - int m_ArcRadius; // A value ( = radius in circular routing in Excellon files ) - LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType; // Identifier for arc data type (IJ (center) or A## (radius)) - FILE* m_Current_File; // Current file to read - - int m_Selected_Tool; // For highlight: current selected Dcode - bool m_Has_DCode; // true = DCodes in file - // false = no DCode -> perhaps deprecated RS274D file - bool m_Has_MissingDCode; // true = some DCodes in file are not defined - // (broken file or deprecated RS274D file) - bool m_360Arc_enbl; // Enbl 360 deg circular interpolation - bool m_AsArcG74G75Cmd; // Set to true when a circular interpolation command - // type is found. Mandatory before drawing an arc. - bool m_PolygonFillMode; // Enable polygon mode (read coord as a polygon descr) - int m_PolygonFillModeState; // In polygon mode: 0 = first segm, 1 = next segm - - APERTURE_MACRO_SET m_aperture_macros; ///< a collection of APERTURE_MACROS, sorted by name - - GBR_NETLIST_METADATA m_NetAttributeDict; // the net attributes set by a %TO.CN, %TO.C and/or %TO.N - // add object attribute command. - wxString m_AperFunction; // the aperture function set by a %TA.AperFunction, xxx - // (stores thre xxx value). - - std::map m_ComponentsList; // list of components - std::map m_NetnamesList; // list of net names - -private: - wxArrayString m_messagesList; // A list of messages created when reading a file - int m_hasNegativeItems; // true if the image is negative or has some negative items - // Used to optimize drawing, because when there are no - // negative items screen refresh does not need - // to build an intermediate bitmap specfic to this image - // -1 = negative items are - // 0 = no negative items found - // 1 = have negative items found - /** - * test for an end of line - * if a end of line is found: - * read a new line - * @param aBuff = buffer (size = GERBER_BUFZ) to fill with a new line - * @param aText = pointer to the last useful char in aBuff - * on return: points the beginning of the next line. - * @param aBuffSize = the size in bytes of aBuff - * @param aFile = the opened GERBER file to read - * @return a pointer to the beginning of the next line or NULL if end of file - */ - char* GetNextLine( char *aBuff, unsigned int aBuffSize, char* aText, FILE* aFile ); - - bool GetEndOfBlock( char* aBuff, unsigned int aBuffSize, char*& aText, FILE* aGerberFile ); - - /** - * reads a single RS274X command terminated with a % - */ - bool ReadRS274XCommand( char *aBuff, unsigned int aBuffSize, char*& aText ); - - /** - * executes a RS274X command - */ - bool ExecuteRS274XCommand( int aCommand, char* aBuff, - unsigned int aBuffSize, char*& aText ); - - /** - * reads two bytes of data and assembles them into an int with the first - * byte in the sequence put into the most significant part of a 16 bit value - * to build a RS274X command identifier. - * @param text A reference to a pointer to read bytes from and to advance as - * they are read. - * @return a RS274X command identifier. - */ - int ReadXCommandID( char*& text ); - - /** - * reads in an aperture macro and saves it in m_aperture_macros. - * @param aBuff a character buffer at least GERBER_BUFZ long that can be - * used to read successive lines from the gerber file. - * @param text A reference to a character pointer which gives the initial - * text to read from. - * @param aBuffSize is the size of aBuff - * @param gerber_file Which file to read from for continuation. - * @return bool - true if a macro was read in successfully, else false. - */ - bool ReadApertureMacro( char *aBuff, unsigned int aBuffSize, - char* & text, FILE * gerber_file ); - - // functions to execute G commands or D basic commands: - bool Execute_G_Command( char*& text, int G_command ); - bool Execute_DCODE_Command( char*& text, int D_command ); - public: GERBER_FILE_IMAGE( int layer ); virtual ~GERBER_FILE_IMAGE(); @@ -255,10 +120,11 @@ public: /** * Read and load a gerber file. - * @param aFullFileName = the full filename of the Gerber file - * when the file cannot be loaded - * Warning and info messages are stored in m_messagesList - * @return bool if OK, false if the gerber file was not loaded + * + * If the file cannot be loaded, warning and information messages are stored in m_messagesList. + * + * @param aFullFileName The full filename of the Gerber file. + * @return true if file loaded successfully, false if the gerber file was not loaded. */ bool LoadGerberFile( const wxString& aFullFileName ); @@ -285,6 +151,7 @@ public: /** * Add a new GERBER_DRAW_ITEM item to the drawings list + * * @param aItem is the GERBER_DRAW_ITEM to add to list */ void AddItemToList( GERBER_DRAW_ITEM* aItem ) @@ -301,8 +168,7 @@ public: } /** - * Function GetLayerParams - * @return the current layers params + * @return the current layers params. */ GERBER_LAYER& GetLayerParams() { @@ -310,121 +176,113 @@ public: } /** - * Function HasNegativeItems - * @return true if at least one item must be drawn in background color - * used to optimize screen refresh (when no items are in background color - * refresh can be faster) + * @return true if at least one item must be drawn in background color used to optimize + * screen refresh (when no items are in background color refresh can be faster). */ bool HasNegativeItems(); /** - * Function ClearMessageList - * Clear the message list + * Clear the message list. + * * Call it before reading a Gerber file */ - void ClearMessageList() + void ClearMessageList() { m_messagesList.Clear(); } /** - * Function AddMessageToList * Add a message to the message list */ - void AddMessageToList( const wxString& aMessage ) + void AddMessageToList( const wxString& aMessage ) { m_messagesList.Add( aMessage ); } - /** - * Function InitToolTable - */ - void InitToolTable(); + void InitToolTable(); /** - * Function ReadXYCoord - * Returns the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm) + * Return the current coordinate type pointed to by XnnYnn Text (XnnnnYmmmm). + * * @param aText is a pointer to the text to parse. * @param aExcellonMode = true to parse a Excellon drill file. - * it force truncation of a digit string to a max len because the exact coordinate - * format is not always known + * it forces truncation of a digit string to a maximum length because the exact coordinate + * format is not always known. */ wxPoint ReadXYCoord( char*& aText, bool aExcellonMode = false ); /** - * Returns the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) + * Return the current coordinate type pointed to by InnJnn Text (InnnnJmmmm) + * * These coordinates are relative, so if coordinate is absent, it's value * defaults to 0 */ wxPoint ReadIJCoord( char*& Text ); // functions to read G commands or D commands: - int GCodeNumber( char*& Text ); - int DCodeNumber( char*& Text ); + int GCodeNumber( char*& Text ); + int DCodeNumber( char*& Text ); /** - * Function GetDCODEOrCreate - * returns a pointer to the D_CODE within this GERBER for the given - * \a aDCODE. + * Return a pointer to the D_CODE within this GERBER for the given \a aDCODE. + * * @param aDCODE The numeric value of the D_CODE to look up. * @param aCreateIfNoExist If true, then create the D_CODE if it does not * exist in list. - * @return D_CODE* - the one implied by the given \a aDCODE, or NULL - * if the requested \a aDCODE is out of range. + * @return The one implied by the given \a aDCODE or NULL if the requested \a aDCODE is + * out of range. */ - D_CODE* GetDCODEOrCreate( int aDCODE, bool aCreateIfNoExist = true ); + D_CODE* GetDCODEOrCreate( int aDCODE, bool aCreateIfNoExist = true ); /** - * Function GetDCODE - * returns a pointer to the D_CODE within this GERBER for the given - * \a aDCODE. + * Return a pointer to the D_CODE within this GERBER for the given \a aDCODE. + * * @param aDCODE The numeric value of the D_CODE to look up. - * @return D_CODE* - the one implied by the given \a aDCODE, or NULL - * if the requested \a aDCODE is out of range. + * @return The D code implied by the given \a aDCODE or NULL if the requested \a aDCODE is + * out of range. */ - D_CODE* GetDCODE( int aDCODE ) const; + D_CODE* GetDCODE( int aDCODE ) const; /** - * Function FindApertureMacro - * looks up a previously read in aperture macro. + * Look up a previously read in aperture macro. + * * @param aLookup A dummy APERTURE_MACRO with [only] the name field set. - * @return APERTURE_MACRO* - the one with a matching name, or NULL if - * not found. + * @return the aperture macro with a matching name or NULL if not found. */ APERTURE_MACRO* FindApertureMacro( const APERTURE_MACRO& aLookup ); /** - * Function StepAndRepeatItem - * Gerber format has a command Step an Repeat + * Gerber format has a command Step an Repeat. + * * This function must be called when reading a gerber file and * after creating a new gerber item that must be repeated * (i.e when m_XRepeatCount or m_YRepeatCount are > 1) + * * @param aItem = the item to repeat */ - void StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem ); + void StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem ); /** - * Function DisplayImageInfo - * has knowledge about the frame and how and where to put status information - * about this object into the frame's message panel. - * Display info about Image Parameters. - * @param aMainFrame = the GERBVIEW_FRAME to display messages + * Display information about image parameters in the status bar. + * + * @param aMainFrame The #GERBVIEW_FRAME to display messages. */ void DisplayImageInfo( GERBVIEW_FRAME* aMainFrame ); /** - * Function RemoveAttribute. * Called when a %TD command is found the Gerber file - * @param aAttribute is the X2_ATTRIBUTE which stores the full command + * * Remove the attribute specified by the %TD command. * is no attribute, all current attributes specified by the %TO and the %TA * commands are cleared. * if a attribute name is specified (for instance %TD.CN*%) is specified, * only this attribute is cleared + * + * @param aAttribute is the X2_ATTRIBUTE which stores the full command */ void RemoveAttribute( X2_ATTRIBUTE& aAttribute ); - ///> @copydoc EDA_ITEM::Visit() + ///< @copydoc EDA_ITEM::Visit() SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override; #if defined(DEBUG) @@ -432,6 +290,193 @@ public: void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } #endif + +private: + /** + * Test for an end of line. + * + * If a end of line is found, read a new line. + * + * @param aBuff = buffer (size = GERBER_BUFZ) to fill with a new line + * @param aText = pointer to the last useful char in aBuff + * on return: points the beginning of the next line. + * @param aBuffSize = the size in bytes of aBuff + * @param aFile = the opened GERBER file to read + * @return a pointer to the beginning of the next line or NULL if end of file + */ + char* GetNextLine( char *aBuff, unsigned int aBuffSize, char* aText, FILE* aFile ); + + bool GetEndOfBlock( char* aBuff, unsigned int aBuffSize, char*& aText, FILE* aGerberFile ); + + /** + * Read a single RS274X command terminated with a % + */ + bool ReadRS274XCommand( char *aBuff, unsigned int aBuffSize, char*& aText ); + + /** + * Execute a RS274X command + */ + bool ExecuteRS274XCommand( int aCommand, char* aBuff, unsigned int aBuffSize, char*& aText ); + + /** + * Read two bytes of data and assembles them into an int with the first + * byte in the sequence put into the most significant part of a 16 bit value + * to build a RS274X command identifier. + * + * @param text A reference to a pointer to read bytes from and to advance as + * they are read. + * @return a RS274X command identifier. + */ + int ReadXCommandID( char*& text ); + + /** + * Read in an aperture macro and saves it in m_aperture_macros. + * + * @param aBuff a character buffer at least GERBER_BUFZ long that can be + * used to read successive lines from the gerber file. + * @param text A reference to a character pointer which gives the initial + * text to read from. + * @param aBuffSize is the size of aBuff + * @param gerber_file Which file to read from for continuation. + * @return true if a macro was read in successfully, else false. + */ + bool ReadApertureMacro( char *aBuff, unsigned int aBuffSize, + char* & text, FILE * gerber_file ); + + // functions to execute G commands or D basic commands: + bool Execute_G_Command( char*& text, int G_command ); + bool Execute_DCODE_Command( char*& text, int D_command ); + +public: + bool m_InUse; // true if this image is currently in use + // (a file is loaded in it) + + ///< True if the draw layer is visible and must be drawn. + bool m_IsVisible; + // false if it must be not drawn + COLOR4D m_PositiveDrawColor; // The color used to draw positive items + wxString m_FileName; // Full File Name for this layer + wxString m_ImageName; // Image name, from IN * command + + ///< True if a X2 gerber attribute was found in file. + bool m_IsX2_file; + X2_ATTRIBUTE_FILEFUNCTION* m_FileFunction; // file function parameters, found in a + // %TF command or a G04 + wxString m_MD5_value; // MD5 value found in a %TF.MD5 command + wxString m_PartString; // string found in a %TF.Part command + int m_GraphicLayer; // Graphic layer Number + bool m_ImageNegative; // true = Negative image + + ///< Image Justify Center on X axis (default = false). + bool m_ImageJustifyXCenter; + + ///< Image Justify Center on Y axis (default = false). + bool m_ImageJustifyYCenter; + + ///< Image Justify Offset on XY axis (default = 0,0). + wxPoint m_ImageJustifyOffset; + bool m_GerbMetric; // false = Inches, true = metric + + ///< false = absolute Coord, true = relative Coord. + bool m_Relative; + bool m_NoTrailingZeros; // true: remove tailing zeros. + wxPoint m_ImageOffset; // Coord Offset, from IO command + + ///< Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4. + wxSize m_FmtScale; + + ///< Nb chars per coord. ex fmt 2.3, m_FmtLen = 5. + wxSize m_FmtLen; + + ///< Image rotation (0, 90, 180, 270 only) in degrees. + int m_ImageRotation; + + ///< Local rotation in degrees added to m_ImageRotation. + ///< @note This value is stored in 0.1 degrees. + double m_LocalRotation; + wxPoint m_Offset; // Coord Offset, from OF command + wxRealPoint m_Scale; // scale (X and Y) of layer. + bool m_SwapAxis; // false (default) if A = X and B = Y + // true if A = Y, B = X + bool m_MirrorA; // true: mirror / axis A (X) + bool m_MirrorB; // true: mirror / axis B (Y) + int m_Iterpolation; // Linear, 90 arc, Circ. + int m_Current_Tool; // Current Tool (Dcode) number selected + + ///< Current or last pen state (0..9, set by Dn option with n < 10. + int m_Last_Pen_Command; + int m_CommandState; // state of gerber analysis command. + + ///< Line number of the gerber file while reading. + int m_LineNum; + wxPoint m_CurrentPos; // current specified coord for plot + wxPoint m_PreviousPos; // old current specified coord for plot + wxPoint m_IJPos; // IJ coord (for arcs & circles ) + + ///< True if a IJ coord was read (for arcs & circles ). + bool m_LastCoordIsIJPos; + + ///< A value ( = radius in circular routing in Excellon files ). + int m_ArcRadius; + + ///< Identifier for arc data type (IJ (center) or A## (radius)). + LAST_EXTRA_ARC_DATA_TYPE m_LastArcDataType; + FILE* m_Current_File; // Current file to read + + int m_Selected_Tool; // For highlight: current selected Dcode + + ///< True if has DCodes in file or false if no DCodes found. Perhaps deprecated RS274D file. + bool m_Has_DCode; + + // true = some DCodes in file are not defined (broken file or deprecated RS274D file). + bool m_Has_MissingDCode; + bool m_360Arc_enbl; // Enable 360 deg circular interpolation + + // Set to true when a circular interpolation command type is found. Mandatory before + // drawing an arc. + bool m_AsArcG74G75Cmd; + + // Enable polygon mode (read coord as a polygon descr) + bool m_PolygonFillMode; + + // In polygon mode: 0 = first segm, 1 = next segm + int m_PolygonFillModeState; + + ///< a collection of APERTURE_MACROS, sorted by name + APERTURE_MACRO_SET m_aperture_macros; + + // the net attributes set by a %TO.CN, %TO.C and/or %TO.N add object attribute command. + GBR_NETLIST_METADATA m_NetAttributeDict; + + // the aperture function set by a %TA.AperFunction, xxx (stores the xxx value). + wxString m_AperFunction; + + std::map m_ComponentsList; // list of components + std::map m_NetnamesList; // list of net names + + ///< Dcode (Aperture) List for this layer (max TOOLS_MAX_COUNT: see dcode.h) + D_CODE* m_Aperture_List[TOOLS_MAX_COUNT]; + + ///< Whether an aperture macro tool is flashed on or off. + bool m_Exposure; + + GERBER_LAYER m_GBRLayerParams; // hold params for the current gerber layer + GERBER_DRAW_ITEMS m_drawings; // linked list of Gerber Items to draw + +private: + wxArrayString m_messagesList; // A list of messages created when reading a file + + /** + * True if the image is negative or has some negative items. + * + * Used to optimize drawing because when there are no negative items screen refresh does + * not need to build an intermediate bitmap specific to this image. + * + * - -1 negative items are. + * - 0 no negative items found. + * - 1 have negative items found. + */ + int m_hasNegativeItems; }; #endif // ifndef GERBER_FILE_IMAGE_H diff --git a/gerbview/gerbview_draw_panel_gal.h b/gerbview/gerbview_draw_panel_gal.h index 78b132ff91..dc6147e79e 100644 --- a/gerbview/gerbview_draw_panel_gal.h +++ b/gerbview/gerbview_draw_panel_gal.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -31,31 +31,33 @@ namespace KIGFX class GERBVIEW_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL { public: - GERBVIEW_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition, - const wxSize& aSize, KIGFX::GAL_DISPLAY_OPTIONS& aOptions, - GAL_TYPE aGalType = GAL_TYPE_OPENGL ); + GERBVIEW_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, + const wxPoint& aPosition, const wxSize& aSize, + KIGFX::GAL_DISPLAY_OPTIONS& aOptions, + GAL_TYPE aGalType = GAL_TYPE_OPENGL ); virtual ~GERBVIEW_DRAW_PANEL_GAL(); - ///> @copydoc EDA_DRAW_PANEL_GAL::SetHighContrastLayer() + ///< @copydoc EDA_DRAW_PANEL_GAL::SetHighContrastLayer() virtual void SetHighContrastLayer( int aLayer ) override; - ///> @copydoc EDA_DRAW_PANEL_GAL::GetMsgPanelInfo() + ///< @copydoc EDA_DRAW_PANEL_GAL::GetMsgPanelInfo() void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - ///> @copydoc EDA_DRAW_PANEL_GAL::OnShow() + ///< @copydoc EDA_DRAW_PANEL_GAL::OnShow() void OnShow() override; bool SwitchBackend( GAL_TYPE aGalType ) override; - ///> @copydoc EDA_DRAW_PANEL_GAL::SetTopLayer + ///< @copydoc EDA_DRAW_PANEL_GAL::SetTopLayer virtual void SetTopLayer( int aLayer ) override; - ///> @copydoc EDA_DRAW_PANEL_GAL::GetDefaultViewBBox() + ///< @copydoc EDA_DRAW_PANEL_GAL::GetDefaultViewBBox() BOX2I GetDefaultViewBBox() const override; /** - * Sets (or updates) worksheet used by the draw panel. + * Set or update worksheet used by the draw panel. + * * @param aWorksheet is the worksheet to be used. * The object is then owned by GERBVIEW_DRAW_PANEL_GAL. */ @@ -67,10 +69,10 @@ public: KIGFX::WS_PROXY_VIEW_ITEM* GetWorksheet() const { return m_worksheet.get(); } protected: - ///> Sets rendering targets & dependencies for layers. + ///< Set rendering targets & dependencies for layers. void setDefaultLayerDeps(); - ///> Currently used worksheet + ///< Currently used worksheet std::unique_ptr m_worksheet; }; diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 766c8ecff7..f977ca4a48 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr - * 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 modify it * under the terms of the GNU General Public License as published by the @@ -67,14 +67,14 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ) : EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME ), - m_activeLayer( 0 ), + m_TextInfo( nullptr ), m_zipFileHistory( DEFAULT_FILE_HISTORY_SIZE, ID_GERBVIEW_ZIP_FILE1, ID_GERBVIEW_ZIP_FILE_LIST_CLEAR, _( "Clear Recent Zip Files" ) ), m_drillFileHistory( DEFAULT_FILE_HISTORY_SIZE, ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILE_LIST_CLEAR, _( "Clear Recent Drill Files" ) ), m_jobFileHistory( DEFAULT_FILE_HISTORY_SIZE, ID_GERBVIEW_JOB_FILE1, ID_GERBVIEW_JOB_FILE_LIST_CLEAR, _( "Clear Recent Job Files" ) ), - m_TextInfo( nullptr ) + m_activeLayer( 0 ) { m_maximizeByDefault = true; m_gerberLayout = nullptr; @@ -147,13 +147,15 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ) m_auimgr.SetManagedWindow( this ); - m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); - m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(4) ); - m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); - - m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); - m_auimgr.AddPane( m_LayersManager, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3) - .Caption( _( "Layers Manager" ) ).PaneBorder( false ) + m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer( 6 ) ); + m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top() + .Layer(4) ); + m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom() + .Layer( 6 ) ); + m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left() + .Layer( 3 ) ); + m_auimgr.AddPane( m_LayersManager, EDA_PANE().Palette().Name( "LayersManager" ).Right() + .Layer( 3 ).Caption( _( "Layers Manager" ) ).PaneBorder( false ) .MinSize( 80, -1 ).BestSize( m_LayersManager->GetBestSize() ) ); m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); @@ -224,7 +226,7 @@ bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector& aFileSet, in { // Ensure the frame is shown when opening the file(s), to avoid issues (crash) on GAL // when trying to change the view if it is not fully initialized. - // It happens when starting Gerbview with a gerber job file to load + // It happens when starting GerbView with a gerber job file to load if( !IsShown() ) Show(); @@ -257,7 +259,7 @@ bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector& aFileSet, in SetActiveLayer( layer ); // Try to guess the type of file by its ext - // if it is .drl (Kicad files), .nc or .xnc it is a drill file + // if it is .drl (KiCad files), .nc or .xnc it is a drill file wxFileName fn( aFileSet[i] ); wxString ext = fn.GetExt(); @@ -748,7 +750,7 @@ void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, COLOR4D aColor ) case LAYER_GERBVIEW_WORKSHEET: settings->SetColor( LAYER_GERBVIEW_WORKSHEET, aColor ); - // LAYER_WORKSHEET color is alsu used to draw the worksheet + // LAYER_WORKSHEET color is also used to draw the worksheet // FIX ME: why LAYER_WORKSHEET must be set, although LAYER_GERBVIEW_WORKSHEET // is used to initialize the worksheet color layer. settings->SetColor( LAYER_WORKSHEET, aColor ); @@ -1040,21 +1042,28 @@ void GERBVIEW_FRAME::setupUIConditions() #define ENABLE( x ) ACTION_CONDITIONS().Enable( x ) #define CHECK( x ) ACTION_CONDITIONS().Check( x ) - mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) ); - mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) ); - mgr->SetConditions( ACTIONS::measureTool, CHECK( cond.CurrentTool( ACTIONS::measureTool ) ) ); + mgr->SetConditions( ACTIONS::zoomTool, + CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) ); + mgr->SetConditions( ACTIONS::selectionTool, + CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) ); + mgr->SetConditions( ACTIONS::measureTool, + CHECK( cond.CurrentTool( ACTIONS::measureTool ) ) ); mgr->SetConditions( ACTIONS::toggleGrid, CHECK( cond.GridVisible() ) ); mgr->SetConditions( ACTIONS::togglePolarCoords, CHECK( cond.PolarCoordinates() ) ); mgr->SetConditions( ACTIONS::toggleCursorStyle, CHECK( cond.FullscreenCursor() ) ); - mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) ); - mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) ); - mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) ); - - mgr->SetConditions( ACTIONS::acceleratedGraphics, CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) ) ); - mgr->SetConditions( ACTIONS::standardGraphics, CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) ) ); + mgr->SetConditions( ACTIONS::millimetersUnits, + CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) ); + mgr->SetConditions( ACTIONS::inchesUnits, + CHECK( cond.Units( EDA_UNITS::INCHES ) ) ); + mgr->SetConditions( ACTIONS::milsUnits, + CHECK( cond.Units( EDA_UNITS::MILS ) ) ); + mgr->SetConditions( ACTIONS::acceleratedGraphics, + CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) ) ); + mgr->SetConditions( ACTIONS::standardGraphics, + CHECK( cond.CanvasType( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) ) ); auto flashedDisplayOutlinesCond = [this] ( const SELECTION& ) @@ -1110,7 +1119,8 @@ void GERBVIEW_FRAME::setupUIConditions() return m_show_layer_manager_tools; }; - mgr->SetConditions( GERBVIEW_ACTIONS::flashedDisplayOutlines, CHECK( flashedDisplayOutlinesCond ) ); + mgr->SetConditions( GERBVIEW_ACTIONS::flashedDisplayOutlines, + CHECK( flashedDisplayOutlinesCond ) ); mgr->SetConditions( GERBVIEW_ACTIONS::linesDisplayOutlines, CHECK( linesFillCond ) ); mgr->SetConditions( GERBVIEW_ACTIONS::polygonsDisplayOutlines, CHECK( polygonsFilledCond ) ); mgr->SetConditions( GERBVIEW_ACTIONS::negativeObjectDisplay, CHECK( negativeObjectsCond ) ); @@ -1118,7 +1128,8 @@ void GERBVIEW_FRAME::setupUIConditions() mgr->SetConditions( GERBVIEW_ACTIONS::toggleDiffMode, CHECK( diffModeCond ) ); mgr->SetConditions( GERBVIEW_ACTIONS::flipGerberView, CHECK( flipGerberCond ) ); mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastModeCond ) ); - mgr->SetConditions( GERBVIEW_ACTIONS::toggleLayerManager, CHECK( layersManagerShownCondition ) ); + mgr->SetConditions( GERBVIEW_ACTIONS::toggleLayerManager, + CHECK( layersManagerShownCondition ) ); #undef CHECK #undef ENABLE diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 0453d540b7..779903cd2a 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -3,7 +3,7 @@ * * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Wayne Stambaugh - * 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 modify it * under the terms of the GNU General Public License as published by the @@ -47,35 +47,354 @@ class SELECTION; /** - * GERBVIEW_FRAME - * is the main window used in GerbView. + * The main window used in GerbView. */ #define GERBVIEW_FRAME_NAME wxT( "GerberFrame" ) -class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME +class GERBVIEW_FRAME : public EDA_DRAW_FRAME { - GBR_LAYOUT* m_gerberLayout; - int m_activeLayer; - wxPoint m_grid_origin; - PAGE_INFO m_paper; // used only to show paper limits to screen - GBR_DISPLAY_OPTIONS m_DisplayOptions; - wxStaticText* m_cmpText; // a message on the auxiliary toolbar, - // relative to the m_SelComponentBox - wxStaticText* m_netText; // a message on the auxiliary toolbar, - // relative to the m_SelNetnameBox - wxStaticText* m_apertText; // a message on the auxiliary toolbar, - // relative to the m_SelAperAttributesBox - wxStaticText* m_dcodeText; // a message on the auxiliary toolbar, - // relative to the m_DCodeSelector - public: + GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ); + ~GERBVIEW_FRAME(); + + void doCloseWindow() override; + + bool OpenProjectFiles( const std::vector& aFileSet, int aCtl ) override; + + /** + * Load a list of Gerber and NC drill files and updates the view based on them. + * + * @param aPath is the base path for the filenames if they are relative + * @param aFilenameList is a list of filenames to load + * @param aFileType is a list of type of files to load (0 = Gerber, 1 = NC drill) + * if nullptr, files are expected Gerber type. + * @return true if every file loaded successfully + */ + bool LoadListOfGerberAndDrillFiles( const wxString& aPath, + const wxArrayString& aFilenameList, + const std::vector* aFileType = nullptr ); + + // Virtual basic functions: + void ReCreateHToolbar() override; + void ReCreateAuxiliaryToolbar() override; + + /** + * Create or update the right vertical toolbar. + */ + void ReCreateVToolbar() override; + + /** + * Create or update the left vertical toolbar (option toolbar) + */ + void ReCreateOptToolbar() override; + + void ReCreateMenuBar() override; + void UpdateStatusBar() override; + + /** + * @return 0 for fast mode (not fully compatible with negative objects) + * 1 for exact mode, write mode + * 2 for exact mode, OR mode (transparency mode) + */ + int GetDisplayMode() { return m_displayMode; } + + /** + * @param aMode = 0 for fast mode + * 1 for exact mode, write mode + * 2 for exact mode, OR mode (transparency mode) + */ + void SetDisplayMode( int aMode ) { m_displayMode = aMode; } + + /** + * Test whether a given element category is visible. Keep this as an inline function. + * + * @param aLayerID is an item id from the enum GERBVIEW_LAYER_ID + * @return bool - true if the element is visible. + */ + bool IsElementVisible( int aLayerID ) const; + + /** + * Change the visibility of an element category. + * + * @param aItemIdVisible is an item id from the enum GERBVIEW_LAYER_ID + * @param aNewState = The new visibility state of the element category + * (see enum PCB) + */ + void SetElementVisibility( int aLayerID, bool aNewState ); + + /** + * @param aVisible true if the grid must be shown. + */ + void SetGridVisibility( bool aVisible ) override; + + /** + * A proxy function that calls the correspondent function in m_BoardSettings. + * + * @return #LSET of the visible layers + */ + LSET GetVisibleLayers() const; + + /** + * A proxy function that calls the correspondent function in m_BoardSettings. + * + * @param aLayerMask The new set of visible layers + */ + void SetVisibleLayers( LSET aLayerMask ); + + /** + * Test whether a given layer is visible. + * + * @param aLayer The layer to be tested (still 0-31!) + * @return true if the layer is visible. + */ + bool IsLayerVisible( int aLayer ) const; + + /** + * Return the color of a gerber visible element. + */ + COLOR4D GetVisibleElementColor( int aLayerID ); + + void SetVisibleElementColor( int aLayerID, COLOR4D aColor ); + + COLOR4D GetLayerColor( int aLayer ) const; + void SetLayerColor( int aLayer, COLOR4D aColor ); + + /** + * This is usually the background color, but can be another color in order to see + * negative objects. + * + * @return the color of negative items. + */ + COLOR4D GetNegativeItemsColor(); + + /** + * Change out all the layers in m_Layers; called upon loading new gerber files. + */ + void ReFillLayerWidget(); + + /** + * change the currently active layer to \a aLayer and update the #GERBER_LAYER_WIDGET. + */ + void SetActiveLayer( int aLayer, bool doLayerWidgetUpdate = true ); + + /** + * Return the active layer. + */ + int GetActiveLayer() const { return m_activeLayer; } + + /** + * Find the next empty layer starting at \a aLayer and returns it to the caller. + * + * If no empty layers are found, #NO_AVAILABLE_LAYERS is return. + * + * @param aLayer The first layer to search. + * @return The first empty layer found or #NO_AVAILABLE_LAYERS. + */ + int getNextAvailableLayer( int aLayer = 0 ) const; + + /** + * Update the currently "selected" layer within the #GERBER_LAYER_WIDGET. + * The currently active layer is defined by the return value of GetActiveLayer(). + *

            + * This function cannot be inline without including layer_widget.h in here and we do not + * want to do that. + */ + void syncLayerWidget(); + + /** + * Update the currently "selected" layer within m_SelLayerBox. + * The currently active layer, as defined by the return value of GetActiveLayer(). + * + * @param aRebuildLayerBox true to rebuild the layer box of false to just update the selection. + */ + void syncLayerBox( bool aRebuildLayerBox = false ); + + /** + * Display the short filename (if exists) of the selected layer on the caption of the main + * GerbView window and some other parameters. + * + * - Name of the layer (found in the gerber file: LN <name> command) in the status bar + * - Name of the Image (found in the gerber file: IN <name> command) in the status bar + * and other data in toolbar + */ + void UpdateTitleAndInfo(); + + /** + * Display the current grid pane on the status bar. + */ + void DisplayGridMsg() override; + + void LoadSettings( APP_SETTINGS_BASE* aCfg ) override; + + void SaveSettings( APP_SETTINGS_BASE* aCfg ) override; + + void ToggleLayerManager(); + + void ShowChangedLanguage() override; + + /// Handles the changing of the highlighted component/net/attribute + void OnSelectHighlightChoice( wxCommandEvent& event ); + + /** + * Select the active DCode for the current active layer. + * Items using this DCode are highlighted. + */ + void OnSelectActiveDCode( wxCommandEvent& event ); + + /** + * Select the active layer: + * - if a file is loaded, it is loaded in this layer + * - this layer is displayed on top of other layers + */ + void OnSelectActiveLayer( wxCommandEvent& event ); + + /** + * Called on a display mode selection. + * + * Mode selection can be fast display or exact mode with stacked images or with transparency. + */ + void OnSelectDisplayMode( wxCommandEvent& event ); + + /** + * Called on request of application quit. + */ + void OnQuit( wxCommandEvent& event ); + + void OnUpdateDrawMode( wxUpdateUIEvent& aEvent ); + void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent ); + void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent ); + + /** + * Delete the current data and loads a Gerber file selected from history list on current layer. + */ + void OnGbrFileHistory( wxCommandEvent& event ); + + /** + * Delete the current data and load a drill file in Excellon format selected from + * history list on current layer. + */ + void OnDrlFileHistory( wxCommandEvent& event ); + + /** + * Delete the current data and load a zip archive file selected from the + * history list. The archive is expected containing a set of gerber and drill file + */ + void OnZipFileHistory( wxCommandEvent& event ); + + /** + * Delete the current data and load a gerber job file selected from the history list. + */ + void OnJobFileHistory( wxCommandEvent& event ); + + /** + * Extract gerber and drill files from the zip archive, and load them. + * + * @param aFullFileName is the full filename of the zip archive + * @param aReporter a REPORTER to collect warning and error messages + * @return true if OK, false if a file cannot be readable + */ + bool unarchiveFiles( const wxString& aFullFileName, REPORTER* aReporter = nullptr ); + + /** + * Load a photoplot (Gerber) file or many files. + * + * @param aFileName - void string or file name with full path to open or empty string to + * open a new file. In this case one one file is loaded + * if void string: user will be prompted for filename(s) + * @return true if file was opened successfully. + */ + bool LoadGerberFiles( const wxString& aFileName ); + bool Read_GERBER_File( const wxString& GERBER_FullFileName ); + + /** + * Load a drill (EXCELLON) file or many files. + * + * @param aFileName - void string or file name with full path to open or empty string to + * open a new file. In this case one one file is loaded + * if empty string: user will be prompted for filename(s) + * @return true if file was opened successfully. + */ + bool LoadExcellonFiles( const wxString& aFileName ); + bool Read_EXCELLON_File( const wxString& aFullFileName ); + + /** + * Load a zipped archive file. + * + * @param aFileName - void string or file name with full path to open or empty string to + * open a new file. + * if empty string: user will be prompted for filename(s) + * @return true if file was opened successfully. + */ + bool LoadZipArchiveFile( const wxString& aFileName ); + + + /** + * Load a Gerber job file, and load gerber files found in job files. + * + * @param aFileName - void string or file name with full path to open or empty string to + * open a new file. + * if empty string: user will be prompted for filename(s) + * @return true if file(s) was opened successfully. + */ + bool LoadGerberJobFile( const wxString& aFileName ); + + // PCB handling + bool Clear_DrawLayers( bool query ); + void Erase_Current_DrawLayer( bool query ); + + void SortLayersByX2Attributes(); + + /** + * Update the display options and refreshes the view as needed. + * + * @param aOptions is the new options to apply + */ + void UpdateDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions ); + + /* + * Do nothing in GerbView. + */ + void SaveCopyInUndoList( GERBER_DRAW_ITEM* aItemToCopy, + UNDO_REDO aTypeCommand = UNDO_REDO::UNSPECIFIED, + const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) { } + + /** + * Create a new entry in undo list of commands and add a list of pickers to handle a list + * of items. + * + * @param aItemsList = the list of items modified by the command to undo + * @param aTypeCommand = command type (see enum UNDO_REDO) + * @param aTransformPoint = the reference point of the transformation, + * for commands like move + */ + void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, + UNDO_REDO aTypeCommand, + const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) + { + // currently: do nothing in GerbView. + } + + ///< @copydoc EDA_DRAW_FRAME::ActivateGalCanvas + void ActivateGalCanvas() override; + + /** + * Allow Gerbview to install its preferences panels into the preferences dialog. + */ + void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override; + + /** + * Called after the preferences dialog is run. + */ + void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override; + + SELECTION& GetCurrentSelection() override; + const GBR_DISPLAY_OPTIONS& GetDisplayOptions() const { return m_DisplayOptions; } void SetDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions ) { m_DisplayOptions = aOptions; } /** - * Function SetLayout - * sets the m_gerberLayout member in such as way as to ensure deleting any previous + * Set the m_gerberLayout member in such as way as to ensure deleting any previous * GBR_LAYOUT. * @param aLayout The GBR_LAYOUT to put into the frame. */ @@ -114,12 +433,8 @@ public: const TITLE_BLOCK& GetTitleBlock() const override; void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override; - /** Install the dialog box for layer selection - * @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer) - * @param aCopperLayerCount = number of copper layers - * @param aGerberName = Name of Gerber file to select KiCad layer for - * @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected), - * or -1 if canceled + /** + * Show the dialog box for layer selection. * * Providing the option to also display a "(Deselect)" radiobutton makes the * GerbView's "Export to Pcbnew" command) more "user friendly", @@ -128,6 +443,12 @@ public: * necessary to first cancel the "Select Layer:" dialog box (invoked after a * different radiobutton is clicked on) prior to then clicking on the "Deselect" * button provided within the "Layer selection:" dialog box). + * + * @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer) + * @param aCopperLayerCount = number of copper layers + * @param aGerberName = Name of Gerber file to select KiCad layer for + * @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected), + * or -1 if canceled */ int SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, wxString aGerberName ); @@ -136,7 +457,7 @@ public: */ COLOR4D GetGridColor() override; - ///> @copydoc EDA_DRAW_FRAME::SetGridColor() + ///< @copydoc EDA_DRAW_FRAME::SetGridColor() virtual void SetGridColor( COLOR4D aColor ) override; const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override @@ -145,6 +466,43 @@ public: return m_gerberLayout->ViewBBox(); } + DECLARE_EVENT_TABLE() + +protected: + void setupUIConditions() override; + +private: + void updateComponentListSelectBox(); + void updateNetnameListSelectBox(); + void updateAperAttributesSelectBox(); + void updateDCodeSelectBox(); + void unitsChangeRefresh() override; // See class EDA_DRAW_FRAME + + void OnClearJobFileHistory( wxCommandEvent& aEvent ); + void OnClearZipFileHistory( wxCommandEvent& aEvent ); + void OnClearDrlFileHistory( wxCommandEvent& aEvent ); + void OnClearGbrFileHistory( wxCommandEvent& aEvent ); + + // The Tool Framework initialization + void setupTools(); + + /// Updates the GAL with display settings changes + void applyDisplaySettingsToGAL(); + +public: + wxChoice* m_SelComponentBox; // a choice box to display and highlight component + // graphic items + wxChoice* m_SelNetnameBox; // a choice box to display and highlight netlist + // graphic items + wxChoice* m_SelAperAttributesBox; // a choice box to display aperture attributes and + // highlight items + GBR_LAYER_BOX_SELECTOR* m_SelLayerBox; // The combobox to select the current active + // graphic layer + // (which is drawn on top on the other layers + DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to highlight. + wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about + // gerber data (format..) + protected: GERBER_LAYER_WIDGET* m_LayersManager; @@ -152,19 +510,8 @@ protected: FILE_HISTORY m_drillFileHistory; FILE_HISTORY m_jobFileHistory; - wxString m_lastFileName; // The last filename chosen to be proposed to the user - - void setupUIConditions() override; - -public: - wxChoice* m_SelComponentBox; // a choice box to display and highlight component graphic items - wxChoice* m_SelNetnameBox; // a choice box to display and highlight netlist graphic items - wxChoice* m_SelAperAttributesBox; // a choice box to display aperture attributes and highlight items - GBR_LAYER_BOX_SELECTOR* m_SelLayerBox; // The combobox to select the current active graphic layer - // (which is drawn on top on the other layers - DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to highlight. - wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about - // gerber data (format..) + wxString m_lastFileName; // The last filename chosen to be proposed to the + // user. private: int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn: @@ -177,381 +524,21 @@ private: // (transparency mode) // m_displayMode = 0, 1 or 2 - bool m_show_layer_manager_tools; + bool m_show_layer_manager_tools; - void updateComponentListSelectBox(); - void updateNetnameListSelectBox(); - void updateAperAttributesSelectBox(); - void updateDCodeSelectBox(); - void unitsChangeRefresh() override; // See class EDA_DRAW_FRAME - - void OnClearJobFileHistory( wxCommandEvent& aEvent ); - void OnClearZipFileHistory( wxCommandEvent& aEvent ); - void OnClearDrlFileHistory( wxCommandEvent& aEvent ); - void OnClearGbrFileHistory( wxCommandEvent& aEvent ); - - // The Tool Framework initalization - void setupTools(); - - /// Updates the GAL with display settings changes - void applyDisplaySettingsToGAL(); - -public: - GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ); - ~GERBVIEW_FRAME(); - - void doCloseWindow() override; - - bool OpenProjectFiles( const std::vector& aFileSet, int aCtl ) override; - - /** - * Loads a list of Gerber and NC drill files and updates the view based on them - * - * @param aPath is the base path for the filenames if they are relative - * @param aFilenameList is a list of filenames to load - * @param aFileType is a list of type of files to load (0 = Gerber, 1 = NC drill) - * if nullptr, files are expected Gerber type. - * @return true if every file loaded successfully - */ - bool LoadListOfGerberAndDrillFiles( const wxString& aPath, - const wxArrayString& aFilenameList, - const std::vector* aFileType = nullptr ); - - // Virtual basic functions: - void ReCreateHToolbar() override; - void ReCreateAuxiliaryToolbar() override; - - /** - * Function ReCreateVToolbar - * creates or updates the right vertical toolbar. - */ - void ReCreateVToolbar() override; - - /** - * Create or update the left vertical toolbar (option toolbar) - */ - void ReCreateOptToolbar() override; - - void ReCreateMenuBar() override; - void UpdateStatusBar() override; - - /** - * Function GetDisplayMode - * @return 0 for fast mode (not fully compatible with negative objects) - * 1 for exact mode, write mode - * 2 for exact mode, OR mode (transparency mode) - */ - int GetDisplayMode() { return m_displayMode; } - - /** - * Function SetDisplayMode - * @param aMode = 0 for fast mode - * 1 for exact mode, write mode - * 2 for exact mode, OR mode (transparency mode) - */ - void SetDisplayMode( int aMode ) { m_displayMode = aMode; } - - /** - * Function IsElementVisible - * tests whether a given element category is visible. Keep this as an - * inline function. - * @param aLayerID is an item id from the enum GERBVIEW_LAYER_ID - * @return bool - true if the element is visible. - */ - bool IsElementVisible( int aLayerID ) const; - - /** - * Function SetElementVisibility - * changes the visibility of an element category - * @param aItemIdVisible is an item id from the enum GERBVIEW_LAYER_ID - * @param aNewState = The new visibility state of the element category - * (see enum PCB) - */ - void SetElementVisibility( int aLayerID, bool aNewState ); - - /** - * Function SetGridVisibility(), virtual from EDA_DRAW_FRAME - * It may be overloaded by derived classes - * @param aVisible = true if the grid must be shown - */ - void SetGridVisibility( bool aVisible ) override; - - /** - * Function GetVisibleLayers - * is a proxy function that calls the correspondent function in m_BoardSettings - * @return LSET of the visible layers - */ - LSET GetVisibleLayers() const; - - /** - * Function SetVisibleLayers - * is a proxy function that calls the correspondent function in m_BoardSettings - * @param aLayerMask = The new set of visible layers - */ - void SetVisibleLayers( LSET aLayerMask ); - - /** - * Function IsLayerVisible - * tests whether a given layer is visible - * @param aLayer = The layer to be tested (still 0-31!) - * @return bool - true if the layer is visible. - */ - bool IsLayerVisible( int aLayer ) const; - - /** - * Function GetVisibleElementColor - * returns the color of a gerber visible element. - */ - COLOR4D GetVisibleElementColor( int aLayerID ); - - void SetVisibleElementColor( int aLayerID, COLOR4D aColor ); - - COLOR4D GetLayerColor( int aLayer ) const; - void SetLayerColor( int aLayer, COLOR4D aColor ); - - /** - * Function GetNegativeItemsColor - * @return the color of negative items. - * This is usually the background color, but can be another color in order to see - * negative objects - */ - COLOR4D GetNegativeItemsColor(); - - /** - * Function ReFillLayerWidget - * changes out all the layers in m_Layers; called upon loading new gerber files. - */ - void ReFillLayerWidget(); - - /** - * Function SetActiveLayer - * will change the currently active layer to \a aLayer and update the GERBER_LAYER_WIDGET. - */ - void SetActiveLayer( int aLayer, bool doLayerWidgetUpdate = true ); - - /** - * Function SetActiveLayer - * returns the active layer - */ - int GetActiveLayer() const { return m_activeLayer; } - - /** - * Function getNextAvailableLayer - * finds the next empty layer starting at \a aLayer and returns it to the caller. If no - * empty layers are found, NO_AVAILABLE_LAYERS is return. - * @param aLayer The first layer to search. - * @return The first empty layer found or NO_AVAILABLE_LAYERS. - */ - int getNextAvailableLayer( int aLayer = 0 ) const; - - /** - * Function syncLayerWidget - * updates the currently "selected" layer within the GERBER_LAYER_WIDGET. - * The currently active layer is defined by the return value of GetActiveLayer(). - *

            - * This function cannot be inline without including layer_widget.h in here and we do not - * want to do that. - */ - void syncLayerWidget(); - - /** - * Function syncLayerBox - * updates the currently "selected" layer within m_SelLayerBox - * The currently active layer, as defined by the return value of GetActiveLayer(). - * @param aRebuildLayerBox = true to rebuild the layer box - * false to just updates the selection. - */ - void syncLayerBox( bool aRebuildLayerBox = false ); - - /** - * Function UpdateTitleAndInfo - * displays the short filename (if exists) of the selected layer on the caption of the main - * GerbView window and some other parameters - * Name of the layer (found in the gerber file: LN <name> command) in the status bar - * Name of the Image (found in the gerber file: IN <name> command) in the status bar - * and other data in toolbar - */ - void UpdateTitleAndInfo(); - - /** - * Function DisplayGridMsg() - * - * Display the current grid pane on the status bar. - */ - void DisplayGridMsg() override; - - void LoadSettings( APP_SETTINGS_BASE* aCfg ) override; - - void SaveSettings( APP_SETTINGS_BASE* aCfg ) override; - - void ToggleLayerManager(); - - void ShowChangedLanguage() override; - - /// Handles the changing of the highlighted component/net/attribute - void OnSelectHighlightChoice( wxCommandEvent& event ); - - /** - * Function OnSelectActiveDCode - * Selects the active DCode for the current active layer. - * Items using this DCode are highlighted. - */ - void OnSelectActiveDCode( wxCommandEvent& event ); - - /** - * Function OnSelectActiveLayer - * Selects the active layer: - * - if a file is loaded, it is loaded in this layer - * _ this layer is displayed on top of other layers - */ - void OnSelectActiveLayer( wxCommandEvent& event ); - - /** - * Function OnSelectDisplayMode - * called on a display mode selection - * Mode selection can be fast display, - * or exact mode with stacked images or with transparency - */ - void OnSelectDisplayMode( wxCommandEvent& event ); - - /** - * Function OnQuit - * called on request of application quit - */ - void OnQuit( wxCommandEvent& event ); - - void OnUpdateDrawMode( wxUpdateUIEvent& aEvent ); - void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent ); - void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent ); - - /** - * Function OnGbrFileHistory - * deletes the current data and loads a Gerber file selected from history list on - * current layer. - */ - void OnGbrFileHistory( wxCommandEvent& event ); - - /** - * Function OnDrlFileHistory - * deletes the current data and load a drill file in Excellon format selected from - * history list on current layer. - */ - void OnDrlFileHistory( wxCommandEvent& event ); - - /** - * Function OnZipFileHistory - * deletes the current data and load a zip archive file selected from the - * history list. The archive is expected coantaining a set of gerber and drill file - */ - void OnZipFileHistory( wxCommandEvent& event ); - - /** - * deletes the current data and load a gerber job file selected from the - * history list. - */ - void OnJobFileHistory( wxCommandEvent& event ); - - /** - * Extracts gerber and drill files from the zip archive, and load them - * @param aFullFileName is the full filename of the zip archive - * @param aReporter a REPORTER to collect warning and error messages - * @return true if OK, false if a file cannot be readable - */ - bool unarchiveFiles( const wxString& aFullFileName, REPORTER* aReporter = nullptr ); - - /** - * function LoadGerberFiles - * Load a photoplot (Gerber) file or many files. - * @param aFileName - void string or file name with full path to open or empty string to - * open a new file. In this case one one file is loaded - * if void string: user will be prompted for filename(s) - * @return true if file was opened successfully. - */ - bool LoadGerberFiles( const wxString& aFileName ); - bool Read_GERBER_File( const wxString& GERBER_FullFileName ); - - /** - * function LoadExcellonFiles - * Load a drill (EXCELLON) file or many files. - * @param aFileName - void string or file name with full path to open or empty string to - * open a new file. In this case one one file is loaded - * if empty string: user will be prompted for filename(s) - * @return true if file was opened successfully. - */ - bool LoadExcellonFiles( const wxString& aFileName ); - bool Read_EXCELLON_File( const wxString& aFullFileName ); - - /** - * function LoadZipArchiveFileLoadZipArchiveFile - * Load a zipped archive file. - * @param aFileName - void string or file name with full path to open or empty string to - * open a new file. - * if empty string: user will be prompted for filename(s) - * @return true if file was opened successfully. - */ - bool LoadZipArchiveFile( const wxString& aFileName ); - - - /** - * Load a Gerber job file, and load gerber files found in job files. - * @param aFileName - void string or file name with full path to open or empty string to - * open a new file. - * if empty string: user will be prompted for filename(s) - * @return true if file(s) was opened successfully. - */ - bool LoadGerberJobFile( const wxString& aFileName ); - - // PCB handling - bool Clear_DrawLayers( bool query ); - void Erase_Current_DrawLayer( bool query ); - - void SortLayersByX2Attributes(); - - /** - * Updates the display options and refreshes the view as needed - * @param aOptions is the new options to apply - */ - void UpdateDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions ); - - /* SaveCopyInUndoList() virtual - * currently: do nothing in GerbView. - */ - void SaveCopyInUndoList( GERBER_DRAW_ITEM* aItemToCopy, - UNDO_REDO aTypeCommand = UNDO_REDO::UNSPECIFIED, - const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) { } - - /** - * Function SaveCopyInUndoList (overloaded). - * Creates a new entry in undo list of commands. - * add a list of pickers to handle a list of items - * @param aItemsList = the list of items modified by the command to undo - * @param aTypeCommand = command type (see enum UNDO_REDO) - * @param aTransformPoint = the reference point of the transformation, - * for commands like move - */ - void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, - UNDO_REDO aTypeCommand, - const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) - { - // currently: do nothing in GerbView. - } - - ///> @copydoc EDA_DRAW_FRAME::ActivateGalCanvas - void ActivateGalCanvas() override; - - /** - * Allows Gerbview to install its preferences panels into the preferences dialog. - */ - void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override; - - /** - * Called after the preferences dialog is run. - */ - void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override; - - SELECTION& GetCurrentSelection() override; - - DECLARE_EVENT_TABLE() + GBR_LAYOUT* m_gerberLayout; + int m_activeLayer; + wxPoint m_grid_origin; + PAGE_INFO m_paper; // used only to show paper limits to screen + GBR_DISPLAY_OPTIONS m_DisplayOptions; + wxStaticText* m_cmpText; // a message on the auxiliary toolbar, + // relative to the m_SelComponentBox + wxStaticText* m_netText; // a message on the auxiliary toolbar, + // relative to the m_SelNetnameBox + wxStaticText* m_apertText; // a message on the auxiliary toolbar, + // relative to the m_SelAperAttributesBox + wxStaticText* m_dcodeText; // a message on the auxiliary toolbar, + // relative to the m_DCodeSelector }; #endif /* WX_GERBER_STRUCT_H */ diff --git a/gerbview/tools/gerbview_actions.h b/gerbview/tools/gerbview_actions.h index 1406f88f34..5644da3e95 100644 --- a/gerbview/tools/gerbview_actions.h +++ b/gerbview/tools/gerbview_actions.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 Jon Evans - * 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 modify it * under the terms of the GNU General Public License as published by the @@ -29,9 +29,7 @@ class TOOL_EVENT; class TOOL_MANAGER; /** - * GERBVIEW_ACTIONS - * - * Gathers all the actions that are shared by tools. The instance of GERBVIEW_ACTIONS is created + * Gather all the actions that are shared by tools. The instance of GERBVIEW_ACTIONS is created * inside of ACTION_MANAGER object that registers the actions. */ class GERBVIEW_ACTIONS : public ACTIONS @@ -44,7 +42,7 @@ public: /// Select a single item under the cursor position static TOOL_ACTION selectionCursor; - /// Clears the current selection + /// Clear the current selection static TOOL_ACTION selectionClear; /// Selects an item (specified as the event parameter). @@ -93,7 +91,7 @@ public: static TOOL_ACTION highlightComponent; static TOOL_ACTION highlightAttribute; - ///> @copydoc COMMON_ACTIONS::TranslateLegacyId() + ///< @copydoc COMMON_ACTIONS::TranslateLegacyId() virtual OPT TranslateLegacyId( int aId ) override { return OPT(); } }; diff --git a/gerbview/tools/gerbview_control.h b/gerbview/tools/gerbview_control.h index 53f73db260..f36f02c8fd 100644 --- a/gerbview/tools/gerbview_control.h +++ b/gerbview/tools/gerbview_control.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 Jon Evans - * 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 modify it * under the terms of the GNU General Public License as published by the @@ -27,9 +27,7 @@ class EDA_DRAW_PANEL_GAL; class GERBVIEW_FRAME; /** - * GERBVIEW_CONTROL - * - * Handles actions that are shared between different frames in pcbnew. + * Handle actions that are shared between different frames in Pcbnew. */ class GERBVIEW_CONTROL : public TOOL_INTERACTIVE @@ -67,7 +65,7 @@ public: int UpdateMessagePanel( const TOOL_EVENT& aEvent ); int Print( const TOOL_EVENT& aEvent ); - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; protected: diff --git a/gerbview/tools/gerbview_inspection_tool.h b/gerbview/tools/gerbview_inspection_tool.h index 7587b7aa19..2abe143768 100644 --- a/gerbview/tools/gerbview_inspection_tool.h +++ b/gerbview/tools/gerbview_inspection_tool.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2017-2020 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 modify it * under the terms of the GNU General Public License as published by the @@ -36,16 +36,16 @@ public: /// @copydoc TOOL_BASE::Reset() void Reset( RESET_REASON aReason ) override; - ///> Launches a tool to measure between points + ///< Launch a tool to measure between points int MeasureTool( const TOOL_EVENT& aEvent ); - ///> Show a list of the DCodes + ///< Show a list of the DCodes int ShowDCodes( const TOOL_EVENT& aEvent ); - ///> Show the source for the gerber file + ///< Show the source for the gerber file int ShowSource( const TOOL_EVENT& aEvent ); - ///> Sets up handlers for various events. + ///< Set up handlers for various events. void setTransitions() override; private: diff --git a/gerbview/tools/gerbview_selection_tool.h b/gerbview/tools/gerbview_selection_tool.h index 94d5d7c3a3..e93835de7c 100644 --- a/gerbview/tools/gerbview_selection_tool.h +++ b/gerbview/tools/gerbview_selection_tool.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 Jon Evans - * Copyright (C) 2017-2019 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 modify it * under the terms of the GNU General Public License as published by the @@ -40,9 +40,7 @@ namespace KIGFX /** - * GERBVIEW_SELECTION_TOOL - * - * Selection tool for GerbView, based on the one in PcbNew + * Selection tool for GerbView, based on the one in Pcbnew */ class GERBVIEW_SELECTION_TOOL : public TOOL_INTERACTIVE { @@ -60,16 +58,12 @@ public: int UpdateMenu( const TOOL_EVENT& aEvent ); /** - * Function Main() - * * The main loop. */ int Main( const TOOL_EVENT& aEvent ); /** - * Function GetSelection() - * - * Returns the set of currently selected items. + * Return the set of currently selected items. */ GERBVIEW_SELECTION& GetSelection(); @@ -81,40 +75,37 @@ public: int UnselectItem( const TOOL_EVENT& aEvent ); int UnselectItems( const TOOL_EVENT& aEvent ); - ///> Sets up handlers for various events. + ///< Sets up handlers for various events. void setTransitions() override; private: /** - * Function selectPoint() - * Selects an item pointed by the parameter aWhere. If there is more than one item at that + * Select an item pointed by the parameter aWhere. If there is more than one item at that * place, there is a menu displayed that allows one to choose the item. * * @param aWhere is the place where the item should be selected. * @param aAllowDisambiguation decides what to do in case of disambiguation. If true, then - * a menu is shown, otherise function finishes without selecting anything. + * a menu is shown, otherwise function finishes without selecting anything. * @return True if an item was selected, false otherwise. */ bool selectPoint( const VECTOR2I& aWhere, bool aOnDrag = false ); /** - * Function selectCursor() - * Selects an item under the cursor unless there is something already selected or - * aSelectAlways is true. + * Select an item under the cursor unless there is something already selected or + * \a aSelectAlways is true. + * * @param aSelectAlways forces to select an item even if there is an item already selected. * @return true if eventually there is an item selected, false otherwise. */ bool selectCursor( bool aSelectAlways = false ); /** - * Function clearSelection() - * Clears the current selection. + * Clear the current selection. */ void clearSelection(); /** - * Function disambiguationMenu() - * Handles the menu that allows one to select one of many items in case + * Handle the menu that allows one to select one of many items in case * there is more than one item at the selected point (@see selectCursor()). * * @param aItems contains list of items that are displayed to the user. @@ -122,39 +113,36 @@ private: EDA_ITEM* disambiguationMenu( GERBER_COLLECTOR* aItems ); /** - * Function selectable() - * Checks conditions for an item to be selected. + * Check conditions for an item to be selected. * * @return True if the item fulfills conditions to be selected. */ bool selectable( const EDA_ITEM* aItem ) const; /** - * Function select() - * Takes necessary action mark an item as selected. + * Take necessary action mark an item as selected. * * @param aItem is an item to be selected. */ void select( EDA_ITEM* aItem ); /** - * Function unselect() - * Takes necessary action mark an item as unselected. + * Take necessary action mark an item as unselected. * * @param aItem is an item to be unselected. */ void unselect( EDA_ITEM* aItem ); /** - * Function selectVisually() - * Marks item as selected, but does not add it to the ITEMS_PICKED_LIST. + * Mark item as selected, but does not add it to the #ITEMS_PICKED_LIST. + * * @param aItem is an item to be be marked. */ void selectVisually( EDA_ITEM* aItem ); /** - * Function unselectVisually() - * Marks item as selected, but does not add it to the ITEMS_PICKED_LIST. + * Mark item as selected, but does not add it to the #ITEMS_PICKED_LIST. + * * @param aItem is an item to be be marked. */ void unselectVisually( EDA_ITEM* aItem );