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

minor bug 564619 fixed and minor enhancements (mainly for Cvpcb)

parents d64410b1 d4c811fc
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -239,9 +239,11 @@ void SCH_SHEET::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
 * @param aFrame = the schematic frame
 * @param aFrame = the schematic frame
 */
 */
void SCH_SHEET::CleanupSheet( WinEDA_SchematicFrame* aFrame,
void SCH_SHEET::CleanupSheet( WinEDA_SchematicFrame* aFrame,
                              bool                   aRedraw )
                              bool                   aRedraw,
                              bool                   aSaveForUndoRedo)
{
{
    SCH_SHEET_PIN* Pinsheet, * NextPinsheet;
    SCH_SHEET_PIN* Pinsheet, * NextPinsheet;
    bool isSaved = false;


    if( !IsOK( aFrame, _( "Ok to cleanup this sheet" ) ) )
    if( !IsOK( aFrame, _( "Ok to cleanup this sheet" ) ) )
        return;
        return;
@@ -268,6 +270,11 @@ void SCH_SHEET::CleanupSheet( WinEDA_SchematicFrame* aFrame,
        NextPinsheet = Pinsheet->Next();
        NextPinsheet = Pinsheet->Next();
        if( HLabel == NULL )   // Hlabel not found: delete pinsheet
        if( HLabel == NULL )   // Hlabel not found: delete pinsheet
        {
        {
            if( aSaveForUndoRedo && !isSaved )
            {
                isSaved = true;
                aFrame->SaveCopyInUndoList( this, UR_CHANGED);
            }
            aFrame->OnModify( );
            aFrame->OnModify( );
            aFrame->DeleteSheetLabel( false, Pinsheet );
            aFrame->DeleteSheetLabel( false, Pinsheet );
        }
        }
+4 −2
Original line number Original line Diff line number Diff line
@@ -178,10 +178,12 @@ public:


    /** Function CleanupSheet
    /** Function CleanupSheet
     * Delete pinsheets which are not corresponding to a hierarchical label
     * Delete pinsheets which are not corresponding to a hierarchical label
     * @param aRedraw = true to redraw Sheet
     * @param aFrame = the schematic frame
     * @param aFrame = the schematic frame
     * @param aRedraw = true to redraw Sheet
     * @param aSaveForUndoRedo = true to put this sheet in UndoRedo list,
     *          if it is modified.
     */
     */
    void         CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw );
    void         CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw, bool aSaveForUndoRedo );


    /** Function GetPenSize
    /** Function GetPenSize
     * @return the size of the "pen" that be used to draw or plot this item
     * @return the size of the "pen" that be used to draw or plot this item
+1 −1
Original line number Original line Diff line number Diff line
@@ -383,7 +383,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
    case ID_POPUP_SCH_CLEANUP_SHEET:
    case ID_POPUP_SCH_CLEANUP_SHEET:
        if ( screen->GetCurItem()
        if ( screen->GetCurItem()
             && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
             && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
            ( (SCH_SHEET*) screen->GetCurItem() )->CleanupSheet( this, true );
            ( (SCH_SHEET*) screen->GetCurItem() )->CleanupSheet( this, true, true );
        break;
        break;


    case ID_POPUP_SCH_EDIT_PINSHEET:
    case ID_POPUP_SCH_EDIT_PINSHEET:
+7 −22
Original line number Original line Diff line number Diff line
@@ -791,34 +791,19 @@ bool BOARD::ComputeBoundaryBox()
        }
        }
    }
    }


    /* Analise footprints  */
    /* Analyze footprints  */


    for( MODULE* module = m_Modules; module; module = module->Next() )
    for( MODULE* module = m_Modules; module; module = module->Next() )
    {
    {
        hasItems = TRUE;
        hasItems = TRUE;
        xmin     = MIN( xmin, ( module->m_Pos.x
        EDA_Rect box = module->GetBoundingBox();
                                + module->m_BoundaryBox.GetX() ) );
        xmin     = MIN( xmin, box.GetX() );
        ymin     = MIN( ymin, ( module->m_Pos.y
        ymin     = MIN( ymin, box.GetY() );
                                + module->m_BoundaryBox.GetY() ) );
        xmax     = MAX( xmax, box.GetRight() );
        xmax     = MAX( xmax, module->m_Pos.x
        ymax     = MAX( ymax, box.GetBottom() );
                        + module->m_BoundaryBox.GetRight() );
        ymax     = MAX( ymax,
                        module->m_Pos.y + module->m_BoundaryBox.GetBottom() );


        for( D_PAD* pt_pad = module->m_Pads; pt_pad; pt_pad = pt_pad->Next() )
        {
            const wxPoint& pos = pt_pad->GetPosition();

            d    = pt_pad->m_Rayon;
            xmin = MIN( xmin, pos.x - d );
            ymin = MIN( ymin, pos.y - d );
            xmax = MAX( xmax, pos.x + d );
            ymax = MAX( ymax, pos.y + d );
        }
    }
    }


    /* Analise track and zones */
    /* Analize track and zones */
    for( TRACK* track = m_Track; track; track = track->Next() )
    for( TRACK* track = m_Track; track; track = track->Next() )
    {
    {
        d = ( track->m_Width / 2 ) + 1;
        d = ( track->m_Width / 2 ) + 1;
+8 −10
Original line number Original line Diff line number Diff line
@@ -623,11 +623,10 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )


/* Update the bounding rectangle of the module
/* Update the bounding rectangle of the module
 *
 *
 * The rectangle is the rectangle with the contours and
 * The bounding box includes outlines and pads, but not the fields.
 * Pads.
 * The rectangle is:
 * The rectangle is calculated:
 *      for orientation 0
 * For East 0
 *      coordinates relative to the module anchor.
 * Coord in on / anchor position
 */
 */
void MODULE::Set_Rectangle_Encadrement()
void MODULE::Set_Rectangle_Encadrement()
{
{
@@ -702,10 +701,9 @@ void MODULE::Set_Rectangle_Encadrement()
}
}




/* Equivalent to Module:: Set_Rectangle_Encadrement() coord but real:
/* Equivalent to Module::Set_Rectangle_Encadrement() but in board coordinates:
 * Updating the rectangle real module PCB cad in ord
 * Updates the module bounding box on the board
 * Entree: pointer module
 * The rectangle is the rectangle with outlines and pads, but not the fields
 * The rectangle is the rectangle with the contours and pads.
 * Also updates the surface (.M_Surface) module.
 * Also updates the surface (.M_Surface) module.
 */
 */
void MODULE::SetRectangleExinscrit()
void MODULE::SetRectangleExinscrit()
@@ -785,7 +783,7 @@ void MODULE::SetRectangleExinscrit()


/**
/**
 * Function GetBoundingBox
 * Function GetBoundingBox
 * returns the full bounding box of this Footprint, including texts
 * returns the full bounding box of this Footprint, including fields
 * Mainly used to redraw the screen area occupied by the footprint
 * Mainly used to redraw the screen area occupied by the footprint
 */
 */
EDA_Rect MODULE::GetBoundingBox()
EDA_Rect MODULE::GetBoundingBox()
Loading