Commit bfeaeafe authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Gerbview: enhancements.

parent de37bbad
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -159,8 +159,8 @@ void GERBER_IMAGE::ResetDefaultValues()
                                                    // true = relative Coord
    m_NoTrailingZeros = false;                      // true: trailing zeros deleted
    m_ImageOffset.x   = m_ImageOffset.y = 0;        // Coord Offset, from IO command
    m_ImageRotation = 0;                            // Allowed 0, 900, 1800, 2700 (in 0.1 degree
    m_LocalRotation = 0;                            // Layer totation from RO command (in 0.1 degree)
    m_ImageRotation = 0;                            // Allowed 0, 90, 180, 270 (in degree)
    m_LocalRotation = 0.0;                          // Layer totation from RO command (in 0.1 degree)
    m_Offset.x = 0;
    m_Offset.y = 0;                                 // Coord Offset, from OF command
    m_Scale.x  = m_Scale.y = 1.0;                   // scale (A and B) this layer
@@ -276,10 +276,12 @@ void GERBER_IMAGE::StepAndRepeatItem( const GERBER_DRAW_ITEM& aItem )
}


/** Function DisplayInfo
/** 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.
 * These parameters are valid for the entire file, and must set only once
 * (If more than once, only the last value is used)
 */
void GERBER_IMAGE::DisplayImageInfo( void )
{
@@ -287,20 +289,23 @@ void GERBER_IMAGE::DisplayImageInfo( void )

    m_Parent->ClearMsgPanel();

    // Display Image name
    m_Parent->AppendMsgPanel( _( "Image name" ), m_ImageName, BROWN );
    // Display Image name (Image specific)
    m_Parent->AppendMsgPanel( _( "Image name" ), m_ImageName, CYAN );

    // Display graphic layer number
    // Display graphic layer number used to draw this Image
    // (not a Gerber parameter but is also image specific)
    msg.Printf( wxT( "%d" ), m_GraphicLayer + 1 );
    m_Parent->AppendMsgPanel( _( "Graphic layer" ), msg, BROWN );

    // This next info can be see as debug info, so it can be disabled
    // Display Image rotation (Image specific)
    msg.Printf( wxT( "%d" ), m_ImageRotation );
    m_Parent->AppendMsgPanel( _( "Img Rot." ), msg, CYAN );

    // Display rotation
    msg.Printf( wxT( "%d" ), m_ImageRotation / 10 );
    m_Parent->AppendMsgPanel( _( "Rotation" ), msg, CYAN );
    // Display Image polarity (Image specific)
    msg = m_ImageNegative ? _("Negative") : _("Normal");
    m_Parent->AppendMsgPanel( _( "Polarity" ), msg, BROWN );

    // Display Image justification;
    // Display Image justification and offset for justification (Image specific)
    msg = m_ImageJustifyXCenter ? _("Center") : _("Normal");
    m_Parent->AppendMsgPanel( _( "X Justify" ), msg, DARKRED );

@@ -313,6 +318,6 @@ void GERBER_IMAGE::DisplayImageInfo( void )
    else
        msg.Printf( wxT( "X=%f Y=%f" ), (double) m_ImageJustifyOffset.x*2.54/1000,
                                    (double) m_ImageJustifyOffset.y*2.54/1000 );
    m_Parent->AppendMsgPanel( _( "Image Justify Offset" ), msg, CYAN );
    m_Parent->AppendMsgPanel( _( "Image Justify Offset" ), msg, DARKRED );
}
+2 −4
Original line number Diff line number Diff line
@@ -95,10 +95,8 @@ public:
    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
                                                                // Note these values are stored in 0.1 degrees

    int                m_LocalRotation;                         // Local rotation, added to m_ImageRotation
    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.
+19 −14
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( BOARD_ITEM* aParent, GERBER_IMAGE* aGerberpa
    m_mirrorA       = false;
    m_mirrorB       = false;
    m_drawScale.x   = m_drawScale.y = 1.0;
    m_layerRotation = 0;
    m_lyrRotation   = 0;
    if( m_imageParams )
        SetLayerParameters();
}
@@ -90,7 +90,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
    m_layerOffset   = aSource.m_layerOffset;
    m_drawScale.x   = aSource.m_drawScale.x;
    m_drawScale.y   = aSource.m_drawScale.y;
    m_layerRotation = aSource.m_layerRotation;
    m_lyrRotation   = aSource.m_lyrRotation;
}


