Loading change_log.txt +18 −6 Original line number Diff line number Diff line Loading @@ -7,9 +7,21 @@ email address. 2007-Aug-23 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ @todo add constructor initializers for classes that were derived from + eeschema & pcbnew * Fixed MODULE::Visit() and BOARD::Vist() so they traverse certain lists only once and they are working nicely now. * You can test the GENERALCOLLECTOR::Scan() code by compiling with DEBUG=1 on the command line and enabling the stuff near line 124 in pcbnew/controle.cpp, then watch Show( std::cout ) show the selected items in xml format on your console. (launch pcbnew from command line.) @todo: The layer selection mechanism used by the collector is still inadequate, so tomorrow I will add a new class COLLECTORS_GUIDE which can be used by a COLLECTOR to control its operation. It adds the concept of layer locking, even though PCBNEW does not support that in the UI yet. @todo: add constructor initializers for classes that were derived from EDA_BaseLineStruct but are now not. Its late, will do tomorrow. @todo test yesterday's changes, it builds, may not run right yet. 2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com> Loading @@ -18,15 +30,15 @@ email address. Things are still pretty transient, should be stable a day or two: * Fixed a filename case sensitivity problem that would show up on Linux but probably not on Windows: bitmap/Reload.xpm needed uppercase R. * Wedged a new class BOARD_ITEM underneath all PCB drawable classes, this is * Wedged a new class BOARD_ITEM underneath all PCB drawable classes. This is a big change and may introduce a bug or two, but it is worth it for the future, because we can introduce virtual functions there that do not impact future, because we can add virtual functions there that do not impact the entire project (since everything is derived from EDA_BaseStruct). The corresponding class in EESCHEMA seems to be DrawPartStruct, so we had nothing in PCBNEW like that. BOARD_ITEM::GetLayer() and SetLayer() introduced, more functions to come. Much of this work is geared towards making collectors.cpp's ARROWCOLLECTOR::Inspect() very very simple, and that can be model for future work. very very simple, and that can be a model for future work. * Changed min() and max() macros to MIN() and MAX() because min() and max() are actually reserved according to the C++ standard! (and their usage prevented the use of #include <vector>). Loading common/base_struct.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,10 @@ SEARCH_RESULT EDA_BaseStruct::Visit( INSPECTOR* inspector, const void* testData, { KICAD_T stype; #if defined(DEBUG) std::cout << GetClass().mb_str() << ' '; #endif for( const KICAD_T* p = scanTypes; (stype=*p) != EOT; ++p ) { // If caller wants to inspect my type Loading include/base_struct.h +43 −7 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public: EDA_BaseStruct* m_Son; /* Linked list: Link (son struct) */ EDA_BaseStruct* m_Image; /* Link to an image copy for undelete or abort command */ int m_Flags; // flags for editions and other int m_Flags; // flags for editing and other misc. uses #define IS_CHANGED (1<<0) #define IS_LINKED (1<<1) #define IN_EDIT (1<<2) Loading @@ -154,7 +154,6 @@ public: unsigned long m_TimeStamp; // Time stamp used for logical links int m_Selected; /* Used by block commands, and selective editing */ // int m_Layer; ///< used by many derived classes, so make common private: int m_Status; Loading Loading @@ -394,8 +393,8 @@ public: { } BOARD_ITEM* Next() { return (BOARD_ITEM*) Pnext; } BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; } BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; } /** * Function GetLayer Loading @@ -411,6 +410,43 @@ public: void SetLayer( int aLayer ) { m_Layer = aLayer; } /** * Function IsOnLayer * tests to see if this object is on the given layer. Is virtual so * objects like D_PAD, which reside on multiple layers can do their own * form of testing. * @param aLayer The layer to test for. * @return bool - true if on given layer, else false. */ virtual bool IsOnLayer( int aLayer ) const { return m_Layer == aLayer; } /** * Function IsOnOneOfTheseLayers * returns true if this object is on one of the given layers. Is virtual so * objects like D_PAD, which reside on multiple layers, can do their own * form of testing. * @param aLayerMask The bit-mapped set of layers to test for. * @return bool - true if on one of the given layers, else false. */ virtual bool IsOnOneOfTheseLayers( int aLayerMask ) const { return ( (1<<m_Layer) & aLayerMask ) != 0; } /** * Function IsLocked * @returns bool - true if the object is locked, else false */ virtual bool IsLocked() const { return false; // only MODULEs can be locked at this time. } }; Loading include/class_collector.h +2 −20 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ class EDA_BaseStruct; class BOARD; /** Loading @@ -48,16 +47,10 @@ class BOARD; * * Later, after collection, the user can iterate through all the objects * in the remembered collection using GetCount() and the [int] operator. * * Philosophy: this class knows nothing of the context in which as BOARD is used * and that means it knows nothing about which layers are visible or current, * but can handle those concerns by the SetPreferredLayer() function. */ class COLLECTOR : public INSPECTOR { protected: // int m_Type; /// Which object types to scan const KICAD_T* m_ScanTypes; Loading @@ -84,20 +77,9 @@ public: virtual ~COLLECTOR() { // empty the list so that ~list() does not try and delete all // the objects that it holds. list is not the owner of such objects // and this prevents a double free()ing. Empty(); } /** * Function Type * returns the type of the collector. int Type() const { return m_Type; } */ void SetPreferredLayer( int aPreferredLayer ) { m_PreferredLayer = aPreferredLayer; Loading @@ -108,7 +90,7 @@ public: * Function GetCount * returns the number of objects in the list */ int GetCount() const unsigned GetCount() const { return list.size(); } Loading Loading @@ -143,7 +125,7 @@ public: */ EDA_BaseStruct* operator[]( int ndx ) const { if( (unsigned)ndx < (unsigned)GetCount() ) if( (unsigned)ndx < GetCount() ) return list[ ndx ]; return NULL; } Loading include/pcbstruct.h +7 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,13 @@ public: public: EDA_BoardDesignSettings( void ); /** * Function GetVisibleLayers * returns a bit-map of all the layers that are visible. * @return int - the visible layers in bit-mapped form. */ int GetVisibleLayers(); }; Loading Loading
change_log.txt +18 −6 Original line number Diff line number Diff line Loading @@ -7,9 +7,21 @@ email address. 2007-Aug-23 UPDATE Dick Hollenbeck <dick@softplc.com> ================================================================================ @todo add constructor initializers for classes that were derived from + eeschema & pcbnew * Fixed MODULE::Visit() and BOARD::Vist() so they traverse certain lists only once and they are working nicely now. * You can test the GENERALCOLLECTOR::Scan() code by compiling with DEBUG=1 on the command line and enabling the stuff near line 124 in pcbnew/controle.cpp, then watch Show( std::cout ) show the selected items in xml format on your console. (launch pcbnew from command line.) @todo: The layer selection mechanism used by the collector is still inadequate, so tomorrow I will add a new class COLLECTORS_GUIDE which can be used by a COLLECTOR to control its operation. It adds the concept of layer locking, even though PCBNEW does not support that in the UI yet. @todo: add constructor initializers for classes that were derived from EDA_BaseLineStruct but are now not. Its late, will do tomorrow. @todo test yesterday's changes, it builds, may not run right yet. 2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com> Loading @@ -18,15 +30,15 @@ email address. Things are still pretty transient, should be stable a day or two: * Fixed a filename case sensitivity problem that would show up on Linux but probably not on Windows: bitmap/Reload.xpm needed uppercase R. * Wedged a new class BOARD_ITEM underneath all PCB drawable classes, this is * Wedged a new class BOARD_ITEM underneath all PCB drawable classes. This is a big change and may introduce a bug or two, but it is worth it for the future, because we can introduce virtual functions there that do not impact future, because we can add virtual functions there that do not impact the entire project (since everything is derived from EDA_BaseStruct). The corresponding class in EESCHEMA seems to be DrawPartStruct, so we had nothing in PCBNEW like that. BOARD_ITEM::GetLayer() and SetLayer() introduced, more functions to come. Much of this work is geared towards making collectors.cpp's ARROWCOLLECTOR::Inspect() very very simple, and that can be model for future work. very very simple, and that can be a model for future work. * Changed min() and max() macros to MIN() and MAX() because min() and max() are actually reserved according to the C++ standard! (and their usage prevented the use of #include <vector>). Loading
common/base_struct.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,10 @@ SEARCH_RESULT EDA_BaseStruct::Visit( INSPECTOR* inspector, const void* testData, { KICAD_T stype; #if defined(DEBUG) std::cout << GetClass().mb_str() << ' '; #endif for( const KICAD_T* p = scanTypes; (stype=*p) != EOT; ++p ) { // If caller wants to inspect my type Loading
include/base_struct.h +43 −7 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public: EDA_BaseStruct* m_Son; /* Linked list: Link (son struct) */ EDA_BaseStruct* m_Image; /* Link to an image copy for undelete or abort command */ int m_Flags; // flags for editions and other int m_Flags; // flags for editing and other misc. uses #define IS_CHANGED (1<<0) #define IS_LINKED (1<<1) #define IN_EDIT (1<<2) Loading @@ -154,7 +154,6 @@ public: unsigned long m_TimeStamp; // Time stamp used for logical links int m_Selected; /* Used by block commands, and selective editing */ // int m_Layer; ///< used by many derived classes, so make common private: int m_Status; Loading Loading @@ -394,8 +393,8 @@ public: { } BOARD_ITEM* Next() { return (BOARD_ITEM*) Pnext; } BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; } BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; } /** * Function GetLayer Loading @@ -411,6 +410,43 @@ public: void SetLayer( int aLayer ) { m_Layer = aLayer; } /** * Function IsOnLayer * tests to see if this object is on the given layer. Is virtual so * objects like D_PAD, which reside on multiple layers can do their own * form of testing. * @param aLayer The layer to test for. * @return bool - true if on given layer, else false. */ virtual bool IsOnLayer( int aLayer ) const { return m_Layer == aLayer; } /** * Function IsOnOneOfTheseLayers * returns true if this object is on one of the given layers. Is virtual so * objects like D_PAD, which reside on multiple layers, can do their own * form of testing. * @param aLayerMask The bit-mapped set of layers to test for. * @return bool - true if on one of the given layers, else false. */ virtual bool IsOnOneOfTheseLayers( int aLayerMask ) const { return ( (1<<m_Layer) & aLayerMask ) != 0; } /** * Function IsLocked * @returns bool - true if the object is locked, else false */ virtual bool IsLocked() const { return false; // only MODULEs can be locked at this time. } }; Loading
include/class_collector.h +2 −20 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ class EDA_BaseStruct; class BOARD; /** Loading @@ -48,16 +47,10 @@ class BOARD; * * Later, after collection, the user can iterate through all the objects * in the remembered collection using GetCount() and the [int] operator. * * Philosophy: this class knows nothing of the context in which as BOARD is used * and that means it knows nothing about which layers are visible or current, * but can handle those concerns by the SetPreferredLayer() function. */ class COLLECTOR : public INSPECTOR { protected: // int m_Type; /// Which object types to scan const KICAD_T* m_ScanTypes; Loading @@ -84,20 +77,9 @@ public: virtual ~COLLECTOR() { // empty the list so that ~list() does not try and delete all // the objects that it holds. list is not the owner of such objects // and this prevents a double free()ing. Empty(); } /** * Function Type * returns the type of the collector. int Type() const { return m_Type; } */ void SetPreferredLayer( int aPreferredLayer ) { m_PreferredLayer = aPreferredLayer; Loading @@ -108,7 +90,7 @@ public: * Function GetCount * returns the number of objects in the list */ int GetCount() const unsigned GetCount() const { return list.size(); } Loading Loading @@ -143,7 +125,7 @@ public: */ EDA_BaseStruct* operator[]( int ndx ) const { if( (unsigned)ndx < (unsigned)GetCount() ) if( (unsigned)ndx < GetCount() ) return list[ ndx ]; return NULL; } Loading
include/pcbstruct.h +7 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,13 @@ public: public: EDA_BoardDesignSettings( void ); /** * Function GetVisibleLayers * returns a bit-map of all the layers that are visible. * @return int - the visible layers in bit-mapped form. */ int GetVisibleLayers(); }; Loading