fixed track delete bug
This commit is contained in:
parent
959919dd20
commit
eec9f1f428
|
@ -4,14 +4,30 @@ 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.
|
||||||
|
|
||||||
2007-Nov-032 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
|
||||||
|
2007-Nov-2 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
|
================================================================================
|
||||||
|
+ pcbnew
|
||||||
|
fixed a crashing bug which happened if you "dragged" a module with
|
||||||
|
tracks. Then deleted one of the pad connected tracks, then deleted the
|
||||||
|
next track attached to the first one. Memory was being corrupted because
|
||||||
|
PcbGeneralLocate() and display was not being called on the 2nd track to
|
||||||
|
be deleted because the m_Flags test:
|
||||||
|
bool ItemFree = (GetCurItem()==0 || GetCurItem()->m_Flags==0);
|
||||||
|
was returning false. Solution was to SetCurItem(NULL) after deleting a
|
||||||
|
TRACK. This makes sense, SetCurItem() is used for designating a "selected"
|
||||||
|
item, and a deleted TRACK is not even in the BOARD anymore and should not
|
||||||
|
be selected or selectable. I think this bug may have been causing spurious
|
||||||
|
crashes for the last couple of months.
|
||||||
|
|
||||||
|
|
||||||
|
2007-Nov-02 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||||
================================================================================
|
================================================================================
|
||||||
+all:
|
+all:
|
||||||
solved: eeschema, pcbnew and cvpcb did not find libraries when they were
|
solved: eeschema, pcbnew and cvpcb did not find libraries when they were
|
||||||
in the default library path, but in a subdirectory
|
in the default library path, but in a subdirectory
|
||||||
(this is because the default path was not added to the name if the name had
|
(this is because the default path was not added to the name if the name had
|
||||||
already a path)
|
already a path)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2007-Nov-02 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
|
2007-Nov-02 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
|
||||||
|
@ -49,11 +65,11 @@ email address.
|
||||||
2007-Oct-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
2007-Oct-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||||
================================================================================
|
================================================================================
|
||||||
+kicad:
|
+kicad:
|
||||||
rename mdiframe.cpp to mainframe.cpp
|
rename mdiframe.cpp to mainframe.cpp
|
||||||
create commandframe.cpp to handle the command frame (which have the 4 "fast launch" buttons)
|
create commandframe.cpp to handle the command frame (which have the 4 "fast launch" buttons)
|
||||||
|
|
||||||
|
|
||||||
2007-Oct-31 UPDATE Dick Hollenbeck <dickelbeck@yahoo.com>
|
2007-Oct-31 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
+ all
|
+ all
|
||||||
* Added Doxygen configuration file, whose standard name is Doxyfile. Output
|
* Added Doxygen configuration file, whose standard name is Doxyfile. Output
|
||||||
|
@ -1124,7 +1140,7 @@ email address.
|
||||||
better hotkey.cpp (code cleaning and info messages)
|
better hotkey.cpp (code cleaning and info messages)
|
||||||
|
|
||||||
|
|
||||||
2007-June-19 UPDATE Dick Hollenbeck <dickelbeck@yahoo.com>
|
2007-June-19 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
+ pcbnew
|
+ pcbnew
|
||||||
After locking a module with 'L', update the status window with the locked
|
After locking a module with 'L', update the status window with the locked
|
||||||
|
@ -1140,7 +1156,7 @@ email address.
|
||||||
add install targets for resources and docs
|
add install targets for resources and docs
|
||||||
|
|
||||||
|
|
||||||
2007-June-15 UPDATE Dick Hollenbeck <dickelbeck@yahoo.com>
|
2007-June-15 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
+ pcbnew
|
+ pcbnew
|
||||||
** only modules on the present layer are subject to individual module
|
** only modules on the present layer are subject to individual module
|
||||||
|
@ -1194,7 +1210,7 @@ email address.
|
||||||
line e.g. "make -f makefile.gtk KICAD_STATIC_LINK=0"
|
line e.g. "make -f makefile.gtk KICAD_STATIC_LINK=0"
|
||||||
|
|
||||||
|
|
||||||
2007-June-11 UPDATE Dick Hollenbeck <dickelbeck@yahoo.com>
|
2007-June-11 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||||
================================================================================
|
================================================================================
|
||||||
+ Started this change log file.
|
+ Started this change log file.
|
||||||
|
|
||||||
|
|
|
@ -447,6 +447,7 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* Pcb )
|
||||||
/* Traitement du debut de liste */
|
/* Traitement du debut de liste */
|
||||||
if( track == NULL )
|
if( track == NULL )
|
||||||
return NULL; /* No tracks ! */
|
return NULL; /* No tracks ! */
|
||||||
|
|
||||||
if( GetNet() < track->GetNet() ) /* no net code or net code = 0 (track not connected) */
|
if( GetNet() < track->GetNet() ) /* no net code or net code = 0 (track not connected) */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -454,6 +455,7 @@ TRACK* TRACK::GetBestInsertPoint( BOARD* Pcb )
|
||||||
{
|
{
|
||||||
if( NextTrack->GetNet() > this->GetNet() )
|
if( NextTrack->GetNet() > this->GetNet() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
track = NextTrack;
|
track = NextTrack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,25 +68,28 @@ public:
|
||||||
*/
|
*/
|
||||||
bool Save( FILE* aFile ) const;
|
bool Save( FILE* aFile ) const;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Insert
|
* Function Insert
|
||||||
* inserts a TRACK, SEGVIA or SEGZONE into its proper list, either at the
|
* inserts a single TRACK, SEGVIA or SEGZONE, or a list of such,
|
||||||
|
* into the proper list within a BOARD, either at the
|
||||||
* list's front or immediately after the InsertPoint.
|
* list's front or immediately after the InsertPoint.
|
||||||
* If Insertpoint == NULL, then insert at the beginning of the proper list.
|
* If Insertpoint == NULL, then insert at the beginning of the proper list.
|
||||||
* If InsertPoint != NULL, then insert immediately after InsertPoint.
|
* If InsertPoint != NULL, then insert immediately after InsertPoint.
|
||||||
* TRACKs and SEGVIAs are put on the m_Track list, SEGZONE on the m_Zone list.
|
* TRACKs and SEGVIAs are put on the m_Track list, SEGZONE on the m_Zone list.
|
||||||
|
* @param aPcb The BOARD to insert into.
|
||||||
* @param InsertPoint See above
|
* @param InsertPoint See above
|
||||||
*/
|
*/
|
||||||
void Insert( BOARD* Pcb, BOARD_ITEM* InsertPoint );
|
void Insert( BOARD* aPcb, BOARD_ITEM* InsertPoint );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetBestInsertPoint
|
* Function GetBestInsertPoint
|
||||||
* searches the "best" insertion point within the track linked list.
|
* searches the "best" insertion point within the track linked list.
|
||||||
* The best point is the of the corresponding net code section.
|
* The best point is the begging of the corresponding net code section.
|
||||||
|
* (The BOARD::m_Track and BOARD::m_Zone lists are sorted by netcode.)
|
||||||
|
* @param aPcb The BOARD to search for the insertion point.
|
||||||
* @return TRACK* - the item found in the linked list (or NULL if no track)
|
* @return TRACK* - the item found in the linked list (or NULL if no track)
|
||||||
*/
|
*/
|
||||||
TRACK* GetBestInsertPoint( BOARD* Pcb );
|
TRACK* GetBestInsertPoint( BOARD* aPcb );
|
||||||
|
|
||||||
/* Search (within the track linked list) the first segment matching the netcode
|
/* Search (within the track linked list) the first segment matching the netcode
|
||||||
* ( the linked list is always sorted by net codes )
|
* ( the linked list is always sorted by net codes )
|
||||||
|
|
|
@ -31,6 +31,14 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
|
||||||
|
|
||||||
if( Track == NULL )
|
if( Track == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if( Track->GetState(DELETED) )
|
||||||
|
{
|
||||||
|
#if defined(DEBUG)
|
||||||
|
printf("WinEDA_PcbFrame::Delete_Segment(): bug deleted already deleted TRACK\n");
|
||||||
|
#endif
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if( Track->m_Flags & IS_NEW ) // Trace en cours, on peut effacer le dernier segment
|
if( Track->m_Flags & IS_NEW ) // Trace en cours, on peut effacer le dernier segment
|
||||||
{
|
{
|
||||||
|
@ -48,7 +56,8 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* Track )
|
||||||
g_TrackSegmentCount--;
|
g_TrackSegmentCount--;
|
||||||
|
|
||||||
if( g_TwoSegmentTrackBuild )
|
if( g_TwoSegmentTrackBuild )
|
||||||
{ // g_CurrentTrackSegment->Pback must not be a via, or we want delete also the via
|
{
|
||||||
|
// g_CurrentTrackSegment->Pback must not be a via, or we want delete also the via
|
||||||
if( (g_TrackSegmentCount >= 2)
|
if( (g_TrackSegmentCount >= 2)
|
||||||
&& (g_CurrentTrackSegment->Type() != TYPEVIA)
|
&& (g_CurrentTrackSegment->Type() != TYPEVIA)
|
||||||
&& (g_CurrentTrackSegment->Pback->Type() == TYPEVIA) )
|
&& (g_CurrentTrackSegment->Pback->Type() == TYPEVIA) )
|
||||||
|
@ -132,7 +141,6 @@ void WinEDA_PcbFrame::Delete_Track( wxDC* DC, TRACK* Track )
|
||||||
Supprime_Une_Piste( DC, Track );
|
Supprime_Une_Piste( DC, Track );
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
test_1_net_connexion( DC, current_net_code );
|
test_1_net_connexion( DC, current_net_code );
|
||||||
m_Pcb->Display_Infos( this );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,45 +1,49 @@
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
/* Edition des Modules: Structures et variables de gestion des */
|
/* Edition des Modules: Structures et variables de gestion des */
|
||||||
/* fonctions de "DRAG" des segments de piste */
|
/* fonctions de "DRAG" des segments de piste */
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
/*** Class to handle a list of track segments to drag ***/
|
/*** Class to handle a list of track segments to drag ***/
|
||||||
class DRAG_SEGM
|
class DRAG_SEGM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DRAG_SEGM * Pnext; /* Pointeur de chainage */
|
DRAG_SEGM* Pnext; /* Pointeur de chainage */
|
||||||
TRACK * m_Segm; /* pointeur sur le segment a "dragger */
|
TRACK* m_Segm; /* pointeur sur le segment a "dragger */
|
||||||
D_PAD * m_Pad_Start; /* pointeur sur le Pad origine si origine segment sur pad */
|
D_PAD* m_Pad_Start; /* pointeur sur le Pad origine si origine segment sur pad */
|
||||||
D_PAD * m_Pad_End; /* pointeur sur le Pad fin si fin segment sur pad */
|
D_PAD* m_Pad_End; /* pointeur sur le Pad fin si fin segment sur pad */
|
||||||
int m_Flag; /* indicateur divers */
|
int m_Flag; /* indicateur divers */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxPoint m_StartInitialValue;
|
wxPoint m_StartInitialValue;
|
||||||
wxPoint m_EndInitialValue; /* For abort: initial m_Start and m_End values for m_Segm */
|
wxPoint m_EndInitialValue; /* For abort: initial m_Start and m_End values for m_Segm */
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DRAG_SEGM(TRACK * segm);
|
DRAG_SEGM( TRACK * segm );
|
||||||
~DRAG_SEGM();
|
~DRAG_SEGM();
|
||||||
|
|
||||||
void SetInitialValues();
|
|
||||||
|
|
||||||
|
void SetInitialValues();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Variables */
|
/* Variables */
|
||||||
|
|
||||||
eda_global DRAG_SEGM * g_DragSegmentList; /* pointe le debut de la liste
|
eda_global DRAG_SEGM* g_DragSegmentList; /* pointe le debut de la liste
|
||||||
des structures DRAG_SEGM */
|
* des structures DRAG_SEGM */
|
||||||
|
|
||||||
/* routines specifiques */
|
/* routines specifiques */
|
||||||
void Dessine_Segments_Dragges(WinEDA_DrawPanel * panel, wxDC * DC);
|
void Dessine_Segments_Dragges( WinEDA_DrawPanel* panel, wxDC* DC );
|
||||||
void Build_Drag_Liste(WinEDA_DrawPanel * panel, wxDC * DC, MODULE * Module);
|
void Build_Drag_Liste( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module );
|
||||||
void Build_1_Pad_SegmentsToDrag(WinEDA_DrawPanel * panel, wxDC * DC, D_PAD * PtPad );
|
void Build_1_Pad_SegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC, D_PAD* PtPad );
|
||||||
void Collect_TrackSegmentsToDrag(WinEDA_DrawPanel * panel, wxDC * DC,
|
void Collect_TrackSegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
wxPoint & point, int MasqueLayer, int net_code);
|
wxPoint& point, int MasqueLayer, int net_code );
|
||||||
void EraseDragListe();
|
void EraseDragListe();
|
||||||
void AddSegmentToDragList(WinEDA_DrawPanel * panel, wxDC * DC,
|
|
||||||
int flag, TRACK * Track); /* Add the segment"Track" to the drag list, and erase it from screen
|
|
||||||
flag = STARTPOINT (if the point to drag is the start point of Track) or ENDPOINT */
|
/* Add the segment"Track" to the drag list, and erase it from screen
|
||||||
|
* flag = STARTPOINT (if the point to drag is the start point of Track)
|
||||||
|
* or ENDPOINT
|
||||||
|
*/
|
||||||
|
void AddSegmentToDragList( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
int flag, TRACK* Track );
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/* Routines relatives a la gestions des pistes en "DRAG" */
|
/* Routines relatives a la gestions des pistes en "DRAG" */
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
|
|
||||||
/* Fichier dragsegm.cpp */
|
/* Fichier dragsegm.cpp */
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
@ -18,14 +18,14 @@
|
||||||
|
|
||||||
/* fonctions locales */
|
/* fonctions locales */
|
||||||
|
|
||||||
DRAG_SEGM::DRAG_SEGM(TRACK * segm)
|
DRAG_SEGM::DRAG_SEGM( TRACK* segm )
|
||||||
{
|
{
|
||||||
m_Segm = segm;
|
m_Segm = segm;
|
||||||
m_StartInitialValue = m_Segm->m_Start;
|
m_StartInitialValue = m_Segm->m_Start;
|
||||||
m_EndInitialValue = m_Segm->m_End;
|
m_EndInitialValue = m_Segm->m_End;
|
||||||
|
|
||||||
m_Pad_Start = m_Pad_End = NULL;
|
m_Pad_Start = m_Pad_End = NULL;
|
||||||
m_Flag = 0;
|
m_Flag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,172 +36,213 @@ DRAG_SEGM::~DRAG_SEGM()
|
||||||
|
|
||||||
void DRAG_SEGM::SetInitialValues()
|
void DRAG_SEGM::SetInitialValues()
|
||||||
{
|
{
|
||||||
m_Segm->m_Start = m_StartInitialValue;
|
m_Segm->m_Start = m_StartInitialValue;
|
||||||
m_Segm->m_End = m_EndInitialValue;
|
m_Segm->m_End = m_EndInitialValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
void Dessine_Segments_Dragges(WinEDA_DrawPanel * panel, wxDC * DC)
|
void Dessine_Segments_Dragges( WinEDA_DrawPanel* panel, wxDC* DC )
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/* Redraw the list of segments starting in g_DragSegmentList, while moving a footprint */
|
/* Redraw the list of segments starting in g_DragSegmentList, while moving a footprint */
|
||||||
{
|
{
|
||||||
D_PAD* pt_pad;
|
D_PAD* pt_pad;
|
||||||
TRACK * Track;
|
TRACK* Track;
|
||||||
DRAG_SEGM * pt_drag;
|
DRAG_SEGM* pt_drag;
|
||||||
|
|
||||||
if(g_DragSegmentList == NULL ) return;
|
if( g_DragSegmentList == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
pt_drag = g_DragSegmentList;
|
pt_drag = g_DragSegmentList;
|
||||||
for( ; pt_drag; pt_drag = pt_drag->Pnext)
|
for( ; pt_drag; pt_drag = pt_drag->Pnext )
|
||||||
{
|
{
|
||||||
int px, py;
|
int px, py;
|
||||||
|
|
||||||
Track = pt_drag->m_Segm;
|
Track = pt_drag->m_Segm;
|
||||||
|
|
||||||
Track->Draw(panel, DC, GR_XOR); /* effacement */
|
Track->Draw( panel, DC, GR_XOR ); // erase from screen at old position
|
||||||
|
|
||||||
pt_pad = pt_drag->m_Pad_Start;
|
pt_pad = pt_drag->m_Pad_Start;
|
||||||
if( pt_pad)
|
if( pt_pad )
|
||||||
{
|
{
|
||||||
px = pt_pad->m_Pos.x - g_Offset_Module.x;
|
px = pt_pad->m_Pos.x - g_Offset_Module.x;
|
||||||
py = pt_pad->m_Pos.y - g_Offset_Module.y;
|
py = pt_pad->m_Pos.y - g_Offset_Module.y;
|
||||||
Track->m_Start.x = px; Track->m_Start.y = py;
|
|
||||||
}
|
Track->m_Start.x = px;
|
||||||
pt_pad = pt_drag->m_Pad_End;
|
Track->m_Start.y = py;
|
||||||
if( pt_pad)
|
}
|
||||||
{
|
|
||||||
px = pt_pad->m_Pos.x - g_Offset_Module.x;
|
pt_pad = pt_drag->m_Pad_End;
|
||||||
py = pt_pad->m_Pos.y - g_Offset_Module.y;
|
if( pt_pad )
|
||||||
Track->m_End.x = px; Track->m_End.y = py;
|
{
|
||||||
}
|
px = pt_pad->m_Pos.x - g_Offset_Module.x;
|
||||||
Track->Draw(panel, DC, GR_XOR);
|
py = pt_pad->m_Pos.y - g_Offset_Module.y;
|
||||||
}
|
|
||||||
|
Track->m_End.x = px;
|
||||||
|
Track->m_End.y = py;
|
||||||
|
}
|
||||||
|
|
||||||
|
Track->Draw( panel, DC, GR_XOR );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
void Build_Drag_Liste(WinEDA_DrawPanel * panel, wxDC * DC, MODULE * Module)
|
void Build_Drag_Liste( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module )
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
/* Construit la liste des segments connectes aus pads du module Module
|
/* Construit la liste des segments connectes aus pads du module Module
|
||||||
pour le drag de ces segments
|
* pour le drag de ces segments
|
||||||
la liste est mise a l'adresse pointee par pt_drag.
|
* la liste est mise a l'adresse pointee par pt_drag.
|
||||||
la variable globale nb_drag_segment est incrementee du nombre de segments
|
* la variable globale nb_drag_segment est incrementee du nombre de segments
|
||||||
Met l'attribut EDIT sur les segments selectionnes
|
* Met l'attribut EDIT sur les segments selectionnes
|
||||||
et les affiche en mode EDIT (sketch)
|
* et les affiche en mode EDIT (sketch)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
D_PAD * pt_pad;
|
D_PAD* pt_pad;
|
||||||
|
|
||||||
pt_pad = Module->m_Pads;
|
pt_pad = Module->m_Pads;
|
||||||
for( ; pt_pad != NULL ; pt_pad = (D_PAD *) pt_pad->Pnext)
|
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
|
||||||
{
|
{
|
||||||
Build_1_Pad_SegmentsToDrag(panel, DC, pt_pad);
|
Build_1_Pad_SegmentsToDrag( panel, DC, pt_pad );
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************************/
|
/**********************************************************************************/
|
||||||
void Build_1_Pad_SegmentsToDrag(WinEDA_DrawPanel * panel, wxDC * DC, D_PAD * PtPad)
|
void Build_1_Pad_SegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC, D_PAD* PtPad )
|
||||||
/**********************************************************************************/
|
/**********************************************************************************/
|
||||||
|
|
||||||
/* Routine construisant la liste les segments de piste connectes au pad PtPad
|
/* Routine construisant la liste les segments de piste connectes au pad PtPad
|
||||||
Les net_codes sont supposes a jour.
|
* Les net_codes sont supposes a jour.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
TRACK * Track;
|
TRACK* Track;
|
||||||
int net_code = PtPad->GetNet();
|
int net_code = PtPad->GetNet();
|
||||||
int MasqueLayer;
|
int MasqueLayer;
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
BOARD * pcb = ((WinEDA_BasePcbFrame*)(panel->m_Parent))->m_Pcb;
|
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->m_Pcb;
|
||||||
|
|
||||||
Track = pcb->m_Track->GetStartNetCode(net_code);
|
Track = pcb->m_Track->GetStartNetCode( net_code );
|
||||||
|
|
||||||
pos = PtPad->m_Pos;
|
pos = PtPad->m_Pos;
|
||||||
MasqueLayer = PtPad->m_Masque_Layer;
|
MasqueLayer = PtPad->m_Masque_Layer;
|
||||||
for( ; Track != NULL; Track = (TRACK*)Track->Pnext )
|
for( ; Track; Track = Track->Next() )
|
||||||
{
|
{
|
||||||
if( Track->GetNet() != net_code ) break; /* hors zone */
|
if( Track->GetNet() != net_code )
|
||||||
if( (MasqueLayer & Track->ReturnMaskLayer()) == 0 ) continue; /* couches differentes */
|
break; /* hors zone */
|
||||||
if( pos == Track->m_Start )
|
|
||||||
{
|
if( ( MasqueLayer & Track->ReturnMaskLayer() ) == 0 )
|
||||||
AddSegmentToDragList(panel, DC, STARTPOINT, Track);
|
continue; /* couches differentes */
|
||||||
g_DragSegmentList->m_Pad_Start = PtPad;
|
|
||||||
}
|
if( pos == Track->m_Start )
|
||||||
if( pos == Track->m_End )
|
{
|
||||||
{
|
AddSegmentToDragList( panel, DC, STARTPOINT, Track );
|
||||||
AddSegmentToDragList(panel, DC, ENDPOINT, Track);
|
g_DragSegmentList->m_Pad_Start = PtPad;
|
||||||
g_DragSegmentList->m_Pad_End = PtPad;
|
}
|
||||||
}
|
|
||||||
}
|
if( pos == Track->m_End )
|
||||||
|
{
|
||||||
|
AddSegmentToDragList( panel, DC, ENDPOINT, Track );
|
||||||
|
g_DragSegmentList->m_Pad_End = PtPad;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
void AddSegmentToDragList(WinEDA_DrawPanel * panel, wxDC * DC,
|
void AddSegmentToDragList( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
int flag, TRACK * Track)
|
int flag, TRACK* Track )
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
/* Add the segment"Track" to the drag list, and erase it from screen
|
/* Add the segment"Track" to the drag list, and erase it from screen
|
||||||
flag = STARTPOINT (if the point to drag is the start point of Track) or ENDPOINT
|
* flag = STARTPOINT (if the point to drag is the start point of Track) or ENDPOINT
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DRAG_SEGM * pt_drag;
|
DRAG_SEGM* pt_drag;
|
||||||
|
|
||||||
pt_drag = new DRAG_SEGM(Track);
|
pt_drag = new DRAG_SEGM( Track );
|
||||||
pt_drag->Pnext = g_DragSegmentList;
|
|
||||||
g_DragSegmentList = pt_drag;
|
pt_drag->Pnext = g_DragSegmentList;
|
||||||
if ( (flag & STARTPOINT) ) pt_drag->m_Flag |= 1;
|
g_DragSegmentList = pt_drag;
|
||||||
if ( (flag & ENDPOINT) ) pt_drag->m_Flag |= 2;
|
|
||||||
Track->Draw(panel, DC, GR_XOR);
|
if( (flag & STARTPOINT) )
|
||||||
Track->SetState(EDIT,ON);
|
pt_drag->m_Flag |= 1;
|
||||||
if ( (flag & STARTPOINT) ) Track->m_Flags |= STARTPOINT;
|
|
||||||
if ( (flag & ENDPOINT) ) Track->m_Flags |= ENDPOINT;
|
if( (flag & ENDPOINT) )
|
||||||
Track->Draw(panel, DC, GR_XOR);
|
pt_drag->m_Flag |= 2;
|
||||||
|
|
||||||
|
Track->Draw( panel, DC, GR_XOR );
|
||||||
|
Track->SetState( EDIT, ON );
|
||||||
|
|
||||||
|
if( (flag & STARTPOINT) )
|
||||||
|
Track->m_Flags |= STARTPOINT;
|
||||||
|
|
||||||
|
if( (flag & ENDPOINT) )
|
||||||
|
Track->m_Flags |= ENDPOINT;
|
||||||
|
|
||||||
|
Track->Draw( panel, DC, GR_XOR );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************************/
|
/**********************************************************************************/
|
||||||
void Collect_TrackSegmentsToDrag(WinEDA_DrawPanel * panel, wxDC * DC,
|
void Collect_TrackSegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
wxPoint & point, int MasqueLayer, int net_code)
|
wxPoint& point, int MasqueLayer, int net_code )
|
||||||
/**********************************************************************************/
|
/**********************************************************************************/
|
||||||
|
|
||||||
/* Routine construisant la liste les segments de piste connectes a la via Via
|
/* Routine construisant la liste les segments de piste connectes a la via Via
|
||||||
Les net_codes sont supposes a jour.
|
* Les net_codes sont supposes a jour.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
TRACK * Track;
|
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->m_Pcb;
|
||||||
BOARD * pcb = ((WinEDA_BasePcbFrame*)(panel->m_Parent))->m_Pcb;
|
|
||||||
|
|
||||||
Track = pcb->m_Track->GetStartNetCode(net_code);
|
TRACK* Track = pcb->m_Track->GetStartNetCode( net_code );
|
||||||
|
for( ; Track; Track = Track->Next() )
|
||||||
for( ; Track != NULL; Track = (TRACK*)Track->Pnext )
|
{
|
||||||
{
|
if( Track->GetNet() != net_code )
|
||||||
if( Track->GetNet() != net_code ) break; /* hors zone */
|
break; /* hors zone */
|
||||||
if( (MasqueLayer & Track->ReturnMaskLayer()) == 0 ) continue; /* couches differentes */
|
|
||||||
if ( Track->m_Flags & IS_DRAGGED) continue; // already in list
|
if( ( MasqueLayer & Track->ReturnMaskLayer() ) == 0 )
|
||||||
if( Track->m_Start == point )
|
continue; /* couches differentes */
|
||||||
{
|
|
||||||
AddSegmentToDragList(panel, DC, STARTPOINT, Track);
|
if( Track->m_Flags & IS_DRAGGED )
|
||||||
}
|
continue; // already in list
|
||||||
if( Track->m_End == point )
|
|
||||||
{
|
if( Track->m_Start == point )
|
||||||
AddSegmentToDragList(panel, DC, ENDPOINT, Track);
|
{
|
||||||
}
|
AddSegmentToDragList( panel, DC, STARTPOINT, Track );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( Track->m_End == point )
|
||||||
|
{
|
||||||
|
AddSegmentToDragList( panel, DC, ENDPOINT, Track );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************/
|
/*****************************/
|
||||||
void EraseDragListe()
|
void EraseDragListe()
|
||||||
/*****************************/
|
/*****************************/
|
||||||
|
|
||||||
/* Routine de liberation memoire de la liste des structures DRAG_SEGM
|
/* Routine de liberation memoire de la liste des structures DRAG_SEGM
|
||||||
remet a zero le pointeur global g_DragSegmentList
|
* remet a zero le pointeur global g_DragSegmentList
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
DRAG_SEGM * pt_drag, * NextStruct;
|
DRAG_SEGM* pt_drag;
|
||||||
|
DRAG_SEGM* NextStruct;
|
||||||
|
|
||||||
if( g_DragSegmentList == NULL ) return;
|
if( g_DragSegmentList == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
pt_drag = g_DragSegmentList;
|
pt_drag = g_DragSegmentList;
|
||||||
for( ; pt_drag != NULL; pt_drag = NextStruct)
|
for( ; pt_drag != NULL; pt_drag = NextStruct )
|
||||||
{
|
{
|
||||||
NextStruct = pt_drag->Pnext; delete pt_drag;
|
NextStruct = pt_drag->Pnext;
|
||||||
}
|
delete pt_drag;
|
||||||
g_DragSegmentList = NULL;
|
}
|
||||||
|
|
||||||
|
g_DragSegmentList = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,14 +313,24 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
|
|
||||||
// don't let backspace delete modules!!
|
// don't let backspace delete modules!!
|
||||||
if( DrawStruct && (DrawStruct->Type() == TYPETRACK
|
if( DrawStruct && (DrawStruct->Type() == TYPETRACK
|
||||||
|| DrawStruct->Type() == TYPEVIA) )
|
|| DrawStruct->Type() == TYPEVIA) )
|
||||||
|
{
|
||||||
Delete_Segment( DC, (TRACK*) DrawStruct );
|
Delete_Segment( DC, (TRACK*) DrawStruct );
|
||||||
|
SetCurItem(NULL);
|
||||||
|
// this is an exception to the new rule that only the "selected" item
|
||||||
|
// gets its Infos displayed, but we cannot "select" a deleted item.
|
||||||
|
DrawStruct->Display_Infos(this);
|
||||||
|
}
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
}
|
}
|
||||||
else if( GetCurItem()->Type() == TYPETRACK )
|
else if( GetCurItem()->Type() == TYPETRACK )
|
||||||
{
|
{
|
||||||
// then an element is being edited - remove the last segment.
|
// then an element is being edited - remove the last segment.
|
||||||
SetCurItem( Delete_Segment( DC, (TRACK*) GetCurItem() ) );
|
Delete_Segment( DC, (TRACK*) GetCurItem() );
|
||||||
|
SetCurItem(NULL);
|
||||||
|
// this is an exception to the new rule that only the "selected" item
|
||||||
|
// gets its Infos displayed, but we cannot "select" a deleted item.
|
||||||
|
DrawStruct->Display_Infos(this);
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -385,6 +395,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
return;
|
return;
|
||||||
if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
|
if( (GetCurItem()->m_Flags & IS_NEW) == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Other_Layer_Route( (TRACK*) GetCurItem(), DC ); // place via and switch layer
|
Other_Layer_Route( (TRACK*) GetCurItem(), DC ); // place via and switch layer
|
||||||
if( DisplayOpt.ContrastModeDisplay )
|
if( DisplayOpt.ContrastModeDisplay )
|
||||||
GetScreen()->SetRefreshReq();
|
GetScreen()->SetRefreshReq();
|
||||||
|
@ -564,25 +575,33 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
|
||||||
* Delete the module.
|
* Delete the module.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bool ItemFree = (GetCurItem() == NULL )
|
bool ItemFree = (GetCurItem() == NULL ) || (GetCurItem()->m_Flags == 0);
|
||||||
|| (GetCurItem()->m_Flags == 0);
|
|
||||||
|
|
||||||
switch( m_ID_current_state )
|
switch( m_ID_current_state )
|
||||||
{
|
{
|
||||||
case ID_TRACK_BUTT:
|
case ID_TRACK_BUTT:
|
||||||
if( GetScreen()->m_Active_Layer > LAST_COPPER_LAYER )
|
if( GetScreen()->m_Active_Layer > LAST_COPPER_LAYER )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if( ItemFree )
|
if( ItemFree )
|
||||||
{
|
{
|
||||||
DrawStruct = PcbGeneralLocateAndDisplay();
|
DrawStruct = PcbGeneralLocateAndDisplay();
|
||||||
if( DrawStruct && DrawStruct->Type() != TYPETRACK )
|
if( DrawStruct && DrawStruct->Type() != TYPETRACK )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Delete_Track( DC, (TRACK*) DrawStruct );
|
Delete_Track( DC, (TRACK*) DrawStruct );
|
||||||
|
SetCurItem(NULL);
|
||||||
|
// this is an exception to the rule that only the "selected" item
|
||||||
|
// gets its Infos displayed, but we cannot "select" a deleted item.
|
||||||
|
DrawStruct->Display_Infos(this);
|
||||||
}
|
}
|
||||||
else if( GetCurItem()->Type() == TYPETRACK )
|
else if( GetCurItem()->Type() == TYPETRACK )
|
||||||
{
|
{
|
||||||
SetCurItem(
|
Delete_Segment( DC, (TRACK*) GetCurItem() );
|
||||||
Delete_Segment( DC, (TRACK*) GetCurItem() ) );
|
SetCurItem(NULL);
|
||||||
|
// this is an exception to the new rule that only the "selected" item
|
||||||
|
// gets its Infos displayed, but we cannot "select" a deleted item.
|
||||||
|
DrawStruct->Display_Infos(this);
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -594,8 +613,10 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
|
||||||
MODULE* module = Locate_Prefered_Module( m_Pcb, CURSEUR_ON_GRILLE );
|
MODULE* module = Locate_Prefered_Module( m_Pcb, CURSEUR_ON_GRILLE );
|
||||||
if( module == NULL )
|
if( module == NULL )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if( !IsOK( this, _( "Delete module?" ) ) )
|
if( !IsOK( this, _( "Delete module?" ) ) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
RemoveStruct( module, DC );
|
RemoveStruct( module, DC );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue