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

Fix minor bugs in cleanup dialog options and plot solder mask function (thanks...

Fix minor bugs in cleanup dialog options and plot solder mask function (thanks to Lorenzo to locate these bugs)
parent 5202ec58
...@@ -1500,7 +1500,8 @@ void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDr ...@@ -1500,7 +1500,8 @@ void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDr
ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos, ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
LAYER_NUM aStartLayer, LAYER_NUM aStartLayer,
LAYER_NUM aEndLayer ) LAYER_NUM aEndLayer,
int aNetCode )
{ {
if( aEndLayer < 0 ) if( aEndLayer < 0 )
aEndLayer = aStartLayer; aEndLayer = aStartLayer;
...@@ -1520,6 +1521,9 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos, ...@@ -1520,6 +1521,9 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
if( area->GetState( BUSY ) ) if( area->GetState( BUSY ) )
continue; continue;
if( aNetCode >= 0 && area->GetNet() != aNetCode )
continue;
if( area->HitTestFilledArea( aRefPos ) ) if( area->HitTestFilledArea( aRefPos ) )
return area; return area;
} }
......
...@@ -1079,12 +1079,14 @@ public: ...@@ -1079,12 +1079,14 @@ public:
* Note: if a zone has its flag BUSY (in .m_State) is set, it is ignored. * Note: if a zone has its flag BUSY (in .m_State) is set, it is ignored.
* @param aRefPos A wxPoint to test * @param aRefPos A wxPoint to test
* @param aStartLayer the first layer to test * @param aStartLayer the first layer to test
* @param aEndLayer the last layer (-1 to ignore it) to test * @param aEndLayer the last layer to test
* @param aNetCode = the netcode used to filter zones (-1 to to test all zones)
* @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL * @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL
*/ */
ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos, ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos,
LAYER_NUM aStartLayer, LAYER_NUM aStartLayer,
LAYER_NUM aEndLayer = UNDEFINED_LAYER ); LAYER_NUM aEndLayer,
int aNetCode );
/** /**
* Function RedrawAreasOutlines * Function RedrawAreasOutlines
......
...@@ -117,9 +117,9 @@ void PCB_EDIT_FRAME::Clean_Pcb() ...@@ -117,9 +117,9 @@ void PCB_EDIT_FRAME::Clean_Pcb()
wxBusyCursor( dummy ); wxBusyCursor( dummy );
TRACKS_CLEANER cleaner( GetBoard() ); TRACKS_CLEANER cleaner( GetBoard() );
cleaner.SetdeleteUnconnectedTracksOpt( dlg.deleteUnconnectedSegm ); cleaner.SetdeleteUnconnectedTracksOpt( dlg.m_deleteUnconnectedSegm );
cleaner.SetMergeSegmentsOpt( dlg.mergeSegments ); cleaner.SetMergeSegmentsOpt( dlg.m_mergeSegments );
cleaner.SetCleanViasOpt( dlg.cleanVias ); cleaner.SetCleanViasOpt( dlg.m_cleanVias );
if( cleaner.CleanupBoard() ) if( cleaner.CleanupBoard() )
{ {
...@@ -321,13 +321,16 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() ...@@ -321,13 +321,16 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
if( track->Type() != PCB_VIA_T ) if( track->Type() != PCB_VIA_T )
{ {
zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(), zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(),
track->GetLayer() ); track->GetLayer(),
track->GetLayer(),
track->GetNet() );
} }
else else
{ {
((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer ); ((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(), zone = m_Brd->HitTestForAnyFilledArea( track->GetStart(),
top_layer, bottom_layer ); top_layer, bottom_layer,
track->GetNet() );
} }
} }
...@@ -354,7 +357,9 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() ...@@ -354,7 +357,9 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
{ {
via->ReturnLayerPair( &top_layer, &bottom_layer ); via->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( via->GetStart(), zone = m_Brd->HitTestForAnyFilledArea( via->GetStart(),
bottom_layer, top_layer ); bottom_layer,
top_layer,
via->GetNet() );
} }
if( (other == NULL) && (zone == NULL) ) if( (other == NULL) && (zone == NULL) )
...@@ -376,13 +381,16 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() ...@@ -376,13 +381,16 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
if( track->Type() != PCB_VIA_T ) if( track->Type() != PCB_VIA_T )
{ {
zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(), zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(),
track->GetLayer() ); track->GetLayer(),
track->GetLayer(),
track->GetNet() );
} }
else else
{ {
((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer ); ((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(), zone = m_Brd->HitTestForAnyFilledArea( track->GetEnd(),
top_layer, bottom_layer ); top_layer, bottom_layer,
track->GetNet() );
} }
} }
...@@ -410,7 +418,8 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() ...@@ -410,7 +418,8 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks()
{ {
via->ReturnLayerPair( &top_layer, &bottom_layer ); via->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( via->GetEnd(), zone = m_Brd->HitTestForAnyFilledArea( via->GetEnd(),
bottom_layer, top_layer ); bottom_layer, top_layer,
via->GetNet() );
} }
if( (other == NULL) && (zone == NULL) ) if( (other == NULL) && (zone == NULL) )
......
...@@ -155,10 +155,10 @@ ...@@ -155,10 +155,10 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip">remove vias on pads with a through hole</property> <property name="tooltip">remove vias on pads with a through hole</property>
<property name="validator_data_type">bool</property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NUMERIC</property> <property name="validator_style">wxFILTER_NUMERIC</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable">cleanVias</property> <property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -243,10 +243,10 @@ ...@@ -243,10 +243,10 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip">merge aligned track segments, and remove null segments</property> <property name="tooltip">merge aligned track segments, and remove null segments</property>
<property name="validator_data_type">bool</property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NUMERIC</property> <property name="validator_style">wxFILTER_NUMERIC</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable">mergeSegments</property> <property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
...@@ -331,10 +331,10 @@ ...@@ -331,10 +331,10 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property> <property name="toolbar_pane">0</property>
<property name="tooltip">delete track segment having a dangling end</property> <property name="tooltip">delete track segment having a dangling end</property>
<property name="validator_data_type">bool</property> <property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NUMERIC</property> <property name="validator_style">wxFILTER_NUMERIC</property>
<property name="validator_type">wxDefaultValidator</property> <property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable">deleteUnconnectedSegm</property> <property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
......
...@@ -50,9 +50,6 @@ class DIALOG_CLEANING_OPTIONS_BASE : public DIALOG_SHIM ...@@ -50,9 +50,6 @@ class DIALOG_CLEANING_OPTIONS_BASE : public DIALOG_SHIM
public: public:
bool cleanVias;
bool mergeSegments;
bool deleteUnconnectedSegm;
DIALOG_CLEANING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Cleaning Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 243,146 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_CLEANING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Cleaning Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 243,146 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_CLEANING_OPTIONS_BASE(); ~DIALOG_CLEANING_OPTIONS_BASE();
......
...@@ -147,7 +147,10 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) ...@@ -147,7 +147,10 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
// Not a starting point, but a filled zone area can exist. This is also a // Not a starting point, but a filled zone area can exist. This is also a
// good starting point. // good starting point.
ZONE_CONTAINER* zone; ZONE_CONTAINER* zone;
zone = GetBoard()->HitTestForAnyFilledArea( pos, GetScreen()-> m_Active_Layer ); zone = GetBoard()->HitTestForAnyFilledArea( pos,
GetScreen()-> m_Active_Layer,
GetScreen()-> m_Active_Layer,
-1 );
if( zone ) if( zone )
GetBoard()->SetHighLightNet( zone->GetNet() ); GetBoard()->SetHighLightNet( zone->GetNet() );
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
* unless the minimum thickness is 0. * unless the minimum thickness is 0.
*/ */
static void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, static void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt, LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt,
int aMinThickness ); int aMinThickness );
/* Creates the plot for silkscreen layers /* Creates the plot for silkscreen layers
...@@ -463,7 +463,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -463,7 +463,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
* (shapes will be better, and calculations faster) * (shapes will be better, and calculations faster)
*/ */
void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt, LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt,
int aMinThickness ) int aMinThickness )
{ {
LAYER_NUM layer = ( aLayerMask & SOLDERMASK_LAYER_BACK ) ? LAYER_NUM layer = ( aLayerMask & SOLDERMASK_LAYER_BACK ) ?
...@@ -480,7 +480,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, ...@@ -480,7 +480,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
{ {
for( BOARD_ITEM* item = module->GraphicalItems(); item; item = item->Next() ) for( BOARD_ITEM* item = module->GraphicalItems(); item; item = item->Next() )
{ {
if( aLayerMask != item->GetLayer() ) if( layer != item->GetLayer() )
continue; continue;
switch( item->Type() ) switch( item->Type() )
......
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