예제 #1
0
void SchematicCleanUp(wxDC * DC)
/*******************************/
/* Routine de nettoyage:
	- regroupe les segments de fils (ou de bus) alignes en 1 seul segment
	- Detecte les objets identiques superposes
*/
{
SCH_SCREEN * screen;
EDA_BaseStruct *DrawList, * TstDrawList;
int flag;


	screen = ScreenSch;
	for ( ; screen != NULL; screen = (SCH_SCREEN*)screen->Pnext )
	{
		DrawList = screen->EEDrawList;
		while ( DrawList )
		{
			if( DrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE )
			{
				TstDrawList = DrawList->Pnext;
				while ( TstDrawList )
				{
					if( TstDrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE )
					{
						flag = TstAlignSegment( (EDA_DrawLineStruct*)DrawList,
											(EDA_DrawLineStruct*)TstDrawList);
						if (flag )	/* Suppression de TstSegm */
						{
							/* keep the bits set in .m_Flags, because the deleted segment can be flagged */
							DrawList->m_Flags |= TstDrawList->m_Flags;
							EraseStruct(TstDrawList, screen);
							screen->SetRefreshReq();
							TstDrawList = screen->EEDrawList;
						}
						else TstDrawList = TstDrawList->Pnext;
					}
					else TstDrawList = TstDrawList->Pnext;
				}
			}
			DrawList = DrawList->Pnext;
		}
		EDA_Appl->SchematicFrame->TestDanglingEnds(screen->EEDrawList, DC);
	}
}