Commit e1534141 authored by stambaughw's avatar stambaughw
Browse files

Minor bug fixes, compiler warning fixes and code cleaning.

* Fix debug asserts when passing NULL pointers to wxAuiPaneInfo.
* Fix Kicad main window sash sizer bug when using wxAui.
* Remove specctra_test from Visual Studio builds to prevent build errors.
* Add WIN32 to layer widget test so it will build properly on Visual Studio.
* Fixed compiler conversion warnings in PCBNew.
* Fixed worksheet print scaling in PCBNew.
* Minor code renaming.
parent 4936ca3a
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -189,12 +189,15 @@ WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title,

    horiz.LeftDockable( false ).RightDockable( false );

    if( m_HToolBar )
        m_auimgr.AddPane( m_HToolBar,
                          wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );

    if( m_ListCmp )
        m_auimgr.AddPane( m_ListCmp,
                          wxAuiPaneInfo(horiz).Name( wxT( "m_ListCmp" ) ).CentrePane() );

    if( m_FootprintList )
        m_auimgr.AddPane( m_FootprintList,
                          wxAuiPaneInfo( horiz ).Name( wxT( "m_FootprintList" ) ).
                          Right().BestSize( m_FrameSize.x * 0.36, m_FrameSize.y ) );
+45 −45
Original line number Diff line number Diff line
@@ -703,12 +703,12 @@ void SCH_COMPONENT::ClearAnnotation( SCH_SHEET_PATH* aSheet )
 *  which is applied to the initial transform.
 */