@@ -127,13 +127,15 @@ wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition )
    abPos  += m_layerOffset + m_imageParams->m_ImageOffset;
    abPos.x = wxRound( abPos.x * m_drawScale.x );
    abPos.y = wxRound( abPos.y * m_drawScale.y );
    int rotation = m_layerRotation + m_imageParams->m_ImageRotation;
    int rotation = wxRound(m_lyrRotation*10) + (m_imageParams->m_ImageRotation*10);
    if( rotation )
        RotatePoint( &abPos, -rotation );

    // Negate A axis if mirrored
    if( m_mirrorA )
        NEGATE( abPos.x );

    // abPos.y must be negated, because draw axis is top to bottom
    // abPos.y must be negated when no mirror, because draw axis is top to bottom
    if( !m_mirrorB )
        NEGATE( abPos.y );
    return abPos;
@@ -157,7 +159,7 @@ wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition )
        NEGATE( xyPos.x );
    if( !m_mirrorB )
        NEGATE( xyPos.y );
    int rotation = m_layerRotation + m_imageParams->m_ImageRotation;
    int rotation = wxRound(m_lyrRotation*10) + (m_imageParams->m_ImageRotation*10);
    if( rotation )
        RotatePoint( &xyPos, rotation );
    xyPos.x = wxRound( xyPos.x / m_drawScale.x );
@@ -186,7 +188,7 @@ void GERBER_DRAW_ITEM::SetLayerParameters()
    m_drawScale   = m_imageParams->m_Scale;         // A and B scaling factor
    m_layerOffset = m_imageParams->m_Offset;        // Offset from OF command
    // Rotation from RO command:
    m_layerRotation = m_imageParams->m_LocalRotation;
    m_lyrRotation = m_imageParams->m_LocalRotation;
    m_LayerNegative = m_imageParams->GetLayerParams().m_LayerNegative;
}

@@ -477,23 +479,26 @@ void GERBER_DRAW_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
    msg.Printf( wxT( "%d" ), GetLayer() + 1 );
    frame->AppendMsgPanel( _( "Graphic layer" ), msg, BROWN );

    // This next info can be see as debug info, so it can be disabled
#if 1
    // Display item rotation
    // The full rotation is Image rotation + m_lyrRotation
    // but m_lyrRotation is specific to this object
    // so we display only this parameter
    msg.Printf( wxT( "%f" ), m_lyrRotation );
    frame->AppendMsgPanel( _( "Rotation" ), msg, BLUE );

    // Display rotation
    msg.Printf( wxT( "%.1f" ), (double)(m_imageParams->m_ImageRotation+m_layerRotation) / 10 );
    frame->AppendMsgPanel( _( "Rotation" ), msg, DARKRED );
    // Display item polarity (item specific)
    msg = m_LayerNegative ? _("Clear") : _("Dark");
    frame->AppendMsgPanel( _( "Polarity" ), msg, BLUE );

    // Display mirroring
    // Display mirroring (item specific)
    msg.Printf( wxT( "A:%s B:%s" ),
                m_mirrorA ? _("Yes") : _("No"),
                m_mirrorB ? _("Yes") : _("No"));
    frame->AppendMsgPanel( _( "Mirror" ), msg, DARKRED );

    // Display AB axis swap
    // Display AB axis swap (item specific)
    msg = m_swapAxis ? wxT( "A=Y B=X" ) : wxT( "A=X B=Y" );
    frame->AppendMsgPanel( _( "AB axis" ), msg, DARKRED );
#endif
}


+1 −1
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ private:
    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
    int         m_layerRotation;            // Fine rotation, from OR parameter
    double      m_lyrRotation;              // Fine rotation, from OR parameter, in degrees

public:
    GERBER_DRAW_ITEM( BOARD_ITEM* aParent, GERBER_IMAGE* aGerberparams );
+1 −0
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )

    case ID_GERBVIEW_GLOBAL_DELETE:
        Erase_Current_Layer( TRUE );
        ClearMsgPanel();
        break;

    case ID_NO_SELECT_BUTT:
Loading