Commit 2be24e1f authored by charras's avatar charras
Browse files

Added comments about complex hierarchy handling. some code cleaning.

parent b6035803
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -55,8 +55,8 @@ void WinEDA_SchematicFrame::UpdateSheetNumberAndDate()
 ****************************************************************************/
 ****************************************************************************/
void ReAnnotatePowerSymbolsOnly( void )
void ReAnnotatePowerSymbolsOnly( void )
{
{
    /* Build the sheet list (sheet, not screen) */
    /* Build the whole sheet list in hierarchy (sheet, not screen) */
    EDA_SheetList  SheetList( NULL );
    EDA_SheetList  SheetList;


    DrawSheetPath* sheet;
    DrawSheetPath* sheet;
    int            CmpNumber = 1;
    int            CmpNumber = 1;
@@ -250,7 +250,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
        parent->DeleteAnnotation( !annotateSchematic, false );
        parent->DeleteAnnotation( !annotateSchematic, false );


    /* Build the sheet list */
    /* Build the sheet list */
    EDA_SheetList SheetList( g_RootSheet );
    EDA_SheetList SheetList;


    /* Update the sheet number, sheet count and date */
    /* Update the sheet number, sheet count and date */
    parent->UpdateSheetNumberAndDate();
    parent->UpdateSheetNumberAndDate();
@@ -615,7 +615,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
    wxString      msg, cmpref;
    wxString      msg, cmpref;


    /* build the screen list */
    /* build the screen list */
    EDA_SheetList SheetList( NULL );
    EDA_SheetList SheetList;


    std::vector <OBJ_CMP_TO_LIST> ComponentsList;
    std::vector <OBJ_CMP_TO_LIST> ComponentsList;


+1 −1
Original line number Original line Diff line number Diff line
@@ -34,7 +34,7 @@ bool WinEDA_SchematicFrame::FillFootprintFieldForAllInstancesofComponent(
{
{
    DrawSheetPath* sheet;
    DrawSheetPath* sheet;
    SCH_ITEM*      DrawList = NULL;
    SCH_ITEM*      DrawList = NULL;
    EDA_SheetList  SheetList( NULL );
    EDA_SheetList  SheetList;
    SCH_COMPONENT* Cmp;
    SCH_COMPONENT* Cmp;
    bool           found = false;
    bool           found = false;


+3 −3
Original line number Original line Diff line number Diff line
@@ -264,7 +264,7 @@ void BuildComponentsListFromSchematic( std::vector <OBJ_CMP_TO_LIST>& aList )
    DrawSheetPath*  sheet;
    DrawSheetPath*  sheet;


    /* Build the sheet (not screen) list */
    /* Build the sheet (not screen) list */
    EDA_SheetList   SheetList( NULL );
    EDA_SheetList   SheetList;


    for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
    for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
    {
    {
@@ -303,8 +303,8 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
    Hierarchical_PIN_Sheet_Struct* PinLabel;
    Hierarchical_PIN_Sheet_Struct* PinLabel;
    DrawSheetPath* sheet;
    DrawSheetPath* sheet;


    /* Build the screen list */
    /* Build the sheet list */
    EDA_SheetList  SheetList( NULL );
    EDA_SheetList  SheetList;


    LABEL_OBJECT   labet_object;
    LABEL_OBJECT   labet_object;


+15 −5
Original line number Original line Diff line number Diff line
@@ -218,12 +218,13 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
}
}




/****************************************************************/
/********************************************************************/
void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
/****************************************************************/
/********************************************************************/
{
{
    /* Placement en liste des structures si nouveau composant:*/
    /* Placement en liste des structures si nouveau composant:*/
    if( m_Flags & IS_NEW )
    bool isnew = (m_Flags & IS_NEW) ? true : false;
    if( isnew )
    {
    {
        if( !frame->EditSheet( this, DC ) )
        if( !frame->EditSheet( this, DC ) )
        {
        {
@@ -237,6 +238,10 @@ void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
    }
    }


    SCH_ITEM::Place( frame, DC ); //puts it on the EEDrawList.
    SCH_ITEM::Place( frame, DC ); //puts it on the EEDrawList.
    if ( isnew )
    {
        frame->SetSheetNumberAndCount();
    }
}
}




@@ -540,6 +545,11 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
/**********************************/
/**********************************/
int DrawSheetStruct::CountSheets()
int DrawSheetStruct::CountSheets()
/**********************************/
/**********************************/
/** Function CountSheets
 * calculates the number of sheets found in "this"
 * this number includes the full subsheets count
 * @return the full count of sheets+subsheets contained by "this"
 */
{
{
    int count = 1; //1 = this!!
    int count = 1; //1 = this!!


@@ -550,8 +560,8 @@ int DrawSheetStruct::CountSheets()
        {
        {
            if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
            if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
            {
            {
                DrawSheetStruct* ss = (DrawSheetStruct*) strct;
                DrawSheetStruct* subsheet = (DrawSheetStruct*) strct;
                count += ss->CountSheets();
                count += subsheet->CountSheets();
            }
            }
        }
        }
    }
    }
+12 −1
Original line number Original line Diff line number Diff line
@@ -137,7 +137,7 @@ public:


    /** Function ComponentCount
    /** Function ComponentCount
     *  count our own components, without the power components.
     *  count our own components, without the power components.
     *  @return the copponent count.
     *  @return the component count.
     */
     */
    int              ComponentCount();
    int              ComponentCount();


@@ -169,7 +169,18 @@ public:
     *  @return true if found
     *  @return true if found
     */
     */
    bool             LocatePathOfScreen( SCH_SCREEN* aScreen, DrawSheetPath* aList );
    bool             LocatePathOfScreen( SCH_SCREEN* aScreen, DrawSheetPath* aList );

    /** Function CountSheets
     * calculates the number of sheets found in "this"
     * this number includes the full subsheets count
     * @return the full count of sheets+subsheets contained by "this"
     */
    int              CountSheets();
    int              CountSheets();

    /** Function GetFileName
     * return the filename corresponding to this sheet
     * @return a wxString containing the filename
     */
    wxString         GetFileName( void );
    wxString         GetFileName( void );


    // Set a new filename without changing anything else
    // Set a new filename without changing anything else
Loading