Pcbnew: Added: Option to show the via area while creating a new track. Better code.

This commit is contained in:
charras 2009-06-18 20:51:01 +00:00
parent 360eda0f3c
commit e877819945
18 changed files with 481 additions and 451 deletions

View File

@ -9,7 +9,7 @@ email address.
++Pcbnew: ++Pcbnew:
Added: in DRC tests: tests for vias min size and tracks min width. Added: in DRC tests: tests for vias min size and tracks min width.
Added: Option to show the via area while creating a new track. Added: Option to show the via area while creating a new track.
Useful in compact designs to know hos to place a via during track creation. Useful in compact designs to know how to place a via during track creation.
2009-june-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2009-june-11 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================

View File

@ -59,7 +59,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_MENU( ID_COLORS_SETUP, WinEDA_GerberFrame::Process_Config ) EVT_MENU( ID_COLORS_SETUP, WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_GerberFrame::Process_Config ) EVT_MENU( ID_OPTIONS_SETUP, WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_PCB_LOOK_SETUP, WinEDA_GerberFrame::Process_Config ) EVT_MENU( ID_PCB_DISPLAY_OPTIONS_SETUP, WinEDA_GerberFrame::Process_Config )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage ) WinEDA_DrawFrame::SetLanguage )

View File

@ -51,7 +51,7 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
} }
case ID_PCB_TRACK_SIZE_SETUP: case ID_PCB_TRACK_SIZE_SETUP:
case ID_PCB_LOOK_SETUP: case ID_PCB_DISPLAY_OPTIONS_SETUP:
case ID_OPTIONS_SETUP: case ID_OPTIONS_SETUP:
InstallPcbOptionsFrame( pos, id ); InstallPcbOptionsFrame( pos, id );
break; break;

View File

@ -28,7 +28,7 @@ void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer)
DisplayOpt.DisplayPadNoConn = 0; DisplayOpt.DisplayPadNoConn = 0;
DisplayOpt.DisplayPadIsol = 0; DisplayOpt.DisplayPadIsol = 0;
DisplayOpt.DisplayPcbTrackFill = FILLED; DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.DisplayTrackIsol = 0; DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED; DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0; DisplayOpt.DisplayZonesMode = 0;

View File

