Commit fe504483 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: remove duplicate definitions of some flags (like EDIT and IN_EDIT)...

Pcbnew: remove duplicate definitions of some flags (like EDIT and IN_EDIT) that have exactly the same meaning, but different values... (very dangerous)
Remove obsolete code.
parent 2ce4f404
......@@ -292,13 +292,13 @@ class DHEAD;
// These define are used for the .m_Flags and .m_UndoRedoStatus member of the
// class EDA_ITEM
#define IS_CHANGED (1 << 0)
#define IS_LINKED (1 << 1)
#define IN_EDIT (1 << 2)
#define IS_MOVED (1 << 3)
#define IS_NEW (1 << 4)
#define IS_RESIZED (1 << 5)
#define IS_DRAGGED (1 << 6)
#define IS_CHANGED (1 << 0) ///< Item was edited, and modified
#define IS_LINKED (1 << 1) ///< Used in calculation to mark linked items (temporary use)
#define IN_EDIT (1 << 2) ///< Item currently edited
#define IS_MOVED (1 << 3) ///< Item being moved
#define IS_NEW (1 << 4) ///< New item, just created
#define IS_RESIZED (1 << 5) ///< Item being resized
#define IS_DRAGGED (1 << 6) ///< Item being dragged
#define IS_DELETED (1 << 7)
#define IS_WIRE_IMAGE (1 << 8)
#define STARTPOINT (1 << 9)
......@@ -311,6 +311,14 @@ class DHEAD;
#define DO_NOT_DRAW (1 << 16) ///< Used to disable draw function
#define IS_CANCELLED (1 << 17) ///< flag set when edit dialogs are canceled when editing a
///< new object
#define TRACK_LOCKED (1 << 18) ///< Pcbnew: track locked: protected from global deletion
#define TRACK_AR (1 << 19) ///< Pcbnew: autorouted track
#define FLAG1 (1 << 20) ///< Pcbnew: flag used in local computations
#define FLAG0 (1 << 21) ///< Pcbnew: flag used in local computations
#define BEGIN_ONPAD (1 << 22) ///< Pcbnew: flag set for track segment starting on a pad
#define END_ONPAD (1 << 23) ///< Pcbnew: flag set for track segment ending on a pad
#define BUSY (1 << 24) ///< Pcbnew: flag indicating that the structure has
// already been edited, in some functions
class EDA_ITEM
{
......
......@@ -16,24 +16,6 @@
#define L_ENTETE_LIB 18
#define EXT_DOC wxT( "mdc" )
#define FLAG1 (1 << 13) // flag for free local computations
#define FLAG0 (1 << 12) // flag for free local computations
#define BEGIN_ONPAD (1 << 11) // flag indicating a start of segment pad
#define END_ONPAD (1 << 10) // flag indicating an end of segment pad
#define BUSY (1 << 9) // flag indicating that the structure has
// already been edited, in some routines
#define DELETED (1 << 8) // structures erased and set string "DELETED"
#define NO_TRACE (1 << 7) // The element must not be displayed
#define SURBRILL (1 << 5) // element highlighted
#define DRAG (1 << 4) // segment in drag mode
#define EDIT (1 << 3) // element being edited
#define SEGM_FIXE (1 << 2) // segment fixed (not erase global)
#define SEGM_AR (1 << 1) // segment marked for auto routing
#define CHAIN (1 << 0) // mark segment
class NETINFO_ITEM;
class MARKER_PCB;
class RATSNEST_ITEM;
......
......@@ -13,8 +13,8 @@
/* Attribute change for 1 track segment.
* Attributes are
* SEGM_FIXE protection against global delete
* SEGM_AR AutoRouted segment
* TRACK_LOCKED protection against global delete
* TRACK_AR AutoRouted segment
*/
void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
{
......@@ -23,7 +23,7 @@ void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
OnModify();
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
track->SetState( SEGM_FIXE, Flag_On );
track->SetState( TRACK_LOCKED, Flag_On );
track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
DrawPanel->CrossHairOn( DC ); // Display cursor shape
track->DisplayInfo( this );
......@@ -45,7 +45,7 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- )
{
Track->SetState( SEGM_FIXE, Flag_On );
Track->SetState( TRACK_LOCKED, Flag_On );
Track->SetState( BUSY, OFF );
Track = Track->Next();
}
......@@ -56,7 +56,7 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
}
/* Modify the flag SEGM_FIXE according to Flag_On value,
/* Modify the flag TRACK_LOCKED according to Flag_On value,
* for all the segments related to net_code.
* if net_code < 0 all the segments are modified.
*/
......@@ -81,7 +81,7 @@ void WinEDA_PcbFrame::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
break;
OnModify();
Track->SetState( SEGM_FIXE, Flag_On );
Track->SetState( TRACK_LOCKED, Flag_On );
Track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
Track = Track->Next();
}
......
......@@ -348,9 +348,6 @@ void DIMENSION::Mirror(const wxPoint& axis_pos)
bool DIMENSION::Save( FILE* aFile ) const
{
if( GetState( DELETED ) )
return true;
bool rc = false;
// note: COTATION was the previous name of DIMENSION
// this old keyword is used here for compatibility
......
......@@ -79,9 +79,6 @@ void DRAWSEGMENT::Flip(const wxPoint& aCentre )
bool DRAWSEGMENT::Save( FILE* aFile ) const
{
if( GetState( DELETED ) )
return true;
bool rc = false;
if( fprintf( aFile, "$DRAWSEGMENT\n" ) != sizeof("$DRAWSEGMENT\n") - 1 )
......
......@@ -70,9 +70,6 @@ bool MIREPCB::ReadMirePcbDescr( LINE_READER* aReader )
bool MIREPCB::Save( FILE* aFile ) const
{
if( GetState( DELETED ) )
return true;
bool rc = false;
if( fprintf( aFile, "$MIREPCB\n" ) != sizeof("$MIREPCB\n")-1 )
......
......@@ -261,9 +261,6 @@ bool MODULE::Save( FILE* aFile ) const
char statusTxt[8];
BOARD_ITEM* item;
if( GetState( DELETED ) )
return true;
bool rc = false;
fprintf( aFile, "$MODULE %s\n", CONV_TO_UTF8( m_LibRef ) );
......
......@@ -148,9 +148,6 @@ int TEXTE_PCB::ReadTextePcbDescr( LINE_READER* aReader )
bool TEXTE_PCB::Save( FILE* aFile ) const
{
if( GetState( DELETED ) )
return true;
if( m_Text.IsEmpty() )
return true;
......
......@@ -532,9 +532,6 @@ bool TRACK::Save( FILE* aFile ) const
if( Type() == TYPE_VIA )
type = 1;
if( GetState( DELETED ) )
return true;
fprintf( aFile, "Po %d %d %d %d %d %d %d\n", m_Shape,
m_Start.x, m_Start.y, m_End.x, m_End.y, m_Width, m_Drill );
......@@ -1020,10 +1017,10 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
/* Display the State member */
msg = wxT( ". . " );
if( GetState( SEGM_FIXE ) )
if( GetState( TRACK_LOCKED ) )
msg[0] = 'F';
if( GetState( SEGM_AR ) )
if( GetState( TRACK_AR ) )
msg[2] = 'A';
frame->AppendMsgPanel( _( "Status" ), msg, MAGENTA );
......@@ -1224,22 +1221,20 @@ wxString TRACK::ShowState( int stateBits )
{
wxString ret;
if( stateBits & CHAIN )
ret << wxT( " | CHAIN" );
if( stateBits & SEGM_AR )
ret << wxT( " | SEGM_AR" );
if( stateBits & SEGM_FIXE )
ret << wxT( " | SEGM_FIXE" );
if( stateBits & EDIT )
ret << wxT( " | EDIT" );
if( stateBits & DRAG )
ret << wxT( " | DRAG" );
if( stateBits & SURBRILL )
ret << wxT( " | SURBRILL" );
if( stateBits & NO_TRACE )
ret << wxT( " | NO_TRACE" );
if( stateBits & DELETED )
ret << wxT( " | DELETED" );
if( stateBits & IS_LINKED )
ret << wxT( " | IS_LINKED" );
if( stateBits & TRACK_AR )
ret << wxT( " | TRACK_AR" );
if( stateBits & TRACK_LOCKED )
ret << wxT( " | TRACK_LOCKED" );
if( stateBits & IN_EDIT )
ret << wxT( " | IN_EDIT" );
if( stateBits & IS_DRAGGED )
ret << wxT( " | IS_DRAGGED" );
if( stateBits & DO_NOT_DRAW )
ret << wxT( " | DO_NOT_DRAW" );
if( stateBits & IS_DELETED )
ret << wxT( " | IS_DELETED" );
if( stateBits & BUSY )
ret << wxT( " | BUSY" );
if( stateBits & END_ONPAD )
......
......@@ -94,9 +94,6 @@ void ZONE_CONTAINER::SetNet( int anet_code )
bool ZONE_CONTAINER::Save( FILE* aFile ) const
/********************************************/
{
if( GetState( DELETED ) )
return true;
unsigned item_pos;
int ret;
unsigned corners_count = m_Poly->corner.size();
......
......@@ -610,7 +610,7 @@ void WinEDA_BasePcbFrame::RecalculateAllTracksNetcode( )
pt_piste = m_Pcb->m_Track;
for( ; pt_piste != NULL; pt_piste = pt_piste->Next() )
{
pt_piste->SetState( BUSY | EDIT | BEGIN_ONPAD | END_ONPAD, OFF );
pt_piste->SetState( BUSY | IN_EDIT | BEGIN_ONPAD | END_ONPAD, OFF );
pt_piste->SetZoneSubNet( 0 );
pt_piste->SetNet( 0 ); // net code = 0 means not connected
}
......
......@@ -25,12 +25,6 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
if( aTrack == NULL )
return NULL;
if( aTrack->GetState( DELETED ) )
{
D( printf( "WinEDA_PcbFrame::Delete_Segment(): bug deleted already deleted TRACK\n" ); )
return NULL;
}
if( aTrack->m_Flags & IS_NEW ) // Trace in progress, erase the last segment
{
if( g_CurrentTrackList.GetCount() > 0 )
......
......@@ -110,13 +110,13 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
{
int track_mask_filter = 0;
if( !m_TrackFilterLocked->GetValue() )
track_mask_filter |= SEGM_FIXE;
track_mask_filter |= TRACK_LOCKED;
if( !m_TrackFilterAR->GetValue() )
track_mask_filter |= SEGM_AR;
track_mask_filter |= TRACK_AR;
for( item = pcb->m_Track; item != NULL; item = nextitem )
{
nextitem = item->Next();
if( (item->GetState( SEGM_FIXE | SEGM_AR ) & track_mask_filter) != 0 )
if( (item->GetState( TRACK_LOCKED | TRACK_AR ) & track_mask_filter) != 0 )
continue;
itemPicker.m_PickedItem = item;
pickersList.PushItem( itemPicker );
......
......@@ -143,7 +143,7 @@ void AddSegmentToDragList( EDA_DRAW_PANEL* panel, wxDC* DC, int flag, TRACK* Tra
wrapper.m_Flag |= 2;
Track->Draw( panel, DC, GR_XOR );
Track->SetState( EDIT, ON );
Track->SetState( IN_EDIT, ON );
if( (flag & STARTPOINT) )
Track->m_Flags |= STARTPOINT;
......
/****************************/
/* Footprint edges editing. */
/****************************/
/*******************************/
/* Footprint outlines editing. */
/*******************************/
/**
* Functions to edit graphic items used to draw footprint edges.
......@@ -19,10 +19,10 @@
#include "module_editor_frame.h"
static void ShowEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool erase );
static void Exit_EditEdge_Module( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
int ArcValue = 900;
......@@ -43,7 +43,7 @@ void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
Edge->m_Flags |= IS_MOVED;
MoveVector.x = MoveVector.y = 0;
CursorInitialPosition = GetScreen()->GetCrossHairPosition();
DrawPanel->SetMouseCapture( Move_Segment, Exit_EditEdge_Module );
DrawPanel->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline );
SetCurItem( Edge );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
}
......@@ -72,8 +72,10 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge )
}
/* Move and redraw the current edited graphic item when mouse is moving */
static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
/* Redraw the current moved graphic item when mouse is moving
* Use this function to show an existing outline, in move command
*/
static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
{
BASE_SCREEN* screen = aPanel->GetScreen();
EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem();
......@@ -96,9 +98,10 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
}
/* Redraw the current edited (moved) graphic item
/* Redraw the current graphic item during its creation
* Use this function to show a new outline, in begin command
*/
static void ShowEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
BASE_SCREEN* screen = aPanel->GetScreen();
......@@ -267,22 +270,24 @@ void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge )
}
/* abort function in moving edge.
/* abort function in moving outline.
*/
static void Exit_EditEdge_Module( EDA_DRAW_PANEL* Panel, wxDC* DC )
static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
EDGE_MODULE* Edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem();
Panel->SetMouseCapture( NULL, NULL );
if( Edge && ( Edge->Type() == TYPE_EDGE_MODULE ) )
{
if( Edge->m_Flags & IS_NEW ) /* Delete if new module. */
if( Edge->m_Flags & IS_NEW ) // On aborting, delete new outline.
{
MODULE* Module = (MODULE*) Edge->GetParent();
Edge->Draw( Panel, DC, GR_XOR, MoveVector );
Edge->DeleteStructure();
Module->Set_Rectangle_Encadrement();
}
else
else // On aborting, move existing outline to its initial position.
{
Edge->Draw( Panel, DC, GR_XOR, MoveVector );
Edge->m_Flags = 0;
......@@ -350,11 +355,11 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge->m_End0 = Edge->m_Start0;
module->Set_Rectangle_Encadrement();
DrawPanel->SetMouseCapture( ShowEdgeModule, Exit_EditEdge_Module );
DrawPanel->SetMouseCapture( ShowNewEdgeModule, Abort_Move_ModuleOutline );
}
/* Segment creation in progress.
* The ending coordinate are updated by the function
* Montre_Position_New_Edge_Module() called on move mouse event
* The ending coordinate is updated by the function
* ShowNewEdgeModule() called on move mouse event
* during the segment craetion
*/
else
......
......@@ -14,7 +14,7 @@
#include "protos.h"
static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Montre_Position_NewSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase );
static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
......@@ -34,7 +34,7 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
drawitem->m_Flags |= IS_MOVED;
s_InitialPosition = s_LastPosition = GetScreen()->GetCrossHairPosition();
drawitem->DisplayInfo( this );
DrawPanel->SetMouseCapture( Move_Segment, Exit_EditEdge );
DrawPanel->SetMouseCapture( Move_Segment, Abort_EditEdge );
SetCurItem( drawitem );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
}
......@@ -48,12 +48,12 @@ void WinEDA_PcbFrame::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
if( drawitem == NULL )
return;
drawitem->m_Flags = 0;
SaveCopyInUndoList(drawitem, UR_MOVED, s_LastPosition - s_InitialPosition);
drawitem->Draw( DrawPanel, DC, GR_OR );
DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
OnModify();
drawitem->m_Flags = 0;
}
/*
......@@ -63,13 +63,10 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
bool aErase )
{
DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
int t_fill = DisplayOpt.DisplayDrawItems;
if( Segment == NULL )
return;
DisplayOpt.DisplayDrawItems = SKETCH;
if( aErase )
Segment->Draw( aPanel, aDC, GR_XOR );
......@@ -80,7 +77,6 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
s_LastPosition = aPanel->GetScreen()->GetCrossHairPosition();
Segment->Draw( aPanel, aDC, GR_XOR );
DisplayOpt.DisplayDrawItems = t_fill;
}
......@@ -169,12 +165,15 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( int aLayer )
}
static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
DRAWSEGMENT* Segment = (DRAWSEGMENT*) Panel->GetScreen()->GetCurItem();
if( Segment == NULL )
{
Panel->SetMouseCapture( NULL, NULL );
return;
}
if( Segment->m_Flags & IS_NEW )
{
......@@ -192,6 +191,7 @@ static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
Segment->Draw( Panel, DC, GR_OR );
}
Panel->SetMouseCapture( NULL, NULL );
( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL );
}
......@@ -223,7 +223,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
Segment->m_Shape = shape;
Segment->m_Angle = 900;
Segment->m_Start = Segment->m_End = GetScreen()->GetCrossHairPosition();
DrawPanel->SetMouseCapture( Montre_Position_NewSegment, Exit_EditEdge );
DrawPanel->SetMouseCapture( Montre_Position_NewSegment, Abort_EditEdge );
}
else /* The ending point ccordinate Segment->m_End was updated by he function
* Montre_Position_NewSegment() called on a move mouse event
......
......@@ -473,7 +473,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
g_HighLight_NetCode = adr_buf->GetNet();
/* Possible establishment of a hanging point. */
LockPoint = CreateLockPoint( GetBoard(),
LockPoint = CreateLockPoint( GetBoard(),
g_CurrentTrackSegment->m_End,
adr_buf,
&s_ItemsListPicker );
......@@ -556,7 +556,7 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi
{
if( track->Type() == TYPE_TRACK ) // skip vias
{
if( track->GetState( BUSY | DELETED ) )
if( track->GetState( BUSY | IS_DELETED ) )
continue;
if( aLayer != track->GetLayer() )
......
......@@ -35,7 +35,7 @@ TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer )
if( track->m_Start != pos )
continue;
if( track->GetState( BUSY | DELETED ) )
if( track->GetState( BUSY | IS_DELETED ) )
continue;
if( layer < 0 )
......@@ -61,7 +61,7 @@ TRACK* Locate_Via_Area( TRACK* aStart, const wxPoint& pos, int layer )
if( !track->HitTest(pos) )
continue;
if( track->GetState( BUSY | DELETED ) )
if( track->GetState( BUSY | IS_DELETED ) )
continue;
if( layer < 0 )
......@@ -327,7 +327,7 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base, TRACK* pt_lim,
if( PtSegmN )
{
if( PtSegmN->GetState( BUSY | DELETED ) )
if( PtSegmN->GetState( BUSY | IS_DELETED ) )
goto suite;
if( PtSegmN == PtRefSegm )
......@@ -357,7 +357,7 @@ suite:
if( PtSegmB )
{
if( PtSegmB->GetState( BUSY | DELETED ) )
if( PtSegmB->GetState( BUSY | IS_DELETED ) )
goto suite1;
if( PtSegmB == PtRefSegm )
......@@ -389,7 +389,7 @@ suite1:
/* General search. */
for( PtSegmN = pt_base; PtSegmN != NULL; PtSegmN = PtSegmN->Next() )
{
if( PtSegmN->GetState( DELETED | BUSY ) )
if( PtSegmN->GetState( IS_DELETED | BUSY ) )
{
if( PtSegmN == pt_lim )
break;
......@@ -438,11 +438,11 @@ TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos,
{
int layer = track->GetLayer();
if( track->GetState( BUSY | DELETED ) )
if( track->GetState( BUSY | IS_DELETED ) )
{
// D( printf( "track %p is BUSY | DELETED. BUSY=%d DELETED=%d\n",
// D( printf( "track %p is BUSY | IS_DELETED. BUSY=%d IS_DELETED=%d\n",
// track, track->GetState( BUSY ),
// track->GetState( DELETED ) );)
// track->GetState( IS_DELETED ) );)
continue;
}
......@@ -524,7 +524,7 @@ D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int masque_
* Data on layers by masklayer
* Research is done to address start_adr has end_adr
* If end_adr = NULL, end search list
* The segments of track marks with the flag are not DELETED or taken
* The segments of track marks with the flag are not IS_DELETED or taken
* into account
*/
TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr, const wxPoint& ref_pos, int MaskLayer )
......@@ -536,7 +536,7 @@ TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr, const wxPoint& ref_p
for( PtSegm = start_adr; PtSegm != NULL; PtSegm = PtSegm->Next() )
{
if( PtSegm->GetState( DELETED | BUSY ) == 0 )
if( PtSegm->GetState( IS_DELETED | BUSY ) == 0 )
{
if( ref_pos == PtSegm->m_Start )
{
......@@ -562,7 +562,7 @@ TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr, const wxPoint& ref_p
/* Locates via through the point x, y, on layer data by masklayer.
* Search is done to address start_adr has end_adr.
* If end_adr = NULL, end search list
* Vias whose parameter has the State or DELETED bit BUSY = 1 are ignored
* Vias whose parameter has the State or IS_DELETED bit BUSY = 1 are ignored
*/
TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, const wxPoint& pos, int MaskLayer )
{
......@@ -574,7 +574,7 @@ TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, const wxPoint& pos, in
{
if( pos == PtSegm->m_Start )
{
if( PtSegm->GetState( BUSY | DELETED ) == 0 )
if( PtSegm->GetState( BUSY | IS_DELETED ) == 0 )
{
if( MaskLayer & PtSegm->ReturnMaskLayer() )
return PtSegm;
......
......@@ -89,7 +89,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
TRACK* segm = g_DragSegmentList[ii].m_Segm;
itemWrapper.m_PickedItem = segm;
itemWrapper.m_Link = segm->Copy();
itemWrapper.m_Link->SetState( EDIT, OFF );
itemWrapper.m_Link->SetState( IN_EDIT, OFF );
s_PickedList.PushItem( itemWrapper );
}
}
......@@ -147,7 +147,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{
pt_segm = g_DragSegmentList[ii].m_Segm;
pt_segm->SetState( EDIT, OFF );
pt_segm->SetState( IN_EDIT, OFF );
g_DragSegmentList[ii].SetInitialValues();
pt_segm->Draw( Panel, DC, GR_OR );
}
......@@ -290,7 +290,7 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* aModule,
/* Remove module from list, and put it in undo command list */
m_Pcb->m_Modules.Remove( aModule );
aModule->SetState( DELETED, ON );
aModule->SetState( IS_DELETED, ON );
SaveCopyInUndoList( aModule, UR_DELETED );
if( aDC && GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
......@@ -439,7 +439,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{
pt_segm = g_DragSegmentList[ii].m_Segm;
pt_segm->SetState( EDIT, OFF );
pt_segm->SetState( IN_EDIT, OFF );
if( DC )
pt_segm->Draw( DrawPanel, DC, GR_OR );
......
......@@ -43,7 +43,7 @@ static void Abort_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
TRACK* Track = g_DragSegmentList[ii].m_Segm;
Track->Draw( Panel, DC, GR_XOR );
Track->SetState( EDIT, OFF );
Track->SetState( IN_EDIT, OFF );
g_DragSegmentList[ii].SetInitialValues();
Track->Draw( Panel, DC, GR_OR );
}
......@@ -356,7 +356,7 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
if( g_DragSegmentList[ii].m_Pad_End )
Track->m_End = Pad->m_Pos;
Track->SetState( EDIT, OFF );
Track->SetState( IN_EDIT, OFF );
if( DC )
Track->Draw( DrawPanel, DC, GR_OR );
}
......
......@@ -114,7 +114,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
TRACK* Track = g_DragSegmentList[jj].m_Segm;
g_DragSegmentList[jj].SetInitialValues();
Track->SetState( EDIT, OFF );
Track->SetState( IN_EDIT, OFF );
Track->m_Flags = 0;
Track->Draw( Panel, DC, GR_OR );
}
......@@ -997,14 +997,14 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
// DRC Ok: place track segments
Track->m_Flags = 0;
Track->SetState( EDIT, OFF );
Track->SetState( IN_EDIT, OFF );
Track->Draw( DrawPanel, DC, draw_mode );
/* Draw dragged tracks */
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{
Track = g_DragSegmentList[ii].m_Segm;
Track->SetState( EDIT, OFF );
Track->SetState( IN_EDIT, OFF );
Track->m_Flags = 0;
Track->Draw( DrawPanel, DC, draw_mode );
......
......@@ -525,7 +525,7 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
track_mnu->Append( ID_POPUP_PCB_LOCK_ON_TRACKSEG, _( "Locked: Yes" ), wxEmptyString, true );
track_mnu->Append( ID_POPUP_PCB_LOCK_OFF_TRACKSEG, _( "Locked: No" ), wxEmptyString, true );
if( Track->GetState( SEGM_FIXE ) )
if( Track->GetState( TRACK_LOCKED ) )
track_mnu->Check( ID_POPUP_PCB_LOCK_ON_TRACKSEG, true );
else
track_mnu->Check( ID_POPUP_PCB_LOCK_OFF_TRACKSEG, true );
......
......@@ -31,22 +31,11 @@
#define DIM_ANCRE_TEXTE 2 /* Anchor size (Text centre) */
#define TEXTS_MIN_SIZE 50 // Min size in pcbnew units value (50 * 0.0001 mils)
#define TEXTS_MAX_SIZE 100000 // Min size in pcbnew units value (1 inch) )
#define TEXTS_MAX_SIZE 10000 // Min size in pcbnew units value (1 inch) )
#define TEXTS_MAX_WIDTH 5000 // Max width in pcbnew units value (0.5 inches)
/* Used in Zoom menu */
#define ZOOM_PLUS -1
#define ZOOM_MOINS -2
#define ZOOM_AUTO -3
#define ZOOM_CENTER -4
#define ZOOM_REDRAW -5
/* Flag to force the SKETCH mode to display items (.flags member) */
#define FORCE_SKETCH (DRAG | EDIT )
/* Flags used in read board file */
#define APPEND_PCB 1 /* used to append the new board to the existing board */
#define NEWPCB 0 /* used for normal load file */
/* Flag to force the SKETCH mode to display items (.m_Flags member) */
#define FORCE_SKETCH ( IS_DRAGGED | IN_EDIT )
/* variables */
extern bool Drc_On;
......
......@@ -1115,7 +1115,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackList.PushBack( newTrack );
g_CurrentTrackSegment->SetState( SEGM_AR, ON );
g_CurrentTrackSegment->SetState( TRACK_AR, ON );
g_CurrentTrackSegment->SetLayer( 0x0F );
g_CurrentTrackSegment->m_Start.x =
......@@ -1141,7 +1141,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
if( side == TOP )
g_CurrentTrackSegment->SetLayer( Route_Layer_TOP );
g_CurrentTrackSegment->SetState( SEGM_AR, ON );
g_CurrentTrackSegment->SetState( TRACK_AR, ON );
g_CurrentTrackSegment->m_End.x = pcb->m_BoundaryBox.m_Pos.x +
( g_GridRoutingSize * row );
g_CurrentTrackSegment->m_End.y = pcb->m_BoundaryBox.m_Pos.y +
......
......@@ -87,9 +87,9 @@ int WinEDA_PcbFrame::EraseRedundantTrack(
/* Flags for cleaning the net. */
for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() )
{
//D( printf( "track %p turning off BUSY | EDIT | CHAIN\n", pt_del ); )
D( std::cout<<"track "<<pt_del<<" turning off BUSY | EDIT | CHAIN"<<std::endl; )
pt_del->SetState( BUSY | EDIT | CHAIN, OFF );
//D( printf( "track %p turning off BUSY | IN_EDIT | IS_LINKED\n", pt_del ); )
D( std::cout<<"track "<<pt_del<<" turning off BUSY | IN_EDIT | IS_LINKED"<<std::endl; )
pt_del->SetState( BUSY | IN_EDIT | IS_LINKED, OFF );
if( pt_del == BufEnd ) // Last segment reached
break;
}
......@@ -137,7 +137,7 @@ int WinEDA_PcbFrame::EraseRedundantTrack(
/* Mark as deleted a new track (which is not involved in the search for
* other connections)
*/
ListSetState( aNewTrack, aNewTrackSegmentsCount, DELETED, ON );
ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, ON );
/* A segment must be connected to the starting point, otherwise
* it is unnecessary to analyze the other point
......@@ -147,7 +147,7 @@ int WinEDA_PcbFrame::EraseRedundantTrack(
if( pt_segm == NULL ) /* Not connected to the track starting point. */
{
/* Clear the delete flag. */
ListSetState( aNewTrack, aNewTrackSegmentsCount, DELETED, OFF );
ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, OFF );
return 0;
}
......@@ -163,9 +163,9 @@ int WinEDA_PcbFrame::EraseRedundantTrack(
if( pt_segm->Type() != TYPE_VIA )
{
if( pt_segm->GetState( CHAIN ) == 0 )
if( pt_segm->GetState( IS_LINKED ) == 0 )
{
pt_segm->SetState( CHAIN, ON );
pt_segm->SetState( IS_LINKED, ON );
nbconnect++;
}
}
......@@ -180,7 +180,7 @@ int WinEDA_PcbFrame::EraseRedundantTrack(
/* Clear used flags */
for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() )
{
pt_del->SetState( BUSY | DELETED | EDIT | CHAIN, OFF );
pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF );
if( pt_del == BufEnd ) // Last segment reached
break;
}
......@@ -191,22 +191,22 @@ int WinEDA_PcbFrame::EraseRedundantTrack(
/* Mark trace as edited (which does not involve searching for other
* tracks)
*/
ListSetState( aNewTrack, aNewTrackSegmentsCount, DELETED, OFF );
ListSetState( aNewTrack, aNewTrackSegmentsCount, EDIT, ON );
ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, OFF );
ListSetState( aNewTrack, aNewTrackSegmentsCount, IN_EDIT, ON );
/* Test all marked segments. */
while( nbconnect )
{
for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() )
{
if( pt_del->GetState( CHAIN ) )
if( pt_del->GetState( IS_LINKED ) )
break;
if( pt_del == BufEnd ) // Last segment reached
break;
}
nbconnect--;
pt_del->SetState( CHAIN, OFF );
pt_del->SetState( IS_LINKED, OFF );
pt_del = Marque_Une_Piste( GetBoard(), pt_del, &nb_segm, NULL, true );
......@@ -246,13 +246,13 @@ int WinEDA_PcbFrame::EraseRedundantTrack(
for( pt_del = m_Pcb->m_Track; pt_del != NULL;
pt_del = pt_del->Next() )
{
if( pt_del->GetState( EDIT ) )
if( pt_del->GetState( IN_EDIT ) )
{
pt_del->SetState( EDIT, OFF );
pt_del->SetState( IN_EDIT, OFF );
if( aDC )
pt_del->Draw( DrawPanel, aDC, GR_OR );
}
pt_del->SetState( EDIT | CHAIN, OFF );
pt_del->SetState( IN_EDIT | IS_LINKED, OFF );
}
return 1;
......@@ -267,7 +267,7 @@ int WinEDA_PcbFrame::EraseRedundantTrack(
/* Clear used flags */
for( pt_del = m_Pcb->m_Track; pt_del; pt_del = pt_del->Next() )
{
pt_del->SetState( BUSY | DELETED | EDIT | CHAIN, OFF );
pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF );
if( pt_del == BufEnd ) // Last segment reached
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment