Loading eeschema/bus-wire-junction.cpp +18 −12 Original line number Original line Diff line number Diff line Loading @@ -115,7 +115,12 @@ static void RestoreOldWires( SCH_SCREEN* screen ) void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) /*************************************************************/ /*************************************************************/ /* Create a new segment ( WIRE, BUS ). /* Creates a new segment ( WIRE, BUS ), * or terminates the current segment * If the end of the current segment is on an other segment, place a junction if needed * and terminates the command * If the end of the current segment is on a pin, terminates the command * In others cases starts a new segment */ */ { { EDA_DrawLineStruct* oldsegment, * newsegment, * nextsegment; EDA_DrawLineStruct* oldsegment, * newsegment, * nextsegment; Loading Loading @@ -177,7 +182,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine; DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine; g_ItemToRepeat = NULL; g_ItemToRepeat = NULL; } } else /* Trace en cours: Placement d'un point supplementaire */ else /* A segment is in progress: terminates the current segment and add a new segment */ { { nextsegment = oldsegment->Next(); nextsegment = oldsegment->Next(); if( !g_HVLines ) if( !g_HVLines ) Loading @@ -194,8 +199,9 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); /* Creation du segment suivant ou fin de trac� si point sur pin, jonction ...*/ /* Creates the new segment, or terminates the command if( IsTerminalPoint( (SCH_SCREEN*)GetScreen(), cursorpos, oldsegment->GetLayer() ) ) * if the end point is on a pin, jonction or an other wire or bus */ if( IsTerminalPoint( GetScreen(), cursorpos, oldsegment->GetLayer() ) ) { { EndSegment( DC ); return; EndSegment( DC ); return; } } Loading Loading @@ -777,15 +783,15 @@ void IncrementLabelMember( wxString& name ) static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) /***************************************************************************/ /***************************************************************************/ /* Returne TRUE si pos est un point possible pour terminer automatiquement un /* Return TRUE if pos can be a terminal point for a wire or a bus * segment, c'est a dire pour * i.e. : * - type WIRE, si il y a * for a WIRE, if at pos is found: * - une jonction * - a junction * - ou une pin * - or a pin * - ou une extr�mit� unique de fil * - or an other wire * * * - type BUS, si il y a * - for a BUS, if at pos is found: * - ou une extr�mit� unique de BUS * - a BUS */ */ { { EDA_BaseStruct* item; EDA_BaseStruct* item; Loading eeschema/class_libentry.cpp +1 −2 Original line number Original line Diff line number Diff line Loading @@ -242,7 +242,6 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc, { { wxString fieldText; wxString fieldText; LibDrawField* Field; LibDrawField* Field; LIB_DRAW_ITEM* drawItem; BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen(); GRSetDrawMode( dc, drawMode ); GRSetDrawMode( dc, drawMode ); Loading Loading @@ -313,7 +312,7 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc, for( Field = m_Fields; Field != NULL; Field = Field->Next() ) for( Field = m_Fields; Field != NULL; Field = Field->Next() ) { { if( onlySelected && drawItem->m_Selected == 0 ) if( onlySelected && Field->m_Selected == 0 ) continue; continue; Field->Draw( panel, dc, offset, color, drawMode, NULL, Field->Draw( panel, dc, offset, color, drawMode, NULL, Loading eeschema/locate.cpp +54 −7 Original line number Original line Diff line number Diff line Loading @@ -686,13 +686,45 @@ Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet, return NULL; return NULL; } } /* helper function used to locate graphics items in a lib component (in library space) * to a given location given in schematic space * in schematic space, a component is an image of the lib component, rotated and mirorred * by its mirror/rotation matrix * this function calculates the invert matrix of the mirror/rotation matrix * it is used to calculate the position in in library space from * the position in schematic space of a test point, corresponding to a given component */ bool InvertMatrix(int aSource[2][2], int aDest[2][2] ) { /* for a source matrix (a,b, c,d) a, if the first line, and cd the second line * the invert matrix is 1/det * comatrix * det = ad-bc * comatrix = (d,-b, -c,a) * a = aSource[0][0] * b = aSource[0][1] * c = aSource[1][0] * d = aSource[1][1] * in eeschema, values are 1, 0 or -1 only and we can use integers only */ bool success = true; int det = aSource[0][0]*aSource[1][1] - aSource[0][1]*aSource[1][0]; wxASSERT(det); if( det == 0 ) // Should not occur with eeschema matrix transform det = 1; aDest[0][0] = aSource[1][1]/det; aDest[0][1] = -aSource[0][1]/det; aDest[1][0] = -aSource[1][0]/det; aDest[1][1] = aSource[0][0]/det; return success; } LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, SCH_COMPONENT** libpart ) SCH_COMPONENT** libpart ) { { SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct; LIB_COMPONENT* Entry; LIB_COMPONENT* Entry; SCH_COMPONENT* LibItem = NULL; SCH_COMPONENT* schItem = NULL; LibDrawPin* Pin = NULL; LibDrawPin* Pin = NULL; for( DrawStruct = DrawList; DrawStruct != NULL; for( DrawStruct = DrawList; DrawStruct != NULL; Loading @@ -700,21 +732,36 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, { { if( DrawStruct->Type() != TYPE_SCH_COMPONENT ) if( DrawStruct->Type() != TYPE_SCH_COMPONENT ) continue; continue; LibItem = (SCH_COMPONENT*) DrawStruct; schItem = (SCH_COMPONENT*) DrawStruct; Entry = CMP_LIBRARY::FindLibraryComponent( LibItem->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( schItem->m_ChipName ); if( Entry == NULL ) if( Entry == NULL ) continue; continue; Pin = (LibDrawPin*) Entry->LocateDrawItem( LibItem->m_Multi, /* we use LocateDrawItem to locate pns. but this function suppose a component LibItem->m_Convert, * at 0,0 location, in normal orientation/mirror * So we must calculate the ref position in component space */ // Calculate the position relative to the component (in library space the component is at location 0,0) wxPoint libPos = RefPos - schItem->m_Pos; // Calculate the equivalent position of the test point for a normal orient component int itransMat[2][2]; InvertMatrix(schItem->m_Transform, itransMat ); libPos = TransformCoordinate(itransMat, libPos); // LocateDrawItem uses DefaultTransformMatrix as matrix orientation of the component // so we must recalculate libPos for this orientation before calling LocateDrawItem InvertMatrix(DefaultTransformMatrix, itransMat ); libPos = TransformCoordinate(itransMat, libPos); wxPoint schPos = TransformCoordinate(schItem->m_Transform, libPos); Pin = (LibDrawPin*) Entry->LocateDrawItem( schItem->m_Multi, schItem->m_Convert, COMPONENT_PIN_DRAW_TYPE, COMPONENT_PIN_DRAW_TYPE, RefPos ); libPos ); if( Pin ) if( Pin ) break; break; } } if( libpart ) if( libpart ) *libpart = LibItem; *libpart = schItem; return Pin; return Pin; } } Loading include/wxBasePcbFrame.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -333,7 +333,6 @@ public: virtual void SwitchLayer( wxDC* DC, int layer ); virtual void SwitchLayer( wxDC* DC, int layer ); // divers // divers void AddHistory( int value, KICAD_T type ); // Add value in data list history void InstallGridFrame( const wxPoint& pos ); void InstallGridFrame( const wxPoint& pos ); virtual void LoadSettings(); virtual void LoadSettings(); Loading include/wxPcbStruct.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -56,9 +56,9 @@ public: WinEDAChoiceBox* m_SelViaSizeBox; // a combo box to display and select current via diameter WinEDAChoiceBox* m_SelViaSizeBox; // a combo box to display and select current via diameter wxTextCtrl* m_ClearanceBox; // a text ctrl to display the current tracks and vias clearance wxTextCtrl* m_ClearanceBox; // a text ctrl to display the current tracks and vias clearance wxTextCtrl* m_NetClassSelectedBox; // a text ctrl to display the current NetClass wxTextCtrl* m_NetClassSelectedBox; // a text ctrl to display the current NetClass bool m_TrackAndViasSizesList_Changed; private: private: bool m_TrackAndViasSizesList_Changed; DRC* m_drc; ///< the DRC controller, see drc.cpp DRC* m_drc; ///< the DRC controller, see drc.cpp Loading Loading
eeschema/bus-wire-junction.cpp +18 −12 Original line number Original line Diff line number Diff line Loading @@ -115,7 +115,12 @@ static void RestoreOldWires( SCH_SCREEN* screen ) void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) /*************************************************************/ /*************************************************************/ /* Create a new segment ( WIRE, BUS ). /* Creates a new segment ( WIRE, BUS ), * or terminates the current segment * If the end of the current segment is on an other segment, place a junction if needed * and terminates the command * If the end of the current segment is on a pin, terminates the command * In others cases starts a new segment */ */ { { EDA_DrawLineStruct* oldsegment, * newsegment, * nextsegment; EDA_DrawLineStruct* oldsegment, * newsegment, * nextsegment; Loading Loading @@ -177,7 +182,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine; DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine; g_ItemToRepeat = NULL; g_ItemToRepeat = NULL; } } else /* Trace en cours: Placement d'un point supplementaire */ else /* A segment is in progress: terminates the current segment and add a new segment */ { { nextsegment = oldsegment->Next(); nextsegment = oldsegment->Next(); if( !g_HVLines ) if( !g_HVLines ) Loading @@ -194,8 +199,9 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); /* Creation du segment suivant ou fin de trac� si point sur pin, jonction ...*/ /* Creates the new segment, or terminates the command if( IsTerminalPoint( (SCH_SCREEN*)GetScreen(), cursorpos, oldsegment->GetLayer() ) ) * if the end point is on a pin, jonction or an other wire or bus */ if( IsTerminalPoint( GetScreen(), cursorpos, oldsegment->GetLayer() ) ) { { EndSegment( DC ); return; EndSegment( DC ); return; } } Loading Loading @@ -777,15 +783,15 @@ void IncrementLabelMember( wxString& name ) static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) /***************************************************************************/ /***************************************************************************/ /* Returne TRUE si pos est un point possible pour terminer automatiquement un /* Return TRUE if pos can be a terminal point for a wire or a bus * segment, c'est a dire pour * i.e. : * - type WIRE, si il y a * for a WIRE, if at pos is found: * - une jonction * - a junction * - ou une pin * - or a pin * - ou une extr�mit� unique de fil * - or an other wire * * * - type BUS, si il y a * - for a BUS, if at pos is found: * - ou une extr�mit� unique de BUS * - a BUS */ */ { { EDA_BaseStruct* item; EDA_BaseStruct* item; Loading
eeschema/class_libentry.cpp +1 −2 Original line number Original line Diff line number Diff line Loading @@ -242,7 +242,6 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc, { { wxString fieldText; wxString fieldText; LibDrawField* Field; LibDrawField* Field; LIB_DRAW_ITEM* drawItem; BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen(); GRSetDrawMode( dc, drawMode ); GRSetDrawMode( dc, drawMode ); Loading Loading @@ -313,7 +312,7 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc, for( Field = m_Fields; Field != NULL; Field = Field->Next() ) for( Field = m_Fields; Field != NULL; Field = Field->Next() ) { { if( onlySelected && drawItem->m_Selected == 0 ) if( onlySelected && Field->m_Selected == 0 ) continue; continue; Field->Draw( panel, dc, offset, color, drawMode, NULL, Field->Draw( panel, dc, offset, color, drawMode, NULL, Loading
eeschema/locate.cpp +54 −7 Original line number Original line Diff line number Diff line Loading @@ -686,13 +686,45 @@ Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet, return NULL; return NULL; } } /* helper function used to locate graphics items in a lib component (in library space) * to a given location given in schematic space * in schematic space, a component is an image of the lib component, rotated and mirorred * by its mirror/rotation matrix * this function calculates the invert matrix of the mirror/rotation matrix * it is used to calculate the position in in library space from * the position in schematic space of a test point, corresponding to a given component */ bool InvertMatrix(int aSource[2][2], int aDest[2][2] ) { /* for a source matrix (a,b, c,d) a, if the first line, and cd the second line * the invert matrix is 1/det * comatrix * det = ad-bc * comatrix = (d,-b, -c,a) * a = aSource[0][0] * b = aSource[0][1] * c = aSource[1][0] * d = aSource[1][1] * in eeschema, values are 1, 0 or -1 only and we can use integers only */ bool success = true; int det = aSource[0][0]*aSource[1][1] - aSource[0][1]*aSource[1][0]; wxASSERT(det); if( det == 0 ) // Should not occur with eeschema matrix transform det = 1; aDest[0][0] = aSource[1][1]/det; aDest[0][1] = -aSource[0][1]/det; aDest[1][0] = -aSource[1][0]/det; aDest[1][1] = aSource[0][0]/det; return success; } LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, SCH_COMPONENT** libpart ) SCH_COMPONENT** libpart ) { { SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct; LIB_COMPONENT* Entry; LIB_COMPONENT* Entry; SCH_COMPONENT* LibItem = NULL; SCH_COMPONENT* schItem = NULL; LibDrawPin* Pin = NULL; LibDrawPin* Pin = NULL; for( DrawStruct = DrawList; DrawStruct != NULL; for( DrawStruct = DrawList; DrawStruct != NULL; Loading @@ -700,21 +732,36 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, { { if( DrawStruct->Type() != TYPE_SCH_COMPONENT ) if( DrawStruct->Type() != TYPE_SCH_COMPONENT ) continue; continue; LibItem = (SCH_COMPONENT*) DrawStruct; schItem = (SCH_COMPONENT*) DrawStruct; Entry = CMP_LIBRARY::FindLibraryComponent( LibItem->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( schItem->m_ChipName ); if( Entry == NULL ) if( Entry == NULL ) continue; continue; Pin = (LibDrawPin*) Entry->LocateDrawItem( LibItem->m_Multi, /* we use LocateDrawItem to locate pns. but this function suppose a component LibItem->m_Convert, * at 0,0 location, in normal orientation/mirror * So we must calculate the ref position in component space */ // Calculate the position relative to the component (in library space the component is at location 0,0) wxPoint libPos = RefPos - schItem->m_Pos; // Calculate the equivalent position of the test point for a normal orient component int itransMat[2][2]; InvertMatrix(schItem->m_Transform, itransMat ); libPos = TransformCoordinate(itransMat, libPos); // LocateDrawItem uses DefaultTransformMatrix as matrix orientation of the component // so we must recalculate libPos for this orientation before calling LocateDrawItem InvertMatrix(DefaultTransformMatrix, itransMat ); libPos = TransformCoordinate(itransMat, libPos); wxPoint schPos = TransformCoordinate(schItem->m_Transform, libPos); Pin = (LibDrawPin*) Entry->LocateDrawItem( schItem->m_Multi, schItem->m_Convert, COMPONENT_PIN_DRAW_TYPE, COMPONENT_PIN_DRAW_TYPE, RefPos ); libPos ); if( Pin ) if( Pin ) break; break; } } if( libpart ) if( libpart ) *libpart = LibItem; *libpart = schItem; return Pin; return Pin; } } Loading
include/wxBasePcbFrame.h +0 −1 Original line number Original line Diff line number Diff line Loading @@ -333,7 +333,6 @@ public: virtual void SwitchLayer( wxDC* DC, int layer ); virtual void SwitchLayer( wxDC* DC, int layer ); // divers // divers void AddHistory( int value, KICAD_T type ); // Add value in data list history void InstallGridFrame( const wxPoint& pos ); void InstallGridFrame( const wxPoint& pos ); virtual void LoadSettings(); virtual void LoadSettings(); Loading
include/wxPcbStruct.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -56,9 +56,9 @@ public: WinEDAChoiceBox* m_SelViaSizeBox; // a combo box to display and select current via diameter WinEDAChoiceBox* m_SelViaSizeBox; // a combo box to display and select current via diameter wxTextCtrl* m_ClearanceBox; // a text ctrl to display the current tracks and vias clearance wxTextCtrl* m_ClearanceBox; // a text ctrl to display the current tracks and vias clearance wxTextCtrl* m_NetClassSelectedBox; // a text ctrl to display the current NetClass wxTextCtrl* m_NetClassSelectedBox; // a text ctrl to display the current NetClass bool m_TrackAndViasSizesList_Changed; private: private: bool m_TrackAndViasSizesList_Changed; DRC* m_drc; ///< the DRC controller, see drc.cpp DRC* m_drc; ///< the DRC controller, see drc.cpp Loading