Commit 8f79b146 authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

This patch restores some of the goodness in Vladimir's rev 3239, and in particular

the GetPosition() and SetPosition() changes.  It also starts towards making m_Orientation
and m_Thickness fields private with accessors, but does not complete this latter goal.
parent 701fa6b0
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -643,7 +643,7 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )

    SetGLColor( color );
    s_Text3DZPos  = g_Parm_3D_Visu.m_LayerZcoord[layer];
    s_Text3DWidth = text->m_Thickness * g_Parm_3D_Visu.m_BoardScale;
    s_Text3DWidth = text->GetThickness() * g_Parm_3D_Visu.m_BoardScale;
    glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
    wxSize size = text->m_Size;

@@ -658,27 +658,27 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )

        offset.y = text->GetInterline();

        RotatePoint( &offset, text->m_Orient );
        RotatePoint( &offset, text->GetOrientation() );

        for( unsigned i = 0; i<list->Count(); i++ )
        {
            wxString txt = list->Item( i );
            DrawGraphicText( NULL, NULL, pos, (EDA_Colors) color,
                             txt, text->m_Orient, size,
                             txt, text->GetOrientation(), size,
                             text->m_HJustify, text->m_VJustify,
                             text->m_Thickness, text->m_Italic,
                             text->GetThickness(), text->m_Italic,
                             true, Draw3dTextSegm );
            pos += offset;
        }

        delete (list);
        delete list;
    }
    else
    {
        DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color,
                         text->m_Text, text->m_Orient, size,
                         text->m_Text, text->GetOrientation(), size,
                         text->m_HJustify, text->m_VJustify,
                         text->m_Thickness, text->m_Italic,
                         text->GetThickness(), text->m_Italic,
                         true,
                         Draw3dTextSegm );
    }
@@ -820,7 +820,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
                {
                    wxPoint& pt = points[ii];

                    RotatePoint( &pt.x, &pt.y, module->m_Orient );
                    RotatePoint( &pt.x, &pt.y, module->GetOrientation() );
                    pt += module->m_Pos;
                }

@@ -868,7 +868,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
            {
                wxPoint& pt = points[ii];

                RotatePoint( &pt.x, &pt.y, module->m_Orient );
                RotatePoint( &pt.x, &pt.y, module->GetOrientation() );
                pt += module->m_Pos;
            }

+6 −1
Original line number Diff line number Diff line
@@ -167,11 +167,16 @@ public:
     * @return const wxPoint& - The position of this object.
     * This function exists mainly to satisfy the virtual GetPosition() in parent class
     */
    wxPoint& GetPosition()
    const wxPoint GetPosition() const
    {
        return m_Start;  // it had to be start or end.
    }

    void SetPosition( const wxPoint& aPos )
    {
        m_Start = aPos;
    }

    /**
     * Function GetABPosition
     * returns the image position of aPosition for this object.
+10 −3
Original line number Diff line number Diff line
@@ -239,7 +239,6 @@ public:
        m_Size.x = pos.x - m_Pos.x; m_Size.y = pos.y - m_Pos.y;
    }


    /**
     * Function Intersects
     * @return bool - true if the argument rectangle intersects this rectangle.
@@ -729,12 +728,14 @@ enum FILL_T {
 */
class EDA_TEXT
{

public:
    int      m_Thickness;               /* pen size used to draw this text */
    int      m_Orient;                  /* Orient in 0.1 degrees */

    wxString m_Text;                    /* text! */
    wxPoint  m_Pos;                     /* XY position of anchor text. */
    wxSize   m_Size;                    /* XY size of text */
    int      m_Thickness;               /* pen size used to draw this text */
    int      m_Orient;                  /* Orient in 0.1 degrees */
    bool     m_Mirror;                  /* Display Normal / mirror */
    int      m_Attributs;               /* flags (visible...) */
    bool     m_Italic;                  /* true to simulate (or use if exists)
@@ -766,6 +767,9 @@ public:
     */
    int GetThickness() const { return m_Thickness; };

    void SetOrientation( int aOrientation ) { m_Orient = aOrientation; }
    int  GetOrientation() const { return m_Orient; }