@ -390,7 +390,7 @@ void WinEDA_GerberFrame::InstallPcbOptionsFrame( const wxPoint& pos, int id )
{ {
switch( id ) switch( id )
{ {
case ID_PCB_LOOK_SETUP: case ID_PCB_DISPLAY_OPTIONS_SETUP:
{ {
WinEDA_LookFrame* OptionsFrame = WinEDA_LookFrame* OptionsFrame =
new WinEDA_LookFrame( this, pos ); new WinEDA_LookFrame( this, pos );

View File

@ -87,7 +87,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
ADD_MENUITEM_WITH_HELP( configmenu, ID_OPTIONS_SETUP, _( "&Options" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_OPTIONS_SETUP, _( "&Options" ),
_( " Select general options" ), preference_xpm ); _( " Select general options" ), preference_xpm );
ADD_MENUITEM_WITH_HELP( configmenu, ID_PCB_LOOK_SETUP, _( "Display" ), ADD_MENUITEM_WITH_HELP( configmenu, ID_PCB_DISPLAY_OPTIONS_SETUP, _( "Display" ),
_( " Select how items are displayed" ), _( " Select how items are displayed" ),
display_options_xpm ); display_options_xpm );

View File

@ -43,7 +43,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
DisplayOpt.DisplayModEdge = FILLED; DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayModText = FILLED; DisplayOpt.DisplayModText = FILLED;
DisplayOpt.DisplayPcbTrackFill = FILLED; DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.DisplayTrackIsol = 0; DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED; DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0; DisplayOpt.DisplayZonesMode = 0;
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch; DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;

View File

@ -268,6 +268,17 @@ public:
#include "class_marker.h" #include "class_marker.h"
#include "class_zone.h" #include "class_zone.h"
/* Values for DISPLAY_OPTIONS.ShowTrackClearanceMode parameter option
* This parameter controls how to show tracks and vias clerance area
*/
enum ShowTrackClearanceModeList {
DO_NOT_SHOW_CLEARANCE = 0, // Do not show clearance areas
SHOW_CLEARANCE_NEW_TRACKS, // Show clearance areas only for new track during track creation
SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS, /* Show clrearance areas only for new track during track creation,
* and shows a via clearnce area at end of current new segment (guide to place a nev via
*/
SHOW_CLEARANCE_ALWAYS // Show Always clearance areas for track and vias
};
class DISPLAY_OPTIONS class DISPLAY_OPTIONS
{ {
@ -279,10 +290,15 @@ public:
int DisplayModEdge; int DisplayModEdge;
int DisplayModText; int DisplayModText;
bool DisplayPcbTrackFill; /* FALSE = sketch , TRUE = filled */ bool DisplayPcbTrackFill; /* FALSE = sketch , TRUE = filled */
bool DisplayTrackIsol; int ShowTrackClearanceMode; /* = 0 , 1 or 2
* 0 = do not show clearance
* 1 = show track clearance
* 2 = show clearance + via area
* (useful to know what clearance area is neede if we want to put a via on terminal track point)
*/
int m_DisplayViaMode; /* 0 do not show via hole, int m_DisplayViaMode; /* 0 do not show via hole,
* 1 show via hole for non default value * 1 show via hole for non default value
* 2 show all via hole */ * 2 show all via hole */

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,7 @@ static bool ShowClearance( const TRACK* aTrack )
{ {
// maybe return true for tracks and vias, not for zone segments // maybe return true for tracks and vias, not for zone segments
return !(aTrack->m_Flags & DRAW_ERASED) return !(aTrack->m_Flags & DRAW_ERASED)
&& DisplayOpt.DisplayTrackIsol && DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS
&& aTrack->GetLayer() <= LAST_COPPER_LAYER && aTrack->GetLayer() <= LAST_COPPER_LAYER
&& ( aTrack->Type() == TYPE_TRACK || aTrack->Type() == TYPE_VIA ); && ( aTrack->Type() == TYPE_TRACK || aTrack->Type() == TYPE_VIA );
} }
@ -764,7 +764,7 @@ void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoi
} }
} }
if( DisplayOpt.DisplayTrackIsol ) if( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS )
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
rayon + g_DesignSettings.m_TrackClearence, color ); rayon + g_DesignSettings.m_TrackClearence, color );

View File

@ -143,12 +143,12 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS()
DisplayModEdge = true; DisplayModEdge = true;
DisplayModText = true; DisplayModText = true;
DisplayPcbTrackFill = true; /* false = sketch , true = rempli */ DisplayPcbTrackFill = true; /* false = sketch , true = filled */
DisplayTrackIsol = false; ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
m_DisplayViaMode = VIA_HOLE_NOT_SHOW; m_DisplayViaMode = VIA_HOLE_NOT_SHOW;
DisplayPolarCood = false; /* false = display absolute coordinates, DisplayPolarCood = false; /* false = display absolute coordinates,
* true = display polar cordinates */ * true = display polar cordinates */
DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones, DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones,
* 1 = do not show filled areas outlines * 1 = do not show filled areas outlines
* 2 = show outlines of filled areas */ * 2 = show outlines of filled areas */

View File

@ -60,13 +60,22 @@ void Dialog_Display_Options::init()
if ( DisplayOpt.DisplayPcbTrackFill ) if ( DisplayOpt.DisplayPcbTrackFill )
m_OptDisplayTracks->SetSelection(1); m_OptDisplayTracks->SetSelection(1);
if ( DisplayOpt.DisplayTrackIsol ) switch ( DisplayOpt.ShowTrackClearanceMode )
m_OptDisplayTracksClearance->SetSelection(3); {
else if ( g_ShowClearanceWhenTrackCreation == 1) case DO_NOT_SHOW_CLEARANCE:
m_OptDisplayTracksClearance->SetSelection(1); m_OptDisplayTracksClearance->SetSelection(0);
else if ( g_ShowClearanceWhenTrackCreation == 2) break;
m_OptDisplayTracksClearance->SetSelection(2); case SHOW_CLEARANCE_NEW_TRACKS:
else m_OptDisplayTracksClearance->SetSelection(0); m_OptDisplayTracksClearance->SetSelection(1);
break;
default:
case SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS:
m_OptDisplayTracksClearance->SetSelection(2);
break;
case SHOW_CLEARANCE_ALWAYS:
m_OptDisplayTracksClearance->SetSelection(3);
break;
}
if ( DisplayOpt.DisplayPadFill ) if ( DisplayOpt.DisplayPadFill )
m_OptDisplayPads->SetSelection(1); m_OptDisplayPads->SetSelection(1);
@ -115,21 +124,17 @@ void Dialog_Display_Options::OnOkClick(wxCommandEvent& event)
switch ( m_OptDisplayTracksClearance->GetSelection() ) switch ( m_OptDisplayTracksClearance->GetSelection() )
{ {
case 3: case 0:
DisplayOpt.DisplayTrackIsol = TRUE; DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
g_ShowClearanceWhenTrackCreation = 1;
break; break;
case 1: case 1:
DisplayOpt.DisplayTrackIsol = FALSE; DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS;
g_ShowClearanceWhenTrackCreation = 1;
break; break;
case 2: case 2:
DisplayOpt.DisplayTrackIsol = FALSE; DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
g_ShowClearanceWhenTrackCreation = 2;
break; break;
case 0: case 3:
DisplayOpt.DisplayTrackIsol = FALSE; DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
g_ShowClearanceWhenTrackCreation = 0;
break; break;
} }

View File

@ -16,15 +16,14 @@
#include "trigo.h" #include "trigo.h"
/* Routines Locales */ /* Routines Locales */
static void Exit_Editrack( WinEDA_DrawPanel* panel, wxDC* DC ); static void Exit_Editrack( WinEDA_DrawPanel* panel, wxDC* DC );
void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC, bool erase ); wxDC* DC, bool erase );
static void ComputeBreakPoint( TRACK* track, int n, wxPoint end ); static void ComputeBreakPoint( TRACK* track, int n, wxPoint end );
static void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList ); static void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList );
static void EnsureEndTrackOnPad( D_PAD* Pad ); static void EnsureEndTrackOnPad( D_PAD* Pad );
/* variables locales */ /* variables locales */
static int OldNetCodeSurbrillance; static int OldNetCodeSurbrillance;
@ -83,14 +82,14 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
* - si DRC OK : addition d'un nouveau point piste * - si DRC OK : addition d'un nouveau point piste
*/ */
{ {
D_PAD* pt_pad = NULL; D_PAD* pt_pad = NULL;
TRACK* TrackOnStartPoint = NULL; TRACK* TrackOnStartPoint = NULL;
int masquelayer = g_TabOneLayerMask[((PCB_SCREEN*)GetScreen())->m_Active_Layer]; int masquelayer = g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
BOARD_ITEM* LockPoint; BOARD_ITEM* LockPoint;
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->m_Curseur;
static int InitialTrackWidthValue; /* first track segment width. static int InitialTrackWidthValue; /* first track segment width.
* used when we are in the auto tack width mode */ * used when we are in the auto tack width mode */
DrawPanel->ManageCurseur = ShowNewTrackWhenMovingCursor; DrawPanel->ManageCurseur = ShowNewTrackWhenMovingCursor;
DrawPanel->ForceCloseManageCurseur = Exit_Editrack; DrawPanel->ForceCloseManageCurseur = Exit_Editrack;
@ -131,10 +130,11 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
CreateLockPoint( &pos.x, &pos.y, TrackOnStartPoint, NULL ); CreateLockPoint( &pos.x, &pos.y, TrackOnStartPoint, NULL );
} }
} }
else // no starting point, but a filled zone area can exist. This is also a good starting point. else // no starting point, but a filled zone area can exist. This is also a good starting point.
{ {
ZONE_CONTAINER* zone = GetBoard()->HitTestForAnyFilledArea( pos, GetScreen()->m_Active_Layer ); ZONE_CONTAINER* zone = GetBoard()->HitTestForAnyFilledArea( pos,
GetScreen()->
m_Active_Layer );
if( zone ) if( zone )
g_HightLigth_NetCode = zone->GetNet(); g_HightLigth_NetCode = zone->GetNet();
} }
@ -147,7 +147,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
Hight_Light( DC ); Hight_Light( DC );
g_CurrentTrackSegment->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth; g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( g_DesignSettings.m_UseConnectedTrackWidth ) if( g_DesignSettings.m_UseConnectedTrackWidth )
@ -259,7 +259,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
newTrack->m_Start = newTrack->m_End; newTrack->m_Start = newTrack->m_End;
newTrack->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); newTrack->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
if( !g_DesignSettings.m_UseConnectedTrackWidth ) if( !g_DesignSettings.m_UseConnectedTrackWidth )
{ {
@ -294,8 +294,8 @@ bool WinEDA_PcbFrame::Add_45_degrees_Segment( wxDC* DC )
* 0 si impossible * 0 si impossible
*/ */
{ {
int pas_45; int pas_45;
int dx0, dy0, dx1, dy1; int dx0, dy0, dx1, dy1;
if( g_CurrentTrackList.GetCount() < 2 ) if( g_CurrentTrackList.GetCount() < 2 )
return false; /* il faut au moins 2 segments */ return false; /* il faut au moins 2 segments */
@ -309,9 +309,9 @@ bool WinEDA_PcbFrame::Add_45_degrees_Segment( wxDC* DC )
return false; return false;
} }
pas_45 = (int)GetScreen()->GetGrid().x / 2; pas_45 = (int) GetScreen()->GetGrid().x / 2;
if( pas_45 < curTrack->m_Width ) if( pas_45 < curTrack->m_Width )
pas_45 = (int)GetScreen()->GetGrid().x; pas_45 = (int) GetScreen()->GetGrid().x;
while( pas_45 < curTrack->m_Width ) while( pas_45 < curTrack->m_Width )
pas_45 *= 2; pas_45 *= 2;
@ -420,7 +420,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
* Routine de fin de trace d'une piste (succession de segments) * Routine de fin de trace d'une piste (succession de segments)
*/ */
{ {
int masquelayer = g_TabOneLayerMask[((PCB_SCREEN*)GetScreen())->m_Active_Layer]; int masquelayer = g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
if( aTrack == NULL ) if( aTrack == NULL )
return; return;
@ -441,12 +441,12 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
trace_ratsnest_pad( DC ); /* efface trace chevelu*/ trace_ratsnest_pad( DC ); /* efface trace chevelu*/
/* cleanup /* cleanup
if( g_CurrentTrackSegment->Next() != NULL ) * if( g_CurrentTrackSegment->Next() != NULL )
{ * {
delete g_CurrentTrackSegment->Next(); * delete g_CurrentTrackSegment->Next();
g_CurrentTrackSegment->SetNext( NULL ); * g_CurrentTrackSegment->SetNext( NULL );
} * }
*/ */
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
@ -485,14 +485,14 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
// Insert new segments if they exist. This can be NULL on a double click on the start point // Insert new segments if they exist. This can be NULL on a double click on the start point
if( g_FirstTrackSegment != NULL ) if( g_FirstTrackSegment != NULL )
{ {
int netcode = g_FirstTrackSegment->GetNet(); int netcode = g_FirstTrackSegment->GetNet();
TRACK* firstTrack = g_FirstTrackSegment; TRACK* firstTrack = g_FirstTrackSegment;
int newCount = g_CurrentTrackList.GetCount(); int newCount = g_CurrentTrackList.GetCount();
// Put entire new current segment list in BOARD // Put entire new current segment list in BOARD
TRACK* track; TRACK* track;
TRACK* insertBeforeMe = g_CurrentTrackSegment->GetBestInsertPoint( GetBoard() ); TRACK* insertBeforeMe = g_CurrentTrackSegment->GetBestInsertPoint( GetBoard() );
while( (track = g_CurrentTrackList.PopFront()) != NULL ) while( ( track = g_CurrentTrackList.PopFront() ) != NULL )
{ {
GetBoard()->m_Track.Insert( track, insertBeforeMe ); GetBoard()->m_Track.Insert( track, insertBeforeMe );
} }
@ -502,7 +502,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
Trace_Une_Piste( DrawPanel, DC, firstTrack, newCount, GR_OR ); Trace_Une_Piste( DrawPanel, DC, firstTrack, newCount, GR_OR );
int i = 0; int i = 0;
for( track=firstTrack; track && i<newCount; ++i, track = track->Next() ) for( track = firstTrack; track && i<newCount; ++i, track = track->Next() )
{ {
track->m_Flags = 0; track->m_Flags = 0;
track->SetState( BUSY, OFF ); track->SetState( BUSY, OFF );
@ -560,10 +560,10 @@ TRACK* LocateIntrusion( TRACK* start, int net, int width )
continue; continue;
/* TRACK::HitTest */ /* TRACK::HitTest */
int dist = width / 2 + track->m_Width / 2 + g_DesignSettings.m_TrackClearence; int dist = width / 2 + track->m_Width / 2 + g_DesignSettings.m_TrackClearence;
wxPoint pos = ref - track->m_Start; wxPoint pos = ref - track->m_Start;
wxPoint vec = track->m_End - track->m_Start; wxPoint vec = track->m_End - track->m_Start;
if( !DistanceTest( dist, vec.x, vec.y, pos.x, pos.y ) ) if( !DistanceTest( dist, vec.x, vec.y, pos.x, pos.y ) )
continue; continue;
@ -599,7 +599,7 @@ TRACK* LocateIntrusion( TRACK* start, int net, int width )
*/ */
static void PushTrack( WinEDA_DrawPanel* panel ) static void PushTrack( WinEDA_DrawPanel* panel )
{ {
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->GetBoard(); BOARD* pcb = ( (WinEDA_BasePcbFrame*)(panel->m_Parent) )->GetBoard();
wxPoint cursor = ActiveScreen->m_Curseur; wxPoint cursor = ActiveScreen->m_Curseur;
wxPoint cv, vec, n; wxPoint cv, vec, n;
TRACK* track = g_CurrentTrackSegment; TRACK* track = g_CurrentTrackSegment;
@ -666,29 +666,27 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
{ {
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
int IsolTmp;
bool Track_fill_copy;
PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetScreen();
Track_fill_copy = DisplayOpt.DisplayPcbTrackFill; bool Track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
DisplayOpt.DisplayPcbTrackFill = true; DisplayOpt.DisplayPcbTrackFill = true;
IsolTmp = DisplayOpt.DisplayTrackIsol; int showTrackClearanceMode = DisplayOpt.ShowTrackClearanceMode;
if( g_ShowClearanceWhenTrackCreation ) if( showTrackClearanceMode != DO_NOT_SHOW_CLEARANCE )
DisplayOpt.DisplayTrackIsol = TRUE; DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
/* efface ancienne position si elle a ete deja dessinee */ /* efface ancienne position si elle a ete deja dessinee */
if( erase ) if( erase )
{ {
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR ); Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->trace_ratsnest_pad( DC ); ( (WinEDA_BasePcbFrame*)(panel->m_Parent) )->trace_ratsnest_pad( DC );
if( g_ShowClearanceWhenTrackCreation > 1 ) // Show the via area if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) // Show the via area
{ {
int color = g_DesignSettings.m_LayerColor[g_CurrentTrackSegment->GetLayer()]; int color = g_DesignSettings.m_LayerColor[g_CurrentTrackSegment->GetLayer()];
GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x, GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x,
g_CurrentTrackSegment->m_End.y, g_CurrentTrackSegment->m_End.y,
(g_DesignSettings.m_CurrentViaSize/2) + g_DesignSettings.m_TrackClearence, (g_DesignSettings.m_CurrentViaSize / 2) + g_DesignSettings.m_TrackClearence,
color ); color );
} }
} }
@ -698,7 +696,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
/* dessin de la nouvelle piste : mise a jour du point d'arrivee */ /* dessin de la nouvelle piste : mise a jour du point d'arrivee */
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
if( ! g_DesignSettings.m_UseConnectedTrackWidth ) if( !g_DesignSettings.m_UseConnectedTrackWidth )
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth; g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( g_TwoSegmentTrackBuild ) if( g_TwoSegmentTrackBuild )
@ -707,7 +705,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
if( previous_track && previous_track->Type()==TYPE_TRACK ) if( previous_track && previous_track->Type()==TYPE_TRACK )
{ {
previous_track->SetLayer( screen->m_Active_Layer ); previous_track->SetLayer( screen->m_Active_Layer );
if( ! g_DesignSettings.m_UseConnectedTrackWidth ) if( !g_DesignSettings.m_UseConnectedTrackWidth )
previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth; previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth;
} }
} }
@ -719,10 +717,10 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
g_CurrentTrackSegment->m_End = ActiveScreen->m_Curseur; g_CurrentTrackSegment->m_End = ActiveScreen->m_Curseur;
if( Drc_On ) if( Drc_On )
PushTrack(panel); PushTrack( panel );
ComputeBreakPoint( g_CurrentTrackSegment, g_CurrentTrackList.GetCount(), ComputeBreakPoint( g_CurrentTrackSegment, g_CurrentTrackList.GetCount(),
g_CurrentTrackSegment->m_End ); g_CurrentTrackSegment->m_End );
} }
else else
{ {
@ -742,22 +740,22 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR ); Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
if( g_ShowClearanceWhenTrackCreation > 1 ) // Show the via area if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) // Show the via area
{ {
int color = g_DesignSettings.m_LayerColor[g_CurrentTrackSegment->GetLayer()]; int color = g_DesignSettings.m_LayerColor[g_CurrentTrackSegment->GetLayer()];
GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x, GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x,
g_CurrentTrackSegment->m_End.y, g_CurrentTrackSegment->m_End.y,
(g_DesignSettings.m_CurrentViaSize/2) + g_DesignSettings.m_TrackClearence, (g_DesignSettings.m_CurrentViaSize / 2) + g_DesignSettings.m_TrackClearence,
color ); color );
} }
DisplayOpt.DisplayTrackIsol = IsolTmp; DisplayOpt.ShowTrackClearanceMode = showTrackClearanceMode;
DisplayOpt.DisplayPcbTrackFill = Track_fill_copy; DisplayOpt.DisplayPcbTrackFill = Track_fill_copy;
( (WinEDA_BasePcbFrame*) (panel->m_Parent) )-> ( (WinEDA_BasePcbFrame*)(panel->m_Parent) )->
build_ratsnest_pad( NULL, g_CurrentTrackSegment->m_End, FALSE ); build_ratsnest_pad( NULL, g_CurrentTrackSegment->m_End, FALSE );
( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->trace_ratsnest_pad( DC ); ( (WinEDA_BasePcbFrame*)(panel->m_Parent) )->trace_ratsnest_pad( DC );
} }
@ -778,7 +776,7 @@ void Calcule_Coord_Extremite_45( int ox, int oy, int* fx, int* fy )
/* calcul de l'angle preferentiel : 0, 45 , 90 degre */ /* calcul de l'angle preferentiel : 0, 45 , 90 degre */
deltax = abs( deltax ); deltax = abs( deltax );
deltay = abs( deltay ); deltay = abs( deltay );
angle = 45; angle = 45;
if( deltax >= deltay ) if( deltax >= deltay )
{ {
@ -859,7 +857,7 @@ void ComputeBreakPoint( TRACK* track, int SegmentCount, wxPoint end )
if( lastTrack ) if( lastTrack )
{ {
if( (lastTrack->m_End.x == lastTrack->m_Start.x) if( (lastTrack->m_End.x == lastTrack->m_Start.x)
|| (lastTrack->m_End.y == lastTrack->m_Start.y) ) || (lastTrack->m_End.y == lastTrack->m_Start.y) )
{ {
iAngle = 45; iAngle = 45;
} }
@ -964,8 +962,8 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList )
firsttrack->start = NULL; firsttrack->start = NULL;
while( track != NULL ) while( track != NULL )
{ {
oldtrack = track; oldtrack = track;
track = track->Next(); track = track->Next();
oldtrack->end = track; oldtrack->end = track;
if( track ) if( track )
@ -1029,4 +1027,3 @@ void EnsureEndTrackOnPad( D_PAD* Pad )
g_CurrentTrackSegment->end = Pad; g_CurrentTrackSegment->end = Pad;
g_CurrentTrackSegment->SetState( END_ONPAD, ON ); g_CurrentTrackSegment->SetState( END_ONPAD, ON );
} }

View File

@ -194,20 +194,13 @@ static PARAM_CFG_BOOL SegmFillCfg
TRUE /* Default value */ TRUE /* Default value */
); );
static PARAM_CFG_INT NewTrackAfficheGardeCfg
(
INSETUP,
wxT( "NewAffG" ), /* Keyword */
&g_ShowClearanceWhenTrackCreation, /* Parameter address */
1 /* Default value */
);
static PARAM_CFG_BOOL TrackAfficheGardeCfg static PARAM_CFG_INT TrackDisplayClearanceCfg
( (
INSETUP, INSETUP,
wxT( "SegAffG" ), /* Keyword */ wxT( "TrackDisplayClearance" ), /* Keyword */
&DisplayOpt.DisplayTrackIsol, /* Parameter address */ &DisplayOpt.ShowTrackClearanceMode, /* Parameter address */
FALSE /* Default value */ SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS /* Default value */
); );
static PARAM_CFG_BOOL PadFillCfg static PARAM_CFG_BOOL PadFillCfg
@ -816,8 +809,7 @@ PARAM_CFG_BASE* ParamCfgList[] =
&Raccord45Cfg, &Raccord45Cfg,
&UnitCfg, &UnitCfg,
&SegmFillCfg, &SegmFillCfg,
&TrackAfficheGardeCfg, &TrackDisplayClearanceCfg,
&NewTrackAfficheGardeCfg,
&PadFillCfg, &PadFillCfg,
&PadAfficheGardeCfg, &PadAfficheGardeCfg,
&PadShowNumCfg, &PadShowNumCfg,

View File

@ -33,7 +33,6 @@ bool g_Show_Ratsnest;
bool g_Show_Module_Ratsnest; bool g_Show_Module_Ratsnest;
bool g_Show_Pads_Module_in_Move = TRUE; bool g_Show_Pads_Module_in_Move = TRUE;
bool g_Raccord_45_Auto = TRUE; bool g_Raccord_45_Auto = TRUE;
int g_ShowClearanceWhenTrackCreation = 1;
bool Track_45_Only; bool Track_45_Only;
bool Segments_45_Only; bool Segments_45_Only;
bool g_TwoSegmentTrackBuild = TRUE; bool g_TwoSegmentTrackBuild = TRUE;

View File

@ -54,12 +54,6 @@ extern bool g_Show_Ratsnest;
extern bool g_Show_Module_Ratsnest; extern bool g_Show_Module_Ratsnest;
extern bool g_Show_Pads_Module_in_Move; extern bool g_Show_Pads_Module_in_Move;
extern bool g_Raccord_45_Auto; extern bool g_Raccord_45_Auto;
extern int g_ShowClearanceWhenTrackCreation; /* = 0 , 1 or 2
* 0 = do not show clearance
* 1 = show track clearance
* 2 = show clearance + via area
* (useful to know what clearance area is neede if we want to put a via on terminal track point)
*/
extern const wxString g_FootprintLibFileWildcard; // Wildcard for footprint libraries filesnames extern const wxString g_FootprintLibFileWildcard; // Wildcard for footprint libraries filesnames

View File

@ -45,12 +45,13 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
DisplayOpt.DisplayModEdge = FILLED; DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayModText = FILLED; DisplayOpt.DisplayModText = FILLED;
frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED; frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.DisplayTrackIsol = false; DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED; DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0; DisplayOpt.DisplayZonesMode = 0;
DisplayOpt.DisplayNetNamesMode = 0;
m_PrintIsMirrored = aPrintMirrorMode; m_PrintIsMirrored = aPrintMirrorMode;
// The OR mode is used in color mode, but be aware the backgroud *must be BLACK. // The OR mode is used in color mode, but be aware the backgroud *must be BLACK.
// In print page dialog, we first plrint in BLACK, and after reprint in color, // In print page dialog, we first plrint in BLACK, and after reprint in color,
// on the black "local" backgroud, in OR mode // on the black "local" backgroud, in OR mode