Commit e8778199 authored by charras's avatar charras

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

parent 360eda0f
......@@ -9,7 +9,7 @@ email address.
++Pcbnew:
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.
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>
================================================================================
......
......@@ -59,7 +59,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_MENU( ID_COLORS_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,
WinEDA_DrawFrame::SetLanguage )
......
......@@ -51,7 +51,7 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
}
case ID_PCB_TRACK_SIZE_SETUP:
case ID_PCB_LOOK_SETUP:
case ID_PCB_DISPLAY_OPTIONS_SETUP:
case ID_OPTIONS_SETUP:
InstallPcbOptionsFrame( pos, id );
break;
......
......@@ -28,7 +28,7 @@ void Print_PcbItems(BOARD * Pcb, wxDC *DC, int drawmode, int printmasklayer)
DisplayOpt.DisplayPadNoConn = 0;
DisplayOpt.DisplayPadIsol = 0;
DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.DisplayTrackIsol = 0;
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0;
......
......@@ -390,7 +390,7 @@ void WinEDA_GerberFrame::InstallPcbOptionsFrame( const wxPoint& pos, int id )
{
switch( id )
{
case ID_PCB_LOOK_SETUP:
case ID_PCB_DISPLAY_OPTIONS_SETUP:
{
WinEDA_LookFrame* OptionsFrame =
new WinEDA_LookFrame( this, pos );
......
......@@ -87,7 +87,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
ADD_MENUITEM_WITH_HELP( configmenu, ID_OPTIONS_SETUP, _( "&Options" ),
_( " 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" ),
display_options_xpm );
......
......@@ -43,7 +43,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayModText = FILLED;
DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.DisplayTrackIsol = 0;
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0;
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
......
......@@ -268,6 +268,17 @@ public:
#include "class_marker.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
{
......@@ -280,7 +291,12 @@ public:
int DisplayModEdge;
int DisplayModText;
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,
* 1 show via hole for non default value
......
No preview for this file type
This diff is collapsed.
......@@ -49,7 +49,7 @@ static bool ShowClearance( const TRACK* aTrack )
{
// maybe return true for tracks and vias, not for zone segments
return !(aTrack->m_Flags & DRAW_ERASED)
&& DisplayOpt.DisplayTrackIsol
&& DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS
&& aTrack->GetLayer() <= LAST_COPPER_LAYER
&& ( 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,
rayon + g_DesignSettings.m_TrackClearence, color );
......
......@@ -143,8 +143,8 @@ DISPLAY_OPTIONS::DISPLAY_OPTIONS()
DisplayModEdge = true;
DisplayModText = true;
DisplayPcbTrackFill = true; /* false = sketch , true = rempli */
DisplayTrackIsol = false;
DisplayPcbTrackFill = true; /* false = sketch , true = filled */
ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
m_DisplayViaMode = VIA_HOLE_NOT_SHOW;
DisplayPolarCood = false; /* false = display absolute coordinates,
......
......@@ -60,13 +60,22 @@ void Dialog_Display_Options::init()
if ( DisplayOpt.DisplayPcbTrackFill )
m_OptDisplayTracks->SetSelection(1);
if ( DisplayOpt.DisplayTrackIsol )
m_OptDisplayTracksClearance->SetSelection(3);
else if ( g_ShowClearanceWhenTrackCreation == 1)
switch ( DisplayOpt.ShowTrackClearanceMode )
{
case DO_NOT_SHOW_CLEARANCE:
m_OptDisplayTracksClearance->SetSelection(0);
break;
case SHOW_CLEARANCE_NEW_TRACKS:
m_OptDisplayTracksClearance->SetSelection(1);
else if ( g_ShowClearanceWhenTrackCreation == 2)
break;
default:
case SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS:
m_OptDisplayTracksClearance->SetSelection(2);
else m_OptDisplayTracksClearance->SetSelection(0);
break;
case SHOW_CLEARANCE_ALWAYS:
m_OptDisplayTracksClearance->SetSelection(3);
break;
}
if ( DisplayOpt.DisplayPadFill )
m_OptDisplayPads->SetSelection(1);
......@@ -115,21 +124,17 @@ void Dialog_Display_Options::OnOkClick(wxCommandEvent& event)
switch ( m_OptDisplayTracksClearance->GetSelection() )
{
case 3:
DisplayOpt.DisplayTrackIsol = TRUE;
g_ShowClearanceWhenTrackCreation = 1;
case 0:
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
break;
case 1:
DisplayOpt.DisplayTrackIsol = FALSE;
g_ShowClearanceWhenTrackCreation = 1;
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS;
break;
case 2:
DisplayOpt.DisplayTrackIsol = FALSE;
g_ShowClearanceWhenTrackCreation = 2;
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
break;
case 0:
DisplayOpt.DisplayTrackIsol = FALSE;
g_ShowClearanceWhenTrackCreation = 0;
case 3:
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
break;
}
......
......@@ -16,7 +16,6 @@
#include "trigo.h"
/* Routines Locales */
static void Exit_Editrack( WinEDA_DrawPanel* panel, wxDC* DC );
void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel,
......@@ -85,7 +84,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
{
D_PAD* pt_pad = 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;
wxPoint pos = GetScreen()->m_Curseur;
......@@ -131,10 +130,11 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
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.
{
ZONE_CONTAINER* zone = GetBoard()->HitTestForAnyFilledArea( pos, GetScreen()->m_Active_Layer );
ZONE_CONTAINER* zone = GetBoard()->HitTestForAnyFilledArea( pos,
GetScreen()->
m_Active_Layer );
if( zone )
g_HightLigth_NetCode = zone->GetNet();
}
......@@ -147,7 +147,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* 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;
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->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
newTrack->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
if( !g_DesignSettings.m_UseConnectedTrackWidth )
{
......@@ -309,9 +309,9 @@ bool WinEDA_PcbFrame::Add_45_degrees_Segment( wxDC* DC )
return false;
}
pas_45 = (int)GetScreen()->GetGrid().x / 2;
pas_45 = (int) GetScreen()->GetGrid().x / 2;
if( pas_45 < curTrack->m_Width )
pas_45 = (int)GetScreen()->GetGrid().x;
pas_45 = (int) GetScreen()->GetGrid().x;
while( pas_45 < curTrack->m_Width )
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)
*/
{
int masquelayer = g_TabOneLayerMask[((PCB_SCREEN*)GetScreen())->m_Active_Layer];
int masquelayer = g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
if( aTrack == NULL )
return;
......@@ -441,11 +441,11 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
trace_ratsnest_pad( DC ); /* efface trace chevelu*/
/* cleanup
if( g_CurrentTrackSegment->Next() != NULL )
{
delete g_CurrentTrackSegment->Next();
g_CurrentTrackSegment->SetNext( NULL );
}
* if( g_CurrentTrackSegment->Next() != NULL )
* {
* delete g_CurrentTrackSegment->Next();
* g_CurrentTrackSegment->SetNext( NULL );
* }
*/
D( g_CurrentTrackList.VerifyListIntegrity(); );
......@@ -492,7 +492,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
// Put entire new current segment list in BOARD
TRACK* track;
TRACK* insertBeforeMe = g_CurrentTrackSegment->GetBestInsertPoint( GetBoard() );
while( (track = g_CurrentTrackList.PopFront()) != NULL )
while( ( track = g_CurrentTrackList.PopFront() ) != NULL )
{
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 );
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->SetState( BUSY, OFF );
......@@ -599,7 +599,7 @@ TRACK* LocateIntrusion( TRACK* start, int net, int width )
*/
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 cv, vec, n;
TRACK* track = g_CurrentTrackSegment;
......@@ -666,28 +666,26 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
{
D( g_CurrentTrackList.VerifyListIntegrity(); );
int IsolTmp;
bool Track_fill_copy;
PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetScreen();
Track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
bool Track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
DisplayOpt.DisplayPcbTrackFill = true;
IsolTmp = DisplayOpt.DisplayTrackIsol;
int showTrackClearanceMode = DisplayOpt.ShowTrackClearanceMode;
if( g_ShowClearanceWhenTrackCreation )
DisplayOpt.DisplayTrackIsol = TRUE;
if( showTrackClearanceMode != DO_NOT_SHOW_CLEARANCE )
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
/* efface ancienne position si elle a ete deja dessinee */
if( erase )
{
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->trace_ratsnest_pad( DC );
if( g_ShowClearanceWhenTrackCreation > 1 ) // Show the via area
( (WinEDA_BasePcbFrame*)(panel->m_Parent) )->trace_ratsnest_pad( DC );
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) // Show the via area
{
int color = g_DesignSettings.m_LayerColor[g_CurrentTrackSegment->GetLayer()];
GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x,
g_CurrentTrackSegment->m_End.y,
(g_DesignSettings.m_CurrentViaSize/2) + g_DesignSettings.m_TrackClearence,
(g_DesignSettings.m_CurrentViaSize / 2) + g_DesignSettings.m_TrackClearence,
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 */
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;
if( g_TwoSegmentTrackBuild )
......@@ -707,7 +705,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
if( previous_track && previous_track->Type()==TYPE_TRACK )
{
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;
}
}
......@@ -719,7 +717,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
g_CurrentTrackSegment->m_End = ActiveScreen->m_Curseur;
if( Drc_On )
PushTrack(panel);
PushTrack( panel );
ComputeBreakPoint( g_CurrentTrackSegment, g_CurrentTrackList.GetCount(),
g_CurrentTrackSegment->m_End );
......@@ -742,22 +740,22 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
D( g_CurrentTrackList.VerifyListIntegrity(); );
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()];
GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x,
g_CurrentTrackSegment->m_End.y,
(g_DesignSettings.m_CurrentViaSize/2) + g_DesignSettings.m_TrackClearence,
(g_DesignSettings.m_CurrentViaSize / 2) + g_DesignSettings.m_TrackClearence,
color );
}
DisplayOpt.DisplayTrackIsol = IsolTmp;
DisplayOpt.ShowTrackClearanceMode = showTrackClearanceMode;
DisplayOpt.DisplayPcbTrackFill = Track_fill_copy;
( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->
( (WinEDA_BasePcbFrame*)(panel->m_Parent) )->
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 );
}
......@@ -1029,4 +1027,3 @@ void EnsureEndTrackOnPad( D_PAD* Pad )
g_CurrentTrackSegment->end = Pad;
g_CurrentTrackSegment->SetState( END_ONPAD, ON );
}
......@@ -194,20 +194,13 @@ static PARAM_CFG_BOOL SegmFillCfg
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,
wxT( "SegAffG" ), /* Keyword */
&DisplayOpt.DisplayTrackIsol, /* Parameter address */
FALSE /* Default value */
wxT( "TrackDisplayClearance" ), /* Keyword */
&DisplayOpt.ShowTrackClearanceMode, /* Parameter address */
SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS /* Default value */
);
static PARAM_CFG_BOOL PadFillCfg
......@@ -816,8 +809,7 @@ PARAM_CFG_BASE* ParamCfgList[] =
&Raccord45Cfg,
&UnitCfg,
&SegmFillCfg,
&TrackAfficheGardeCfg,
&NewTrackAfficheGardeCfg,
&TrackDisplayClearanceCfg,
&PadFillCfg,
&PadAfficheGardeCfg,
&PadShowNumCfg,
......
......@@ -33,7 +33,6 @@ bool g_Show_Ratsnest;
bool g_Show_Module_Ratsnest;
bool g_Show_Pads_Module_in_Move = TRUE;
bool g_Raccord_45_Auto = TRUE;
int g_ShowClearanceWhenTrackCreation = 1;
bool Track_45_Only;
bool Segments_45_Only;
bool g_TwoSegmentTrackBuild = TRUE;
......
......@@ -54,12 +54,6 @@ extern bool g_Show_Ratsnest;
extern bool g_Show_Module_Ratsnest;
extern bool g_Show_Pads_Module_in_Move;
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
......
......@@ -45,9 +45,10 @@ void WinEDA_DrawPanel::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMa
DisplayOpt.DisplayModEdge = FILLED;
DisplayOpt.DisplayModText = FILLED;
frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = FILLED;
DisplayOpt.DisplayTrackIsol = false;
DisplayOpt.ShowTrackClearanceMode = DO_NOT_SHOW_CLEARANCE;
DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZonesMode = 0;
DisplayOpt.DisplayNetNamesMode = 0;
m_PrintIsMirrored = aPrintMirrorMode;
......
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