    /**
     * Function SetSize
     * sets text size.
@@ -780,6 +784,9 @@ public:
     */
    wxSize GetSize() const { return m_Size; };

    //void SetPosition( const wxPoint& aPoint ) { m_Pos = aPoint; }
    //wxPoint GetPosition() const { return m_Pos; }

    int GetLength() const { return m_Text.Length(); };

    /**
+11 −5
Original line number Diff line number Diff line
@@ -76,9 +76,16 @@ public:
    /**
     * Function GetPosition
     * returns the position of this object.
     * @return wxPoint& - The position of this object, non-const so it can be changed
     * @return const wxPoint - The position of this object
     */
    virtual wxPoint& GetPosition() = 0;
    virtual const wxPoint GetPosition() const = 0;

     /**
      * Function SetPosition
      * sets the position of this object.
      * @param aPos is the new position of this object
      */
    virtual void SetPosition( const wxPoint& aPos ) = 0;

    /**
     * Function GetLayer
@@ -313,10 +320,9 @@ public:
    {}

    //-----< satisfy some virtual functions >------------------------------
    wxPoint& GetPosition()
    const wxPoint GetPosition()
    {
        static wxPoint dummy;
        return dummy;
        return wxPoint(0, 0);   // dummy
    }

    void Draw( EDA_DRAW_PANEL* DrawPanel, wxDC* DC,
+20 −8
Original line number Diff line number Diff line
@@ -538,6 +538,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
{
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
    EDA_ITEM*   item;
    wxPoint     tmp;

    if( module == NULL )
        return;
@@ -549,7 +550,10 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
        if( pad->m_Selected == 0 )
            continue;

        SETMIRROR( pad->GetPosition().x );
        tmp = pad->GetPosition();
        SETMIRROR( tmp.x );
        pad->SetPosition( tmp );

        pad->m_Pos0.x = pad->GetPosition().x;
        NEGATE( pad->m_Offset.x );
        NEGATE( pad->m_DeltaSize.x );
@@ -567,18 +571,19 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
        switch( item->Type() )
        {
        case PCB_MODULE_EDGE_T:
        {
            EDGE_MODULE * edge =  (EDGE_MODULE*) item;
            EDGE_MODULE * edge;
            edge = (EDGE_MODULE*) item;
            SETMIRROR( edge->m_Start.x );
            edge->m_Start0.x = edge->m_Start.x;
            SETMIRROR( edge->m_End.x );
            edge->m_End0.x = edge->m_End.x;
            NEGATE( edge->m_Angle );
        }
            break;

        case PCB_MODULE_TEXT_T:
            SETMIRROR( ( (TEXTE_MODULE*) item )->GetPosition().x );
            tmp = ( (TEXTE_MODULE*) item )->GetPosition();
            SETMIRROR( tmp.x );
            ( (TEXTE_MODULE*) item )->SetPosition( tmp );
            ( (TEXTE_MODULE*) item )->m_Pos0.x = ( (TEXTE_MODULE*) item )->GetPosition().x;
            break;

@@ -609,7 +614,10 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
        if( pad->m_Selected == 0 )
            continue;

        ROTATE( pad->GetPosition() );
        wxPoint pos = pad->GetPosition();
        ROTATE( pos );
        pad->SetPosition( pos );

        pad->m_Pos0    = pad->GetPosition();
        pad->m_Orient += 900;
        NORMALIZE_ANGLE_POS( pad->m_Orient );
@@ -632,7 +640,11 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
            break;

        case PCB_MODULE_TEXT_T:
            ROTATE( ( (TEXTE_MODULE*) item )->GetPosition() );
            {
                wxPoint pos = ( (TEXTE_MODULE*) item )->GetPosition();
                ROTATE( pos );
                ( (TEXTE_MODULE*) item )->SetPosition( pos );
            }
            ( (TEXTE_MODULE*) item )->m_Pos0 = ( (TEXTE_MODULE*) item )->GetPosition();
            ( (TEXTE_MODULE*) item )->m_Orient += 900;
            break;
Loading