Commit 502f3160 authored by stambaughw's avatar stambaughw
Browse files

Global variable reduction and minor code cleaning.

* Remove global variables used by the library editor.
* Add SetWidth() method to library draw objects.
parent 64249102
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -1239,10 +1239,11 @@ LIB_DRAW_ITEM* LIB_COMPONENT::LocateDrawItem( int unit, int convert,
 *                         Otherwise NULL.
 */
LIB_DRAW_ITEM* LIB_COMPONENT::LocateDrawItem( int unit, int convert,
                                              KICAD_T type, const wxPoint& pt, const int aTransMat[2][2] )
                                              KICAD_T type, const wxPoint& pt,
                                              const int aTransMat[2][2] )
{
    /* we use LocateDrawItem( int unit, int convert, KICAD_T type, const wxPoint& pt )
     * to search items.
    /* we use LocateDrawItem( int unit, int convert, KICAD_T type, const
     * wxPoint& pt ) to search items.
     * because this function uses DefaultTransformMatrix as orient/mirror matrix
     * we temporary copy aTransMat in DefaultTransformMatrix
     */
@@ -1269,6 +1270,7 @@ LIB_DRAW_ITEM* LIB_COMPONENT::LocateDrawItem( int unit, int convert,
    return item;
}


void LIB_COMPONENT::SetPartCount( int count )
{
    LIB_DRAW_ITEM_LIST::iterator i;
@@ -1335,7 +1337,8 @@ void LIB_COMPONENT::SetConversion( bool asConvert )
    }
    else
    {
        // Delete converted shape items becuase the converted shape does not exist
        // Delete converted shape items becuase the converted shape does
        // not exist
        LIB_DRAW_ITEM_LIST::iterator i = m_Drawings.begin();

        while( i != m_Drawings.end() )
+5 −7
Original line number Diff line number Diff line
@@ -195,7 +195,8 @@ public:
     * @param showPinText - Show pin text if true.
     * @param drawFields - Draw field text if true otherwise just draw
     *                     body items (useful to draw a body in schematic,
     *        because fields of schematic components replace the lib component fields).
     *                     because fields of schematic components replace
     *                     the lib component fields).
     * @param onlySelected - Draws only the body items that are selected.
     *                       Used for block move redraws.
     */
@@ -401,7 +402,8 @@ public:
     *                         Otherwise NULL.
     */
    LIB_DRAW_ITEM* LocateDrawItem( int unit, int convert, KICAD_T type,
                                   const wxPoint& pt, const int aTransMat[2][2] );
                                   const wxPoint& pt,
                                   const int aTransMat[2][2] );

    /**
     * Return a reference to the draw item list.
@@ -444,10 +446,6 @@ public:
 *
 * Component aliases are not really components.  They are references
 * to an actual component object.
 *
 * @todo Alias objects should really be defined as children of a component
 *       object not as children of a library object.  This would greatly
 *       simplify searching for components in libraries.
 */
class LIB_ALIAS : public CMP_LIB_ENTRY
{
+1 −0
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ protected:
    virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                         const int transform[2][2] );
    virtual int DoGetWidth( void ) { return m_Width; }
    virtual void DoSetWidth( int width ) { m_Width = width; }
};

#endif  //  CLASS_LIBENTRY_FIELDS_H
+10 −1
Original line number Diff line number Diff line
@@ -301,7 +301,7 @@ public:
     * @return int - Width of draw object.
     */
    int GetWidth( void ) { return DoGetWidth(); }

    void SetWidth( int width ) { DoSetWidth( width ); }

protected:
    virtual LIB_DRAW_ITEM* DoGenCopy() = 0;
@@ -326,6 +326,7 @@ protected:
    virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                         const int transform[2][2] ) = 0;
    virtual int DoGetWidth( void ) = 0;
    virtual void DoSetWidth( int width ) = 0;
};


@@ -474,6 +475,7 @@ protected:
    virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                         const int transform[2][2] );
    virtual int DoGetWidth( void ) { return m_Width; }
    virtual void DoSetWidth( int width ) { m_Width = width; }
};


@@ -563,6 +565,7 @@ protected:
    virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                         const int transform[2][2] );
    virtual int DoGetWidth( void ) { return m_Width; }
    virtual void DoSetWidth( int width ) { m_Width = width; }
};


@@ -648,6 +651,7 @@ protected:
    virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                         const int transform[2][2] );
    virtual int DoGetWidth( void ) { return m_Width; }
    virtual void DoSetWidth( int width ) { m_Width = width; }
};


@@ -744,6 +748,7 @@ protected:
    virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                         const int transform[2][2] );
    virtual int DoGetWidth( void ) { return m_Width; }
    virtual void DoSetWidth( int width ) { m_Width = width; }
};


@@ -829,6 +834,7 @@ protected:
    virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                         const int transform[2][2] );
    virtual int DoGetWidth( void ) { return m_Width; }
    virtual void DoSetWidth( int width ) { m_Width = width; }
};

/**********************************/
@@ -913,6 +919,7 @@ protected:
    virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                         const int transform[2][2] );
    virtual int DoGetWidth( void ) { return m_Width; }
    virtual void DoSetWidth( int width ) { m_Width = width; }
};


@@ -1006,6 +1013,7 @@ protected:
    virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                         const int transform[2][2] );
    virtual int DoGetWidth( void ) { return m_Width; }
    virtual void DoSetWidth( int width ) { m_Width = width; }
};

/**********************************************************/
@@ -1099,6 +1107,7 @@ protected:
    virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                         const int transform[2][2] );
    virtual int DoGetWidth( void ) { return m_Width; }
    virtual void DoSetWidth( int width ) { m_Width = width; }
};

#endif  //  CLASSES_BODY_ITEMS_H
+2 −2
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( WinEDA
		if ( CurrentItem->m_Unit == 0 )
            m_CommonUnit->SetValue( TRUE );
	}
	else if ( ! g_FlDrawSpecificUnit )
	else if ( ! m_Parent->m_drawSpecificUnit )
    {
        m_CommonUnit->SetValue( TRUE );
    }
@@ -72,7 +72,7 @@ WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( WinEDA
		if ( CurrentItem->m_Convert == 0 )
            m_CommonConvert->SetValue( TRUE );
	}
	else if ( !g_FlDrawSpecificConvert )
	else if ( !m_Parent->m_drawSpecificConvert )
    {
        m_CommonConvert->SetValue( TRUE );
    }
Loading