Loading change_log.txt +6 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,12 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2008-Feb-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +eeschema Fixed: problem which could crash eeschema when a sub schematic file in a hierarchy was not found. 2008-Feb-27 UPDATE Wayne Stambaugh <stambaughw{at}verizon{dot}net> 2008-Feb-27 UPDATE Wayne Stambaugh <stambaughw{at}verizon{dot}net> ================================================================================ ================================================================================ + eeschema + eeschema Loading eeschema/annotate.cpp +160 −117 Original line number Original line Diff line number Diff line Loading @@ -13,7 +13,7 @@ /* Local Functions*/ /* Local Functions*/ static int ListeComposants( CmpListStruct* BaseListeCmp, static int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet ); DrawSheetPath* sheet ); static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ); Loading @@ -24,6 +24,48 @@ static int ExistUnit( CmpListStruct* Objet, int Unit, CmpListStruct* BaseListeCmp, int NbOfCmp ); CmpListStruct* BaseListeCmp, int NbOfCmp ); /************************************************/ void WinEDA_SchematicFrame::UpdateSheetNumberAndDate() /************************************************/ /* Set a sheet number, the sheet count for sheets in the whole schematic * and update the date in all screens */ { wxString date = GenDate(); int sheet_number = 1; // sheet 1 is the root sheet DrawSheetPath* sheetpath; /* Build the sheet list */ EDA_SheetList SheetList( g_RootSheet ); int sheet_count = SheetList.GetCount(); for( sheetpath = SheetList.GetFirst(); sheetpath != NULL; sheetpath = SheetList.GetNext() ) { // Read all sheets in path, but not the root sheet (jj = 1) for( int jj = 1; jj < sheetpath->m_numSheets; jj++ ) { DrawSheetStruct* sheet = sheetpath->m_sheets[jj]; sheet->m_SheetNumber = sheet_number++; sheet->m_NumberOfSheets = sheet_count; SCH_SCREEN* screen = sheet->m_AssociatedScreen; if( screen != NULL ) { screen->m_NumberOfScreen = sheet_count; screen->m_Date = date; } } } g_RootSheet->m_AssociatedScreen->m_Date = date; g_RootSheet->m_AssociatedScreen->m_NumberOfScreen = sheet_count; g_RootSheet->m_SheetNumber = 1; g_RootSheet->m_NumberOfSheets = sheet_count; } /***************************************************************************** /***************************************************************************** * Used to annotate the power symbols, before testing erc or computing * Used to annotate the power symbols, before testing erc or computing * netlist when a component reannotation is not necessary * netlist when a component reannotation is not necessary Loading @@ -38,7 +80,7 @@ void ReAnnotatePowerSymbolsOnly( void ) EDA_SheetList SheetList( NULL ); EDA_SheetList SheetList( NULL ); DrawSheetList* sheet; DrawSheetPath* sheet; int CmpNumber = 1; int CmpNumber = 1; for( sheet = SheetList.GetFirst(); for( sheet = SheetList.GetFirst(); Loading Loading @@ -179,21 +221,21 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, bool resetAnnotation ) bool resetAnnotation ) { { int ii, NbOfCmp; int ii, NbOfCmp; DrawSheetList* sheet; DrawSheetPath* sheet; CmpListStruct* BaseListeCmp; CmpListStruct* BaseListeCmp; wxBusyCursor dummy; wxBusyCursor dummy; /* If it is an annotation for all the components, reset previous /* If it is an annotation for all the components, reset previous annotation: */ * annotation: */ if( resetAnnotation ) if( resetAnnotation ) DeleteAnnotation( parent, annotateSchematic ); DeleteAnnotation( parent, annotateSchematic ); /* Build the sheet list */ /* Build the sheet list */ EDA_SheetList SheetList( g_RootSheet ); EDA_SheetList SheetList( g_RootSheet ); /* Update the screen number, sheet count and date */ /* Update the sheet number, sheet count and date */ SheetList.UpdateSheetNumberAndDate(); parent->UpdateSheetNumberAndDate(); /* First pass: Component counting */ /* First pass: Component counting */ ii = 0; ii = 0; Loading Loading @@ -230,7 +272,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, DisplayError( parent, wxT( "Internal error in AnnotateComponents()" ) ); DisplayError( parent, wxT( "Internal error in AnnotateComponents()" ) ); /* Break full components reference in name (prefix) and number: /* Break full components reference in name (prefix) and number: example: IC1 become IC, and 1 */ * example: IC1 become IC, and 1 */ BreakReference( BaseListeCmp, NbOfCmp ); BreakReference( BaseListeCmp, NbOfCmp ); if( sortByPosition ) if( sortByPosition ) Loading @@ -257,7 +299,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, * if BaseListeCmp == NULL : count components * if BaseListeCmp == NULL : count components * else update data table BaseListeCmp * else update data table BaseListeCmp *****************************************************************************/ *****************************************************************************/ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet ) int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet ) { { int NbrCmp = 0; int NbrCmp = 0; EDA_BaseStruct* DrawList = sheet->LastDrawList(); EDA_BaseStruct* DrawList = sheet->LastDrawList(); Loading Loading @@ -448,7 +490,7 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) } } /* Annotation of multi-part components ( n parts per package ) /* Annotation of multi-part components ( n parts per package ) (complex case) */ * (complex case) */ ValText = BaseListeCmp[ii].m_TextValue; ValText = BaseListeCmp[ii].m_TextValue; NumberOfUnits = BaseListeCmp[ii].m_NbParts; NumberOfUnits = BaseListeCmp[ii].m_NbParts; Loading Loading @@ -486,10 +528,11 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) { { continue; continue; } } /* Component without reference number found, annotate it if /* Component without reference number found, annotate it if possible */ * possible */ if( !BaseListeCmp[jj].m_PartsLocked || if( !BaseListeCmp[jj].m_PartsLocked (BaseListeCmp[jj].m_Unit == Unit) ) || (BaseListeCmp[jj].m_Unit == Unit) ) { { BaseListeCmp[jj].m_NumRef = BaseListeCmp[ii].m_NumRef; BaseListeCmp[jj].m_NumRef = BaseListeCmp[ii].m_NumRef; BaseListeCmp[jj].m_Unit = Unit; BaseListeCmp[jj].m_Unit = Unit; Loading Loading @@ -588,7 +631,7 @@ static int ExistUnit( CmpListStruct* Objet, int Unit, int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly ) int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly ) { { int ii, error, NbOfCmp; int ii, error, NbOfCmp; DrawSheetList* sheet; DrawSheetPath* sheet; CmpListStruct* ListeCmp = NULL; CmpListStruct* ListeCmp = NULL; wxString Buff; wxString Buff; wxString msg, cmpref; wxString msg, cmpref; Loading Loading @@ -638,7 +681,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly ) qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotateByValue ); qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotateByValue ); /* Break full components reference in name (prefix) and number: example: /* Break full components reference in name (prefix) and number: example: IC1 become IC, and 1 */ * IC1 become IC, and 1 */ BreakReference( ListeCmp, NbOfCmp ); BreakReference( ListeCmp, NbOfCmp ); /* count not yet annotated items */ /* count not yet annotated items */ Loading Loading @@ -700,8 +743,8 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly ) Buff.Empty(); Buff.Empty(); if( (stricmp( ListeCmp[ii].m_TextRef, if( (stricmp( ListeCmp[ii].m_TextRef, ListeCmp[ii + 1].m_TextRef ) != 0)|| ListeCmp[ii + 1].m_TextRef ) != 0) ( ListeCmp[ii].m_NumRef != ListeCmp[ii + 1].m_NumRef ) ) || ( ListeCmp[ii].m_NumRef != ListeCmp[ii + 1].m_NumRef ) ) continue; continue; /* Same reference found */ /* Same reference found */ Loading eeschema/annotate_dialog.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -208,7 +208,7 @@ void WinEDA_AnnotateFrame::CreateControls() /* TODO: Check if there is any existing annotation and enable/disable /* TODO: Check if there is any existing annotation and enable/disable * the clear button accordingly. Probably should also enable/ * the clear button accordingly. Probably should also enable/ * disable new components radio button if all of the components * disable new components radio button if all of the components * are already annotated. Some low level work on the DrawSheetList * are already annotated. Some low level work on the DrawSheetPath * class will need to be done to accomadate this. * class will need to be done to accomadate this. */ */ m_btnClear = new wxButton( this, wxID_CLEAR ); m_btnClear = new wxButton( this, wxID_CLEAR ); Loading eeschema/block.cpp +54 −48 Original line number Original line Diff line number Diff line Loading @@ -689,6 +689,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center ) case DRAW_HIER_LABEL_STRUCT_TYPE: case DRAW_HIER_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE: // Text is not really mirrored: Orientation is changed // Text is not really mirrored: Orientation is changed DrawText = (DrawLabelStruct*) DrawStruct; DrawText = (DrawLabelStruct*) DrawStruct; if( DrawText->m_Orient == 0 ) /* horizontal text */ if( DrawText->m_Orient == 0 ) /* horizontal text */ Loading Loading @@ -837,6 +838,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE //m_AssociatedScreen and m_sRefCount properly. //m_AssociatedScreen and m_sRefCount properly. DrawSheetStruct* sheet = (DrawSheetStruct*) Struct; DrawSheetStruct* sheet = (DrawSheetStruct*) Struct; sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetTimeStamp(); //sheet->m_AssociatedScreen->m_UndoList = NULL; //sheet->m_AssociatedScreen->m_UndoList = NULL; //sheet->m_AssociatedScreen->m_RedoList = NULL; //sheet->m_AssociatedScreen->m_RedoList = NULL; //keep m_AssociatedScreen pointer & associated. //keep m_AssociatedScreen pointer & associated. Loading Loading @@ -962,11 +964,15 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct RedrawOneStruct( panel, DC, DrawStruct, g_XorMode ); RedrawOneStruct( panel, DC, DrawStruct, g_XorMode ); /* Unlink the structure */ /* Unlink the structure */ DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link if(DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE){ if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) SAFE_DELETE(DrawStruct); { frame->SaveCopyInUndoList( DrawStruct, IS_DELETED ); // Currently In TEST // SAFE_DELETE(DrawStruct); //no undo/redo for this (for now), it is on both the EEDrawList and m_SubSheet arrays, //no undo/redo for this (for now), it is on both the EEDrawList and m_SubSheet arrays, //hence the undo logic would have to be extended for this. //hence the undo logic would have to be extended for this. }else } else frame->SaveCopyInUndoList( DrawStruct, IS_DELETED ); frame->SaveCopyInUndoList( DrawStruct, IS_DELETED ); } } } } Loading eeschema/class_drawsheet.cpp +51 −30 Original line number Original line Diff line number Diff line Loading @@ -43,10 +43,11 @@ DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) : m_NbLabel = 0; m_NbLabel = 0; m_Layer = LAYER_SHEET; m_Layer = LAYER_SHEET; m_Pos = pos; m_Pos = pos; m_TimeStamp = GetTimeStamp(); m_SheetNameSize = m_FileNameSize = 60; m_SheetNameSize = m_FileNameSize = 60; m_AssociatedScreen = NULL; m_AssociatedScreen = NULL; m_SheetName = wxT( "Root" ); m_SheetName.Printf( wxT("Sheet%8.8lX"), m_TimeStamp); m_FileName = wxT( " " ); m_FileName.Printf( wxT("file%8.8lX.sch"), m_TimeStamp); m_SheetNumber = 1; m_SheetNumber = 1; m_NumberOfSheets = 1; m_NumberOfSheets = 1; Loading Loading @@ -351,7 +352,7 @@ bool DrawSheetStruct::SearchHierarchy( wxString filename, SCH_SCREEN** screen ) /*******************************************************************************/ /*******************************************************************************/ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetList* list ) bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetPath* list ) /*******************************************************************************/ /*******************************************************************************/ { { //search the existing hierarchy for an instance of screen "FileName". //search the existing hierarchy for an instance of screen "FileName". Loading Loading @@ -386,6 +387,8 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetList* lis bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame ) bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame ) /*******************************************************************************/ /*******************************************************************************/ { { bool success = true; if( !m_AssociatedScreen ) if( !m_AssociatedScreen ) { { SCH_SCREEN* screen = NULL; SCH_SCREEN* screen = NULL; Loading @@ -401,22 +404,24 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame ) { { m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME ); m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME ); m_AssociatedScreen->m_RefCount++; m_AssociatedScreen->m_RefCount++; if( !frame->LoadOneEEFile( m_AssociatedScreen, m_FileName ) ) success = frame->LoadOneEEFile( m_AssociatedScreen, m_FileName); return false; if ( success ) { EDA_BaseStruct* bs = m_AssociatedScreen->EEDrawList; EDA_BaseStruct* bs = m_AssociatedScreen->EEDrawList; while( bs ) while( bs ) { { if( bs->Type() == DRAW_SHEET_STRUCT_TYPE ) if( bs->Type() == DRAW_SHEET_STRUCT_TYPE ) { { DrawSheetStruct* ss = (DrawSheetStruct*) bs; DrawSheetStruct* sheetstruct = (DrawSheetStruct*) bs; if( !ss->Load( frame ) ) if( !sheetstruct->Load( frame ) ) return false; success = false; } } bs = bs->Pnext; bs = bs->Pnext; } } } } } } return true; } return success; } } Loading @@ -442,6 +447,21 @@ int DrawSheetStruct::CountSheets() } } /******************************************/ wxString DrawSheetStruct::GetFileName(void) /******************************************/ { return m_FileName; } /************************************************************/ void DrawSheetStruct::SetFileName(const wxString & aFilename) /************************************************************/ { m_FileName = aFilename; } /************************/ /************************/ /* DrawSheetLabelStruct */ /* DrawSheetLabelStruct */ /************************/ /************************/ Loading Loading @@ -571,7 +591,7 @@ void DrawSheetLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoin /* class to handle a series of sheets *********/ /* class to handle a series of sheets *********/ /* a 'path' so to speak.. *********************/ /* a 'path' so to speak.. *********************/ /**********************************************/ /**********************************************/ DrawSheetList::DrawSheetList() DrawSheetPath::DrawSheetPath() { { for( int i = 0; i<DSLSZ; i++ ) for( int i = 0; i<DSLSZ; i++ ) m_sheets[i] = NULL; m_sheets[i] = NULL; Loading @@ -580,7 +600,7 @@ DrawSheetList::DrawSheetList() } } int DrawSheetList::Cmp( DrawSheetList& d ) int DrawSheetPath::Cmp( DrawSheetPath& d ) { { if( m_numSheets > d.m_numSheets ) if( m_numSheets > d.m_numSheets ) return 1; return 1; Loading @@ -600,7 +620,7 @@ int DrawSheetList::Cmp( DrawSheetList& d ) } } DrawSheetStruct* DrawSheetList::Last() DrawSheetStruct* DrawSheetPath::Last() { { if( m_numSheets ) if( m_numSheets ) return m_sheets[m_numSheets - 1]; return m_sheets[m_numSheets - 1]; Loading @@ -608,7 +628,7 @@ DrawSheetStruct* DrawSheetList::Last() } } SCH_SCREEN* DrawSheetList::LastScreen() SCH_SCREEN* DrawSheetPath::LastScreen() { { if( m_numSheets ) if( m_numSheets ) return m_sheets[m_numSheets - 1]->m_AssociatedScreen; return m_sheets[m_numSheets - 1]->m_AssociatedScreen; Loading @@ -616,7 +636,7 @@ SCH_SCREEN* DrawSheetList::LastScreen() } } EDA_BaseStruct* DrawSheetList::LastDrawList() EDA_BaseStruct* DrawSheetPath::LastDrawList() { { if( m_numSheets && m_sheets[m_numSheets - 1]->m_AssociatedScreen ) if( m_numSheets && m_sheets[m_numSheets - 1]->m_AssociatedScreen ) return m_sheets[m_numSheets - 1]->m_AssociatedScreen->EEDrawList; return m_sheets[m_numSheets - 1]->m_AssociatedScreen->EEDrawList; Loading @@ -624,8 +644,9 @@ EDA_BaseStruct* DrawSheetList::LastDrawList() } } void DrawSheetList::Push( DrawSheetStruct* sheet ) void DrawSheetPath::Push( DrawSheetStruct* sheet ) { { wxASSERT( m_numSheets <= DSLSZ ); if( m_numSheets < DSLSZ ) if( m_numSheets < DSLSZ ) { { m_sheets[m_numSheets] = sheet; m_sheets[m_numSheets] = sheet; Loading @@ -634,7 +655,7 @@ void DrawSheetList::Push( DrawSheetStruct* sheet ) } } DrawSheetStruct* DrawSheetList::Pop() DrawSheetStruct* DrawSheetPath::Pop() { { if( m_numSheets > 0 ) if( m_numSheets > 0 ) { { Loading @@ -645,7 +666,7 @@ DrawSheetStruct* DrawSheetList::Pop() } } wxString DrawSheetList::Path() wxString DrawSheetPath::Path() { { wxString s, t; wxString s, t; Loading @@ -664,7 +685,7 @@ wxString DrawSheetList::Path() } } wxString DrawSheetList::PathHumanReadable() wxString DrawSheetPath::PathHumanReadable() { { wxString s, t; wxString s, t; Loading @@ -680,7 +701,7 @@ wxString DrawSheetList::PathHumanReadable() } } void DrawSheetList::UpdateAllScreenReferences() void DrawSheetPath::UpdateAllScreenReferences() { { EDA_BaseStruct* t = LastDrawList(); EDA_BaseStruct* t = LastDrawList(); Loading @@ -698,7 +719,7 @@ void DrawSheetList::UpdateAllScreenReferences() } } bool DrawSheetList::operator=( const DrawSheetList& d1 ) bool DrawSheetPath::operator=( const DrawSheetPath& d1 ) { { m_numSheets = d1.m_numSheets; m_numSheets = d1.m_numSheets; int i; int i; Loading @@ -716,7 +737,7 @@ bool DrawSheetList::operator=( const DrawSheetList& d1 ) } } bool DrawSheetList::operator==( const DrawSheetList& d1 ) bool DrawSheetPath::operator==( const DrawSheetPath& d1 ) { { if( m_numSheets != d1.m_numSheets ) if( m_numSheets != d1.m_numSheets ) return false; return false; Loading @@ -730,7 +751,7 @@ bool DrawSheetList::operator==( const DrawSheetList& d1 ) } } bool DrawSheetList::operator!=( const DrawSheetList& d1 ) bool DrawSheetPath::operator!=( const DrawSheetPath& d1 ) { { if( m_numSheets != d1.m_numSheets ) if( m_numSheets != d1.m_numSheets ) return true; return true; Loading Loading
change_log.txt +6 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,12 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2008-Feb-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ +eeschema Fixed: problem which could crash eeschema when a sub schematic file in a hierarchy was not found. 2008-Feb-27 UPDATE Wayne Stambaugh <stambaughw{at}verizon{dot}net> 2008-Feb-27 UPDATE Wayne Stambaugh <stambaughw{at}verizon{dot}net> ================================================================================ ================================================================================ + eeschema + eeschema Loading
eeschema/annotate.cpp +160 −117 Original line number Original line Diff line number Diff line Loading @@ -13,7 +13,7 @@ /* Local Functions*/ /* Local Functions*/ static int ListeComposants( CmpListStruct* BaseListeCmp, static int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet ); DrawSheetPath* sheet ); static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ); Loading @@ -24,6 +24,48 @@ static int ExistUnit( CmpListStruct* Objet, int Unit, CmpListStruct* BaseListeCmp, int NbOfCmp ); CmpListStruct* BaseListeCmp, int NbOfCmp ); /************************************************/ void WinEDA_SchematicFrame::UpdateSheetNumberAndDate() /************************************************/ /* Set a sheet number, the sheet count for sheets in the whole schematic * and update the date in all screens */ { wxString date = GenDate(); int sheet_number = 1; // sheet 1 is the root sheet DrawSheetPath* sheetpath; /* Build the sheet list */ EDA_SheetList SheetList( g_RootSheet ); int sheet_count = SheetList.GetCount(); for( sheetpath = SheetList.GetFirst(); sheetpath != NULL; sheetpath = SheetList.GetNext() ) { // Read all sheets in path, but not the root sheet (jj = 1) for( int jj = 1; jj < sheetpath->m_numSheets; jj++ ) { DrawSheetStruct* sheet = sheetpath->m_sheets[jj]; sheet->m_SheetNumber = sheet_number++; sheet->m_NumberOfSheets = sheet_count; SCH_SCREEN* screen = sheet->m_AssociatedScreen; if( screen != NULL ) { screen->m_NumberOfScreen = sheet_count; screen->m_Date = date; } } } g_RootSheet->m_AssociatedScreen->m_Date = date; g_RootSheet->m_AssociatedScreen->m_NumberOfScreen = sheet_count; g_RootSheet->m_SheetNumber = 1; g_RootSheet->m_NumberOfSheets = sheet_count; } /***************************************************************************** /***************************************************************************** * Used to annotate the power symbols, before testing erc or computing * Used to annotate the power symbols, before testing erc or computing * netlist when a component reannotation is not necessary * netlist when a component reannotation is not necessary Loading @@ -38,7 +80,7 @@ void ReAnnotatePowerSymbolsOnly( void ) EDA_SheetList SheetList( NULL ); EDA_SheetList SheetList( NULL ); DrawSheetList* sheet; DrawSheetPath* sheet; int CmpNumber = 1; int CmpNumber = 1; for( sheet = SheetList.GetFirst(); for( sheet = SheetList.GetFirst(); Loading Loading @@ -179,21 +221,21 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, bool resetAnnotation ) bool resetAnnotation ) { { int ii, NbOfCmp; int ii, NbOfCmp; DrawSheetList* sheet; DrawSheetPath* sheet; CmpListStruct* BaseListeCmp; CmpListStruct* BaseListeCmp; wxBusyCursor dummy; wxBusyCursor dummy; /* If it is an annotation for all the components, reset previous /* If it is an annotation for all the components, reset previous annotation: */ * annotation: */ if( resetAnnotation ) if( resetAnnotation ) DeleteAnnotation( parent, annotateSchematic ); DeleteAnnotation( parent, annotateSchematic ); /* Build the sheet list */ /* Build the sheet list */ EDA_SheetList SheetList( g_RootSheet ); EDA_SheetList SheetList( g_RootSheet ); /* Update the screen number, sheet count and date */ /* Update the sheet number, sheet count and date */ SheetList.UpdateSheetNumberAndDate(); parent->UpdateSheetNumberAndDate(); /* First pass: Component counting */ /* First pass: Component counting */ ii = 0; ii = 0; Loading Loading @@ -230,7 +272,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, DisplayError( parent, wxT( "Internal error in AnnotateComponents()" ) ); DisplayError( parent, wxT( "Internal error in AnnotateComponents()" ) ); /* Break full components reference in name (prefix) and number: /* Break full components reference in name (prefix) and number: example: IC1 become IC, and 1 */ * example: IC1 become IC, and 1 */ BreakReference( BaseListeCmp, NbOfCmp ); BreakReference( BaseListeCmp, NbOfCmp ); if( sortByPosition ) if( sortByPosition ) Loading @@ -257,7 +299,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, * if BaseListeCmp == NULL : count components * if BaseListeCmp == NULL : count components * else update data table BaseListeCmp * else update data table BaseListeCmp *****************************************************************************/ *****************************************************************************/ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetList* sheet ) int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet ) { { int NbrCmp = 0; int NbrCmp = 0; EDA_BaseStruct* DrawList = sheet->LastDrawList(); EDA_BaseStruct* DrawList = sheet->LastDrawList(); Loading Loading @@ -448,7 +490,7 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) } } /* Annotation of multi-part components ( n parts per package ) /* Annotation of multi-part components ( n parts per package ) (complex case) */ * (complex case) */ ValText = BaseListeCmp[ii].m_TextValue; ValText = BaseListeCmp[ii].m_TextValue; NumberOfUnits = BaseListeCmp[ii].m_NbParts; NumberOfUnits = BaseListeCmp[ii].m_NbParts; Loading Loading @@ -486,10 +528,11 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) { { continue; continue; } } /* Component without reference number found, annotate it if /* Component without reference number found, annotate it if possible */ * possible */ if( !BaseListeCmp[jj].m_PartsLocked || if( !BaseListeCmp[jj].m_PartsLocked (BaseListeCmp[jj].m_Unit == Unit) ) || (BaseListeCmp[jj].m_Unit == Unit) ) { { BaseListeCmp[jj].m_NumRef = BaseListeCmp[ii].m_NumRef; BaseListeCmp[jj].m_NumRef = BaseListeCmp[ii].m_NumRef; BaseListeCmp[jj].m_Unit = Unit; BaseListeCmp[jj].m_Unit = Unit; Loading Loading @@ -588,7 +631,7 @@ static int ExistUnit( CmpListStruct* Objet, int Unit, int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly ) int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly ) { { int ii, error, NbOfCmp; int ii, error, NbOfCmp; DrawSheetList* sheet; DrawSheetPath* sheet; CmpListStruct* ListeCmp = NULL; CmpListStruct* ListeCmp = NULL; wxString Buff; wxString Buff; wxString msg, cmpref; wxString msg, cmpref; Loading Loading @@ -638,7 +681,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly ) qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotateByValue ); qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotateByValue ); /* Break full components reference in name (prefix) and number: example: /* Break full components reference in name (prefix) and number: example: IC1 become IC, and 1 */ * IC1 become IC, and 1 */ BreakReference( ListeCmp, NbOfCmp ); BreakReference( ListeCmp, NbOfCmp ); /* count not yet annotated items */ /* count not yet annotated items */ Loading Loading @@ -700,8 +743,8 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly ) Buff.Empty(); Buff.Empty(); if( (stricmp( ListeCmp[ii].m_TextRef, if( (stricmp( ListeCmp[ii].m_TextRef, ListeCmp[ii + 1].m_TextRef ) != 0)|| ListeCmp[ii + 1].m_TextRef ) != 0) ( ListeCmp[ii].m_NumRef != ListeCmp[ii + 1].m_NumRef ) ) || ( ListeCmp[ii].m_NumRef != ListeCmp[ii + 1].m_NumRef ) ) continue; continue; /* Same reference found */ /* Same reference found */ Loading
eeschema/annotate_dialog.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -208,7 +208,7 @@ void WinEDA_AnnotateFrame::CreateControls() /* TODO: Check if there is any existing annotation and enable/disable /* TODO: Check if there is any existing annotation and enable/disable * the clear button accordingly. Probably should also enable/ * the clear button accordingly. Probably should also enable/ * disable new components radio button if all of the components * disable new components radio button if all of the components * are already annotated. Some low level work on the DrawSheetList * are already annotated. Some low level work on the DrawSheetPath * class will need to be done to accomadate this. * class will need to be done to accomadate this. */ */ m_btnClear = new wxButton( this, wxID_CLEAR ); m_btnClear = new wxButton( this, wxID_CLEAR ); Loading
eeschema/block.cpp +54 −48 Original line number Original line Diff line number Diff line Loading @@ -689,6 +689,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center ) case DRAW_HIER_LABEL_STRUCT_TYPE: case DRAW_HIER_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE: // Text is not really mirrored: Orientation is changed // Text is not really mirrored: Orientation is changed DrawText = (DrawLabelStruct*) DrawStruct; DrawText = (DrawLabelStruct*) DrawStruct; if( DrawText->m_Orient == 0 ) /* horizontal text */ if( DrawText->m_Orient == 0 ) /* horizontal text */ Loading Loading @@ -837,6 +838,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE //m_AssociatedScreen and m_sRefCount properly. //m_AssociatedScreen and m_sRefCount properly. DrawSheetStruct* sheet = (DrawSheetStruct*) Struct; DrawSheetStruct* sheet = (DrawSheetStruct*) Struct; sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetTimeStamp(); //sheet->m_AssociatedScreen->m_UndoList = NULL; //sheet->m_AssociatedScreen->m_UndoList = NULL; //sheet->m_AssociatedScreen->m_RedoList = NULL; //sheet->m_AssociatedScreen->m_RedoList = NULL; //keep m_AssociatedScreen pointer & associated. //keep m_AssociatedScreen pointer & associated. Loading Loading @@ -962,11 +964,15 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct RedrawOneStruct( panel, DC, DrawStruct, g_XorMode ); RedrawOneStruct( panel, DC, DrawStruct, g_XorMode ); /* Unlink the structure */ /* Unlink the structure */ DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link DrawStruct->Pnext = DrawStruct->Pback = NULL; // Only one struct -> no link if(DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE){ if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) SAFE_DELETE(DrawStruct); { frame->SaveCopyInUndoList( DrawStruct, IS_DELETED ); // Currently In TEST // SAFE_DELETE(DrawStruct); //no undo/redo for this (for now), it is on both the EEDrawList and m_SubSheet arrays, //no undo/redo for this (for now), it is on both the EEDrawList and m_SubSheet arrays, //hence the undo logic would have to be extended for this. //hence the undo logic would have to be extended for this. }else } else frame->SaveCopyInUndoList( DrawStruct, IS_DELETED ); frame->SaveCopyInUndoList( DrawStruct, IS_DELETED ); } } } } Loading
eeschema/class_drawsheet.cpp +51 −30 Original line number Original line Diff line number Diff line Loading @@ -43,10 +43,11 @@ DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) : m_NbLabel = 0; m_NbLabel = 0; m_Layer = LAYER_SHEET; m_Layer = LAYER_SHEET; m_Pos = pos; m_Pos = pos; m_TimeStamp = GetTimeStamp(); m_SheetNameSize = m_FileNameSize = 60; m_SheetNameSize = m_FileNameSize = 60; m_AssociatedScreen = NULL; m_AssociatedScreen = NULL; m_SheetName = wxT( "Root" ); m_SheetName.Printf( wxT("Sheet%8.8lX"), m_TimeStamp); m_FileName = wxT( " " ); m_FileName.Printf( wxT("file%8.8lX.sch"), m_TimeStamp); m_SheetNumber = 1; m_SheetNumber = 1; m_NumberOfSheets = 1; m_NumberOfSheets = 1; Loading Loading @@ -351,7 +352,7 @@ bool DrawSheetStruct::SearchHierarchy( wxString filename, SCH_SCREEN** screen ) /*******************************************************************************/ /*******************************************************************************/ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetList* list ) bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetPath* list ) /*******************************************************************************/ /*******************************************************************************/ { { //search the existing hierarchy for an instance of screen "FileName". //search the existing hierarchy for an instance of screen "FileName". Loading Loading @@ -386,6 +387,8 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetList* lis bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame ) bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame ) /*******************************************************************************/ /*******************************************************************************/ { { bool success = true; if( !m_AssociatedScreen ) if( !m_AssociatedScreen ) { { SCH_SCREEN* screen = NULL; SCH_SCREEN* screen = NULL; Loading @@ -401,22 +404,24 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame ) { { m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME ); m_AssociatedScreen = new SCH_SCREEN( SCHEMATIC_FRAME ); m_AssociatedScreen->m_RefCount++; m_AssociatedScreen->m_RefCount++; if( !frame->LoadOneEEFile( m_AssociatedScreen, m_FileName ) ) success = frame->LoadOneEEFile( m_AssociatedScreen, m_FileName); return false; if ( success ) { EDA_BaseStruct* bs = m_AssociatedScreen->EEDrawList; EDA_BaseStruct* bs = m_AssociatedScreen->EEDrawList; while( bs ) while( bs ) { { if( bs->Type() == DRAW_SHEET_STRUCT_TYPE ) if( bs->Type() == DRAW_SHEET_STRUCT_TYPE ) { { DrawSheetStruct* ss = (DrawSheetStruct*) bs; DrawSheetStruct* sheetstruct = (DrawSheetStruct*) bs; if( !ss->Load( frame ) ) if( !sheetstruct->Load( frame ) ) return false; success = false; } } bs = bs->Pnext; bs = bs->Pnext; } } } } } } return true; } return success; } } Loading @@ -442,6 +447,21 @@ int DrawSheetStruct::CountSheets() } } /******************************************/ wxString DrawSheetStruct::GetFileName(void) /******************************************/ { return m_FileName; } /************************************************************/ void DrawSheetStruct::SetFileName(const wxString & aFilename) /************************************************************/ { m_FileName = aFilename; } /************************/ /************************/ /* DrawSheetLabelStruct */ /* DrawSheetLabelStruct */ /************************/ /************************/ Loading Loading @@ -571,7 +591,7 @@ void DrawSheetLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoin /* class to handle a series of sheets *********/ /* class to handle a series of sheets *********/ /* a 'path' so to speak.. *********************/ /* a 'path' so to speak.. *********************/ /**********************************************/ /**********************************************/ DrawSheetList::DrawSheetList() DrawSheetPath::DrawSheetPath() { { for( int i = 0; i<DSLSZ; i++ ) for( int i = 0; i<DSLSZ; i++ ) m_sheets[i] = NULL; m_sheets[i] = NULL; Loading @@ -580,7 +600,7 @@ DrawSheetList::DrawSheetList() } } int DrawSheetList::Cmp( DrawSheetList& d ) int DrawSheetPath::Cmp( DrawSheetPath& d ) { { if( m_numSheets > d.m_numSheets ) if( m_numSheets > d.m_numSheets ) return 1; return 1; Loading @@ -600,7 +620,7 @@ int DrawSheetList::Cmp( DrawSheetList& d ) } } DrawSheetStruct* DrawSheetList::Last() DrawSheetStruct* DrawSheetPath::Last() { { if( m_numSheets ) if( m_numSheets ) return m_sheets[m_numSheets - 1]; return m_sheets[m_numSheets - 1]; Loading @@ -608,7 +628,7 @@ DrawSheetStruct* DrawSheetList::Last() } } SCH_SCREEN* DrawSheetList::LastScreen() SCH_SCREEN* DrawSheetPath::LastScreen() { { if( m_numSheets ) if( m_numSheets ) return m_sheets[m_numSheets - 1]->m_AssociatedScreen; return m_sheets[m_numSheets - 1]->m_AssociatedScreen; Loading @@ -616,7 +636,7 @@ SCH_SCREEN* DrawSheetList::LastScreen() } } EDA_BaseStruct* DrawSheetList::LastDrawList() EDA_BaseStruct* DrawSheetPath::LastDrawList() { { if( m_numSheets && m_sheets[m_numSheets - 1]->m_AssociatedScreen ) if( m_numSheets && m_sheets[m_numSheets - 1]->m_AssociatedScreen ) return m_sheets[m_numSheets - 1]->m_AssociatedScreen->EEDrawList; return m_sheets[m_numSheets - 1]->m_AssociatedScreen->EEDrawList; Loading @@ -624,8 +644,9 @@ EDA_BaseStruct* DrawSheetList::LastDrawList() } } void DrawSheetList::Push( DrawSheetStruct* sheet ) void DrawSheetPath::Push( DrawSheetStruct* sheet ) { { wxASSERT( m_numSheets <= DSLSZ ); if( m_numSheets < DSLSZ ) if( m_numSheets < DSLSZ ) { { m_sheets[m_numSheets] = sheet; m_sheets[m_numSheets] = sheet; Loading @@ -634,7 +655,7 @@ void DrawSheetList::Push( DrawSheetStruct* sheet ) } } DrawSheetStruct* DrawSheetList::Pop() DrawSheetStruct* DrawSheetPath::Pop() { { if( m_numSheets > 0 ) if( m_numSheets > 0 ) { { Loading @@ -645,7 +666,7 @@ DrawSheetStruct* DrawSheetList::Pop() } } wxString DrawSheetList::Path() wxString DrawSheetPath::Path() { { wxString s, t; wxString s, t; Loading @@ -664,7 +685,7 @@ wxString DrawSheetList::Path() } } wxString DrawSheetList::PathHumanReadable() wxString DrawSheetPath::PathHumanReadable() { { wxString s, t; wxString s, t; Loading @@ -680,7 +701,7 @@ wxString DrawSheetList::PathHumanReadable() } } void DrawSheetList::UpdateAllScreenReferences() void DrawSheetPath::UpdateAllScreenReferences() { { EDA_BaseStruct* t = LastDrawList(); EDA_BaseStruct* t = LastDrawList(); Loading @@ -698,7 +719,7 @@ void DrawSheetList::UpdateAllScreenReferences() } } bool DrawSheetList::operator=( const DrawSheetList& d1 ) bool DrawSheetPath::operator=( const DrawSheetPath& d1 ) { { m_numSheets = d1.m_numSheets; m_numSheets = d1.m_numSheets; int i; int i; Loading @@ -716,7 +737,7 @@ bool DrawSheetList::operator=( const DrawSheetList& d1 ) } } bool DrawSheetList::operator==( const DrawSheetList& d1 ) bool DrawSheetPath::operator==( const DrawSheetPath& d1 ) { { if( m_numSheets != d1.m_numSheets ) if( m_numSheets != d1.m_numSheets ) return false; return false; Loading @@ -730,7 +751,7 @@ bool DrawSheetList::operator==( const DrawSheetList& d1 ) } } bool DrawSheetList::operator!=( const DrawSheetList& d1 ) bool DrawSheetPath::operator!=( const DrawSheetPath& d1 ) { { if( m_numSheets != d1.m_numSheets ) if( m_numSheets != d1.m_numSheets ) return true; return true; Loading