Loading eeschema/block.cpp +73 −50 Original line number Original line Diff line number Diff line Loading @@ -1416,20 +1416,28 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct ) /****************************************************/ /****************************************************/ static void CollectStructsToDrag( SCH_SCREEN* screen ) static void CollectStructsToDrag( SCH_SCREEN* screen ) /****************************************************/ /****************************************************/ /* creates the list of items found when a drag block is initiated. * items are those slected in window block an some items outside this area but connected * to a selected item (connected wires to a component or an entry ) */ { { DrawPickedStruct* DrawStructs, * FirstPicked; DrawPickedStruct* DrawStructs, * FirstPicked; SCH_ITEM* Struct; SCH_ITEM* Struct; EDA_DrawLineStruct* SegmStruct; EDA_DrawLineStruct* SegmStruct; int ox, oy, fx, fy; int ox, oy, fx, fy; /* Set membre .m_Flags des segments */ /* .m_Flags member is used to handle how a wire is exactly slected * (fully selected, or partially selected by an end point ) */ for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() ) for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() ) Struct->m_Flags = 0; Struct->m_Flags = 0; if( screen->BlockLocate.m_BlockDrawStruct->Type() == // Sel .m_Flags to selected for a wire or buss in selected area if there is only one item: DRAW_SEGMENT_STRUCT_TYPE ) if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) screen->BlockLocate.m_BlockDrawStruct->m_Flags = SELECTED; screen->BlockLocate.m_BlockDrawStruct->m_Flags = SELECTED; // Sel .m_Flags to selected for a wire or buss in selected area for a list of items: else if( screen->BlockLocate.m_BlockDrawStruct->Type() == else if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) DRAW_PICK_ITEM_STRUCT_TYPE ) { { Loading @@ -1456,8 +1464,10 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) if( fy < oy ) if( fy < oy ) EXCHG( fy, oy ); EXCHG( fy, oy ); /* Pour Drag Block: remise sous forme de liste de structure, s'il n'y /* For drag block only: * a qu'un seul element ( pour homogeneiser les traitements ulterieurs */ * If only one item, change for a list of one item * in order to have always a list to handle. */ if( screen->BlockLocate.m_BlockDrawStruct->Type() != if( screen->BlockLocate.m_BlockDrawStruct->Type() != DRAW_PICK_ITEM_STRUCT_TYPE ) DRAW_PICK_ITEM_STRUCT_TYPE ) { { Loading Loading @@ -1486,9 +1496,8 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) } } } } /* Recherche des elements complementaires a "dragger", c'est a dire les /* Search for other items to drag. They are end wires connected to selected items * fils et connexions hors bloc relies a des pins ou entries elles meme */ * draggees */ FirstPicked = DrawStructs = FirstPicked = DrawStructs = (DrawPickedStruct*) screen->BlockLocate. (DrawPickedStruct*) screen->BlockLocate. Loading @@ -1498,22 +1507,25 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) Struct = DrawStructs->m_PickedStruct; Struct = DrawStructs->m_PickedStruct; DrawStructs = DrawStructs->Next(); DrawStructs = DrawStructs->Next(); if( Struct->Type() == TYPE_SCH_COMPONENT ) if( Struct->Type() == TYPE_SCH_COMPONENT ) { { // Add all pins of the selected component to list LibEDA_BaseStruct* DrawItem; LibEDA_BaseStruct* DrawItem; wxPoint pos; wxPoint pos; DrawItem = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos ); DrawItem = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos ); while( DrawItem ) while( DrawItem ) { { if( (pos.x < ox) || (pos.x > fx) || (pos.y < oy) if( (pos.x < ox) || (pos.x > fx) || (pos.y < oy) || (pos.y > fy) ) || (pos.y > fy) ) { // This pin is outside area, // but because it it the pin of a selected component // we must also select connected items to this pin AddPickedItem( screen, pos ); AddPickedItem( screen, pos ); } DrawItem = GetNextPinPosition( NULL, pos ); DrawItem = GetNextPinPosition( NULL, pos ); } } } } if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE ) { { // Add all pins sheets of a selected hierarchical sheet to the list Hierarchical_PIN_Sheet_Struct* SLabel = Hierarchical_PIN_Sheet_Struct* SLabel = ( (DrawSheetStruct*) Struct )->m_Label; ( (DrawSheetStruct*) Struct )->m_Label; while( SLabel ) while( SLabel ) Loading Loading @@ -1705,13 +1717,25 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, wxPoint& aPosition ) wxPoint& aPosition ) /*********************************************************************************/ /*********************************************************************************/ /** GetNextPinPosition() * calculate position of the "next" pin of the aDrawLibItem component * if aDrawLibItem is non null : search for the first pin * if aDrawLibItem == NULL, search the next pin * returns its position * @param aDrawLibItem = component test. search for the first pin * if NULL, serach for the next pin for each call * @param aPosition = the calculated pin position, according to the component orientation and position * @return a pointer to the pin */ { { EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry; static LibEDA_BaseStruct* NextItem; static LibEDA_BaseStruct* NextItem; static int Multi, convert, PartX, PartY, TransMat[2][2]; static int Multi, convert, TransMat[2][2]; LibEDA_BaseStruct* DEntry; LibEDA_BaseStruct* DEntry; int orient; int orient; LibDrawPin* Pin; LibDrawPin* Pin; static wxPoint CmpPosition; if( aDrawLibItem ) if( aDrawLibItem ) { { Loading @@ -1723,8 +1747,7 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, DEntry = Entry->m_Drawings; DEntry = Entry->m_Drawings; Multi = aDrawLibItem->m_Multi; Multi = aDrawLibItem->m_Multi; convert = aDrawLibItem->m_Convert; convert = aDrawLibItem->m_Convert; PartX = aDrawLibItem->m_Pos.x; CmpPosition = aDrawLibItem->m_Pos; PartY = aDrawLibItem->m_Pos.y; memcpy( TransMat, aDrawLibItem->m_Transform, sizeof(TransMat) ); memcpy( TransMat, aDrawLibItem->m_Transform, sizeof(TransMat) ); } } else else Loading @@ -1746,7 +1769,7 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, orient = Pin->ReturnPinDrawOrient( TransMat ); orient = Pin->ReturnPinDrawOrient( TransMat ); /* Calcul de la position du point de reference */ /* Calcul de la position du point de reference */ aPosition = TransformCoordinate( TransMat, Pin->m_Pos); aPosition = TransformCoordinate( TransMat, Pin->m_Pos ) + CmpPosition; NextItem = DEntry->Next(); NextItem = DEntry->Next(); return DEntry; return DEntry; } } Loading Loading
eeschema/block.cpp +73 −50 Original line number Original line Diff line number Diff line Loading @@ -1416,20 +1416,28 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct ) /****************************************************/ /****************************************************/ static void CollectStructsToDrag( SCH_SCREEN* screen ) static void CollectStructsToDrag( SCH_SCREEN* screen ) /****************************************************/ /****************************************************/ /* creates the list of items found when a drag block is initiated. * items are those slected in window block an some items outside this area but connected * to a selected item (connected wires to a component or an entry ) */ { { DrawPickedStruct* DrawStructs, * FirstPicked; DrawPickedStruct* DrawStructs, * FirstPicked; SCH_ITEM* Struct; SCH_ITEM* Struct; EDA_DrawLineStruct* SegmStruct; EDA_DrawLineStruct* SegmStruct; int ox, oy, fx, fy; int ox, oy, fx, fy; /* Set membre .m_Flags des segments */ /* .m_Flags member is used to handle how a wire is exactly slected * (fully selected, or partially selected by an end point ) */ for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() ) for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() ) Struct->m_Flags = 0; Struct->m_Flags = 0; if( screen->BlockLocate.m_BlockDrawStruct->Type() == // Sel .m_Flags to selected for a wire or buss in selected area if there is only one item: DRAW_SEGMENT_STRUCT_TYPE ) if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) screen->BlockLocate.m_BlockDrawStruct->m_Flags = SELECTED; screen->BlockLocate.m_BlockDrawStruct->m_Flags = SELECTED; // Sel .m_Flags to selected for a wire or buss in selected area for a list of items: else if( screen->BlockLocate.m_BlockDrawStruct->Type() == else if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) DRAW_PICK_ITEM_STRUCT_TYPE ) { { Loading @@ -1456,8 +1464,10 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) if( fy < oy ) if( fy < oy ) EXCHG( fy, oy ); EXCHG( fy, oy ); /* Pour Drag Block: remise sous forme de liste de structure, s'il n'y /* For drag block only: * a qu'un seul element ( pour homogeneiser les traitements ulterieurs */ * If only one item, change for a list of one item * in order to have always a list to handle. */ if( screen->BlockLocate.m_BlockDrawStruct->Type() != if( screen->BlockLocate.m_BlockDrawStruct->Type() != DRAW_PICK_ITEM_STRUCT_TYPE ) DRAW_PICK_ITEM_STRUCT_TYPE ) { { Loading Loading @@ -1486,9 +1496,8 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) } } } } /* Recherche des elements complementaires a "dragger", c'est a dire les /* Search for other items to drag. They are end wires connected to selected items * fils et connexions hors bloc relies a des pins ou entries elles meme */ * draggees */ FirstPicked = DrawStructs = FirstPicked = DrawStructs = (DrawPickedStruct*) screen->BlockLocate. (DrawPickedStruct*) screen->BlockLocate. Loading @@ -1498,22 +1507,25 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) Struct = DrawStructs->m_PickedStruct; Struct = DrawStructs->m_PickedStruct; DrawStructs = DrawStructs->Next(); DrawStructs = DrawStructs->Next(); if( Struct->Type() == TYPE_SCH_COMPONENT ) if( Struct->Type() == TYPE_SCH_COMPONENT ) { { // Add all pins of the selected component to list LibEDA_BaseStruct* DrawItem; LibEDA_BaseStruct* DrawItem; wxPoint pos; wxPoint pos; DrawItem = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos ); DrawItem = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos ); while( DrawItem ) while( DrawItem ) { { if( (pos.x < ox) || (pos.x > fx) || (pos.y < oy) if( (pos.x < ox) || (pos.x > fx) || (pos.y < oy) || (pos.y > fy) ) || (pos.y > fy) ) { // This pin is outside area, // but because it it the pin of a selected component // we must also select connected items to this pin AddPickedItem( screen, pos ); AddPickedItem( screen, pos ); } DrawItem = GetNextPinPosition( NULL, pos ); DrawItem = GetNextPinPosition( NULL, pos ); } } } } if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE ) { { // Add all pins sheets of a selected hierarchical sheet to the list Hierarchical_PIN_Sheet_Struct* SLabel = Hierarchical_PIN_Sheet_Struct* SLabel = ( (DrawSheetStruct*) Struct )->m_Label; ( (DrawSheetStruct*) Struct )->m_Label; while( SLabel ) while( SLabel ) Loading Loading @@ -1705,13 +1717,25 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, wxPoint& aPosition ) wxPoint& aPosition ) /*********************************************************************************/ /*********************************************************************************/ /** GetNextPinPosition() * calculate position of the "next" pin of the aDrawLibItem component * if aDrawLibItem is non null : search for the first pin * if aDrawLibItem == NULL, search the next pin * returns its position * @param aDrawLibItem = component test. search for the first pin * if NULL, serach for the next pin for each call * @param aPosition = the calculated pin position, according to the component orientation and position * @return a pointer to the pin */ { { EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry; static LibEDA_BaseStruct* NextItem; static LibEDA_BaseStruct* NextItem; static int Multi, convert, PartX, PartY, TransMat[2][2]; static int Multi, convert, TransMat[2][2]; LibEDA_BaseStruct* DEntry; LibEDA_BaseStruct* DEntry; int orient; int orient; LibDrawPin* Pin; LibDrawPin* Pin; static wxPoint CmpPosition; if( aDrawLibItem ) if( aDrawLibItem ) { { Loading @@ -1723,8 +1747,7 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, DEntry = Entry->m_Drawings; DEntry = Entry->m_Drawings; Multi = aDrawLibItem->m_Multi; Multi = aDrawLibItem->m_Multi; convert = aDrawLibItem->m_Convert; convert = aDrawLibItem->m_Convert; PartX = aDrawLibItem->m_Pos.x; CmpPosition = aDrawLibItem->m_Pos; PartY = aDrawLibItem->m_Pos.y; memcpy( TransMat, aDrawLibItem->m_Transform, sizeof(TransMat) ); memcpy( TransMat, aDrawLibItem->m_Transform, sizeof(TransMat) ); } } else else Loading @@ -1746,7 +1769,7 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, orient = Pin->ReturnPinDrawOrient( TransMat ); orient = Pin->ReturnPinDrawOrient( TransMat ); /* Calcul de la position du point de reference */ /* Calcul de la position du point de reference */ aPosition = TransformCoordinate( TransMat, Pin->m_Pos); aPosition = TransformCoordinate( TransMat, Pin->m_Pos ) + CmpPosition; NextItem = DEntry->Next(); NextItem = DEntry->Next(); return DEntry; return DEntry; } } Loading