/*****************************************************************/
void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
void SCH_COMPONENT::SetOrientation( int aOrientation )
{
    int  TempMat[2][2];
    bool Transform = FALSE;

    switch( type_rotate )
    switch( aOrientation )
    {
    case CMP_ORIENT_0:
    case CMP_NORMAL:            /* Position Initiale */
@@ -731,14 +731,14 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
        Transform = TRUE;
        break;

    case CMP_MIROIR_Y:          /* MirrorY */
    case CMP_MIRROR_Y:          /* MirrorY */
        TempMat[0][0] = -1;
        TempMat[1][1] = 1;
        TempMat[0][1] = TempMat[1][0] = 0;
        Transform = TRUE;
        break;

    case CMP_MIROIR_X:            /* MirrorX */
    case CMP_MIRROR_X:            /* MirrorX */
        TempMat[0][0] = 1;
        TempMat[1][1] = -1;
        TempMat[0][1] = TempMat[1][0] = 0;
@@ -746,59 +746,59 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
        break;

    case CMP_ORIENT_90:
        SetRotationMiroir( CMP_ORIENT_0 );
        SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
        SetOrientation( CMP_ORIENT_0 );
        SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
        break;

    case CMP_ORIENT_180:
        SetRotationMiroir( CMP_ORIENT_0 );
        SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
        SetRotationMiroir( CMP_ROTATE_COUNTERCLOCKWISE );
        SetOrientation( CMP_ORIENT_0 );
        SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
        SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
        break;

    case CMP_ORIENT_270:
        SetRotationMiroir( CMP_ORIENT_0 );
        SetRotationMiroir( CMP_ROTATE_CLOCKWISE );
        SetOrientation( CMP_ORIENT_0 );
        SetOrientation( CMP_ROTATE_CLOCKWISE );
        break;

    case ( CMP_ORIENT_0 + CMP_MIROIR_X ):
        SetRotationMiroir( CMP_ORIENT_0 );
        SetRotationMiroir( CMP_MIROIR_X );
    case ( CMP_ORIENT_0 + CMP_MIRROR_X ):
        SetOrientation( CMP_ORIENT_0 );
        SetOrientation( CMP_MIRROR_X );
        break;

    case ( CMP_ORIENT_0 + CMP_MIROIR_Y ):
        SetRotationMiroir( CMP_ORIENT_0 );
        SetRotationMiroir( CMP_MIROIR_Y );
    case ( CMP_ORIENT_0 + CMP_MIRROR_Y ):
        SetOrientation( CMP_ORIENT_0 );
        SetOrientation( CMP_MIRROR_Y );
        break;

    case ( CMP_ORIENT_90 + CMP_MIROIR_X ):
        SetRotationMiroir( CMP_ORIENT_90 );
        SetRotationMiroir( CMP_MIROIR_X );
    case ( CMP_ORIENT_90 + CMP_MIRROR_X ):
        SetOrientation( CMP_ORIENT_90 );
        SetOrientation( CMP_MIRROR_X );
        break;

    case ( CMP_ORIENT_90 + CMP_MIROIR_Y ):
        SetRotationMiroir( CMP_ORIENT_90 );
        SetRotationMiroir( CMP_MIROIR_Y );
    case ( CMP_ORIENT_90 + CMP_MIRROR_Y ):
        SetOrientation( CMP_ORIENT_90 );
        SetOrientation( CMP_MIRROR_Y );
        break;

    case ( CMP_ORIENT_180 + CMP_MIROIR_X ):
        SetRotationMiroir( CMP_ORIENT_180 );
        SetRotationMiroir( CMP_MIROIR_X );
    case ( CMP_ORIENT_180 + CMP_MIRROR_X ):
        SetOrientation( CMP_ORIENT_180 );
        SetOrientation( CMP_MIRROR_X );
        break;

    case ( CMP_ORIENT_180 + CMP_MIROIR_Y ):
        SetRotationMiroir( CMP_ORIENT_180 );
        SetRotationMiroir( CMP_MIROIR_Y );
    case ( CMP_ORIENT_180 + CMP_MIRROR_Y ):
        SetOrientation( CMP_ORIENT_180 );
        SetOrientation( CMP_MIRROR_Y );
        break;

    case ( CMP_ORIENT_270 + CMP_MIROIR_X ):
        SetRotationMiroir( CMP_ORIENT_270 );
        SetRotationMiroir( CMP_MIROIR_X );
    case ( CMP_ORIENT_270 + CMP_MIRROR_X ):
        SetOrientation( CMP_ORIENT_270 );
        SetOrientation( CMP_MIRROR_X );
        break;

    case ( CMP_ORIENT_270 + CMP_MIROIR_Y ):
        SetRotationMiroir( CMP_ORIENT_270 );
        SetRotationMiroir( CMP_MIROIR_Y );
    case ( CMP_ORIENT_270 + CMP_MIRROR_Y ):
        SetOrientation( CMP_ORIENT_270 );
        SetOrientation( CMP_MIRROR_Y );
        break;

    default:
@@ -841,20 +841,20 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
}


/** function GetRotationMiroir()
/** function GetOrientation()
 * Used to display component orientation (in dialog editor or info)
 * @return the orientation and mirror
 * Note: Because there are different ways to have a given orientation/mirror,
 * the orientation/mirror is not necessary what the used does
 * (example : a mirrorX then a mirrorY give no mirror but rotate the component).
 * So this function find a rotation and a mirror value
 * ( CMP_MIROIR_X because this is the first mirror option tested)
 * ( CMP_MIRROR_X because this is the first mirror option tested)
 *  but can differs from the orientation made by an user
 * ( a CMP_MIROIR_Y is find as a CMP_MIROIR_X + orientation 180, because they
 * ( a CMP_MIRROR_Y is find as a CMP_MIRROR_X + orientation 180, because they
 * are equivalent)
 *
 */
int SCH_COMPONENT::GetRotationMiroir()
int SCH_COMPONENT::GetOrientation()
{
    int  type_rotate = CMP_ORIENT_0;
    int  ComponentMatOrient[2][2];
@@ -866,10 +866,10 @@ int SCH_COMPONENT::GetRotationMiroir()
    int rotate_value[ROTATE_VALUES_COUNT] =
    {
        CMP_ORIENT_0, CMP_ORIENT_90, CMP_ORIENT_180, CMP_ORIENT_270,
        CMP_MIROIR_X + CMP_ORIENT_0, CMP_MIROIR_X + CMP_ORIENT_90,
        CMP_MIROIR_X + CMP_ORIENT_180, CMP_MIROIR_X + CMP_ORIENT_270,
        CMP_MIROIR_Y + CMP_ORIENT_0, CMP_MIROIR_Y + CMP_ORIENT_90,
        CMP_MIROIR_Y + CMP_ORIENT_180, CMP_MIROIR_Y + CMP_ORIENT_270
        CMP_MIRROR_X + CMP_ORIENT_0, CMP_MIRROR_X + CMP_ORIENT_90,
        CMP_MIRROR_X + CMP_ORIENT_180, CMP_MIRROR_X + CMP_ORIENT_270,
        CMP_MIRROR_Y + CMP_ORIENT_0, CMP_MIRROR_Y + CMP_ORIENT_90,
        CMP_MIRROR_Y + CMP_ORIENT_180, CMP_MIRROR_Y + CMP_ORIENT_270
    };

    // Try to find the current transform option:
@@ -878,7 +878,7 @@ int SCH_COMPONENT::GetRotationMiroir()
    for( ii = 0; ii < ROTATE_VALUES_COUNT; ii++ )
    {
        type_rotate = rotate_value[ii];
        SetRotationMiroir( type_rotate );
        SetOrientation( type_rotate );
        if( memcmp( ComponentMatOrient, m_Transform,
                    sizeof(ComponentMatOrient) ) == 0 )
            return type_rotate;
@@ -1132,7 +1132,7 @@ void SCH_COMPONENT::DisplayInfo( WinEDA_DrawFrame* frame )
void SCH_COMPONENT::Mirror_Y(int aYaxis_position)
{
    int dx = m_Pos.x;
    SetRotationMiroir( CMP_MIROIR_Y );
    SetOrientation( CMP_MIRROR_Y );
    m_Pos.x -= aYaxis_position;
    NEGATE( m_Pos.x );
    m_Pos.x += aYaxis_position;
+6 −5
Original line number Diff line number Diff line
@@ -176,8 +176,9 @@ public:
        return new SCH_COMPONENT( *this );
    }

    void            SetRotationMiroir( int type );
    /** function GetRotationMiroir()
    void            SetOrientation( int aOrientation );

    /** function GetOrientation()
     * Used to display component orientation (in dialog editor or info)
     * @return the orientation and mirror
     * Note: Because there are different ways to have a given orientation/mirror,
@@ -185,12 +186,12 @@ public:
     * (example : a mirrorX then a mirrorY give no mirror but rotate the
     * component).
     * So this function find a rotation and a mirror value
     * ( CMP_MIROIR_X because this is the first mirror option tested)
     * ( CMP_MIRROR_X because this is the first mirror option tested)
     *  but can differs from the orientation made by an user
     * ( a CMP_MIROIR_Y is find as a CMP_MIROIR_X + orientation 180, because
     * ( a CMP_MIRROR_Y is find as a CMP_MIRROR_X + orientation 180, because
     * they are equivalent)
     */
    int             GetRotationMiroir();
    int             GetOrientation();

    wxPoint         GetScreenCoord( const wxPoint& coord );
    void            DisplayInfo( WinEDA_DrawFrame* frame );
+12 −12
Original line number Diff line number Diff line
@@ -201,19 +201,19 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
    switch( orientationRadioBox->GetSelection() )
    {
    case 0:
        m_Cmp->SetRotationMiroir( CMP_ORIENT_0 );
        m_Cmp->SetOrientation( CMP_ORIENT_0 );
        break;

    case 1:
        m_Cmp->SetRotationMiroir( CMP_ORIENT_90 );
        m_Cmp->SetOrientation( CMP_ORIENT_90 );
        break;

    case 2:
        m_Cmp->SetRotationMiroir( CMP_ORIENT_180 );
        m_Cmp->SetOrientation( CMP_ORIENT_180 );
        break;

    case 3:
        m_Cmp->SetRotationMiroir( CMP_ORIENT_270 );
        m_Cmp->SetOrientation( CMP_ORIENT_270 );
        break;
    }

@@ -225,11 +225,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
        break;

    case 1:
        m_Cmp->SetRotationMiroir( CMP_MIROIR_X );
        m_Cmp->SetOrientation( CMP_MIRROR_X );
        break;

    case 2:
        m_Cmp->SetRotationMiroir( CMP_MIROIR_Y );
        m_Cmp->SetOrientation( CMP_MIRROR_Y );
        break;
    }
}
@@ -663,8 +663,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
    if( choiceCount <= 1 )
        unitChoice->Enable( false );

    int orientation = m_Cmp->GetRotationMiroir()
        & ~( CMP_MIROIR_X | CMP_MIROIR_Y );
    int orientation = m_Cmp->GetOrientation()
        & ~( CMP_MIRROR_X | CMP_MIRROR_Y );

    if( orientation == CMP_ORIENT_90 )
        orientationRadioBox->SetSelection( 1 );
@@ -675,14 +675,14 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
    else
        orientationRadioBox->SetSelection( 0 );

    int mirror = m_Cmp->GetRotationMiroir() & ( CMP_MIROIR_X | CMP_MIROIR_Y );
    int mirror = m_Cmp->GetOrientation() & ( CMP_MIRROR_X | CMP_MIRROR_Y );

    if( mirror == CMP_MIROIR_X )
    if( mirror == CMP_MIRROR_X )
    {
        mirrorRadioBox->SetSelection( 1 );
        D( printf( "mirror=X,1\n" ); )
    }
    else if( mirror == CMP_MIROIR_Y )
    else if( mirror == CMP_MIRROR_Y )
    {
        mirrorRadioBox->SetSelection( 2 );
        D( printf( "mirror=Y,2\n" ); )
@@ -742,7 +742,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
    m_Cmp->GetField( VALUE )->m_Pos = valField.m_Pos + m_Cmp->m_Pos;
    m_Cmp->GetField( VALUE )->ImportValues( valField );

    m_Cmp->SetRotationMiroir( CMP_NORMAL );
    m_Cmp->SetOrientation( CMP_NORMAL );

    m_Parent->GetScreen()->SetModify();

+1 −1
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
        }
    }

    DrawComponent->SetRotationMiroir( type_rotate );
    DrawComponent->SetOrientation( type_rotate );

    /* Redraw the component in the new position. */
    if( DC )
Loading