Commit 8d90da0a authored by CHARRAS's avatar CHARRAS

reorder GENERAL_COLLECTOR lists in collectors.cpp due to markers change

parent 82a268a6
...@@ -215,7 +215,6 @@ bool MIREPCB::HitTest( const wxPoint& refPos ) ...@@ -215,7 +215,6 @@ bool MIREPCB::HitTest( const wxPoint& refPos )
int dX = refPos.x - m_Pos.x; int dX = refPos.x - m_Pos.x;
int dY = refPos.y - m_Pos.y; int dY = refPos.y - m_Pos.y;
int rayon = m_Size / 2; int rayon = m_Size / 2;
return abs(dX)<=rayon && abs(dY)<=rayon; return abs(dX)<=rayon && abs(dY)<=rayon;
} }
......
...@@ -3,73 +3,72 @@ ...@@ -3,73 +3,72 @@
* *
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2007 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2007 Kicad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here: * along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license, * or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc., * or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "collectors.h" #include "collectors.h"
#include "pcbnew.h" // class BOARD #include "pcbnew.h" // class BOARD
/* This module contains out of line member functions for classes given in /* This module contains out of line member functions for classes given in
collectors.h. Those classes augment the functionality of class WinEDA_PcbFrame. * collectors.h. Those classes augment the functionality of class WinEDA_PcbFrame.
*/ */
// see collectors.h // see collectors.h
const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = { const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
// there are some restrictions on the order of items in the general case. // there are some restrictions on the order of items in the general case.
// all items in m_Drawings for instance should be contiguous. // all items in m_Drawings for instance should be contiguous.
TYPETEXTE, // *** all items in a same list (shown here) must be contigous ****
TYPEDRAWSEGMENT, TYPEMARKER, // in m_markers
TYPEMARKER, TYPETEXTE, // in m_Drawings
TYPECOTATION, TYPEDRAWSEGMENT, // in m_Drawings
TYPEMIRE, TYPECOTATION, // in m_Drawings
TYPEVIA, TYPEMIRE, // in m_Drawings
TYPETRACK, TYPEVIA, // in m_Tracks
TYPEPAD, TYPETRACK, // in m_Tracks
TYPETEXTEMODULE, TYPEPAD, // in modules
TYPEMODULE, TYPETEXTEMODULE, // in modules
TYPEZONE, TYPEMODULE, // in m_Modules
TYPEZONE_CONTAINER, TYPEZONE, // in m_Zones
TYPEZONE_CONTAINER, // in m_ZoneDescriptorList
EOT EOT
}; };
/* /*
const KICAD_T GENERAL_COLLECTOR::PrimaryItems[] = { * const KICAD_T GENERAL_COLLECTOR::PrimaryItems[] = {
TYPETEXTE, * TYPETEXTE,
TYPEDRAWSEGMENT, * TYPEDRAWSEGMENT,
TYPEMARKER, * TYPECOTATION,
TYPECOTATION, * TYPEVIA,
TYPEVIA, * TYPETRACK,
TYPETRACK, * TYPEMODULE,
TYPEMODULE, * EOT
EOT * };
}; */
*/
const KICAD_T GENERAL_COLLECTOR::AllButZones[] = { const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
TYPETEXTE,
TYPEDRAWSEGMENT,
TYPEMARKER, TYPEMARKER,
TYPETEXTE,
TYPEDRAWSEGMENT,
TYPECOTATION, TYPECOTATION,
TYPEMIRE, TYPEMIRE,
TYPEVIA, TYPEVIA,
...@@ -79,7 +78,7 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = { ...@@ -79,7 +78,7 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
TYPEMODULE, TYPEMODULE,
EOT EOT
}; };
const KICAD_T GENERAL_COLLECTOR::ModuleItems[] = { const KICAD_T GENERAL_COLLECTOR::ModuleItems[] = {
TYPEMODULE, TYPEMODULE,
...@@ -87,28 +86,28 @@ const KICAD_T GENERAL_COLLECTOR::ModuleItems[] = { ...@@ -87,28 +86,28 @@ const KICAD_T GENERAL_COLLECTOR::ModuleItems[] = {
}; };
const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = { const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = {
TYPEPAD, TYPEPAD,
TYPEMODULE, TYPEMODULE,
EOT EOT
}; };
const KICAD_T GENERAL_COLLECTOR::PadsOrTracks[] = { const KICAD_T GENERAL_COLLECTOR::PadsOrTracks[] = {
TYPEPAD, TYPEPAD,
TYPEVIA, TYPEVIA,
TYPETRACK, TYPETRACK,
TYPEZONE, TYPEZONE,
EOT EOT
}; };
const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = { const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = {
TYPETEXTEMODULE, TYPETEXTEMODULE,
TYPEEDGEMODULE, TYPEEDGEMODULE,
TYPEPAD, TYPEPAD,
TYPEMODULE, TYPEMODULE,
EOT EOT
}; };
...@@ -121,152 +120,172 @@ const KICAD_T GENERAL_COLLECTOR::Tracks[] = { ...@@ -121,152 +120,172 @@ const KICAD_T GENERAL_COLLECTOR::Tracks[] = {
/** /**
* Function Inspect * Function Inspect
* is the examining function within the INSPECTOR which is passed to the * is the examining function within the INSPECTOR which is passed to the
* Iterate function. Searches and collects all the objects that the old * Iterate function. Searches and collects all the objects that the old
* function PcbGeneralLocateAndDisplay() would find, except that it keeps all * function PcbGeneralLocateAndDisplay() would find, except that it keeps all
* that it finds and does not do any displaying. * that it finds and does not do any displaying.
* *
* @param testItem An EDA_BaseStruct to examine. * @param testItem An EDA_BaseStruct to examine.
* @param notUsed The const void* testData. * @param notUsed The const void* testData.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE; * else SCAN_CONTINUE;
*/ */
SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* notUsed ) SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* notUsed )
{ {
BOARD_ITEM* item = (BOARD_ITEM*) testItem; BOARD_ITEM* item = (BOARD_ITEM*) testItem;
MODULE* module = NULL; MODULE* module = NULL;
#if 0 // debugging #if 0 // debugging
static int breakhere = 0; static int breakhere = 0;
switch( item->Type() ) switch( item->Type() )
{ {
case TYPEPAD: case TYPEPAD:
{
MODULE* m = (MODULE*) item->GetParent();
if( m->GetReference() == wxT( "Y2" ) )
{ {
MODULE* m = (MODULE*) item->GetParent(); breakhere++;
if( m->GetReference() == wxT("Y2") )
{
breakhere++;
}
} }
}
break; break;
case TYPEVIA: case TYPEVIA:
breakhere++; breakhere++;
break; break;
case TYPETRACK: case TYPETRACK:
breakhere++; breakhere++;
break; break;
case TYPEZONE: case TYPEZONE:
breakhere++; breakhere++;
break; break;
case TYPETEXTE:
case TYPETEXTE:
breakhere++; breakhere++;
break; break;
case TYPEDRAWSEGMENT:
case TYPEDRAWSEGMENT:
breakhere++; breakhere++;
break; break;
case TYPECOTATION: case TYPECOTATION:
breakhere++; breakhere++;
break; break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
{ {
TEXTE_MODULE* tm = (TEXTE_MODULE*) item; TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
if( tm->m_Text == wxT("10uH") ) if( tm->m_Text == wxT( "10uH" ) )
{ {
breakhere++; breakhere++;
} }
} }
break; break;
case TYPEMODULE: case TYPEMODULE:
{
MODULE* m = (MODULE*) item;
if( m->GetReference() == wxT( "C98" ) )
{ {
MODULE* m = (MODULE*) item; breakhere++;
if( m->GetReference() == wxT("C98") )
{
breakhere++;
}
} }
}
break; break;
default: default:
breakhere++; breakhere++;
break; break;
} }
#endif #endif
switch( item->Type() ) switch( item->Type() )
{ {
case TYPEPAD: case TYPEPAD:
// if pad is a thru hole, then it can be visible when its parent module is not. // if pad is a thru hole, then it can be visible when its parent module is not.
if( ((D_PAD*)item)->m_Attribut != PAD_SMD ) // a hole is present, so multiple layers if( ( (D_PAD*) item )->m_Attribut != PAD_SMD ) // a hole is present, so multiple layers
{ {
// there are no pad specific visibility controls at this time. // there are no pad specific visibility controls at this time.
// proceed to the common tests below, but without the parent module test, // proceed to the common tests below, but without the parent module test,
// by leaving module==NULL // by leaving module==NULL
} }
else // smd, so use common test below else // smd, so use common test below
module = (MODULE*) item->GetParent(); module = (MODULE*) item->GetParent();
break; break;
case TYPEVIA: case TYPEVIA:
break; break;
case TYPETRACK: case TYPETRACK:
break; break;
case TYPEZONE: case TYPEZONE:
break; break;
case TYPEZONE_CONTAINER: case TYPEZONE_CONTAINER:
break; break;
case TYPETEXTE:
case TYPETEXTE:
break; break;
case TYPEDRAWSEGMENT:
case TYPEDRAWSEGMENT:
break; break;
case TYPECOTATION: case TYPECOTATION:
break; break;
case TYPEMIRE:
break;
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
module = (MODULE*) item->GetParent(); module = (MODULE*) item->GetParent();
if( m_Guide->IgnoreMTextsMarkedNoShow() && ((TEXTE_MODULE*)item)->m_NoShow ) if( m_Guide->IgnoreMTextsMarkedNoShow() && ( (TEXTE_MODULE*) item )->m_NoShow )
goto exit; goto exit;
if( module ) if( module )
{ {
if( m_Guide->IgnoreMTextsOnCopper() && module->GetLayer()==COPPER_LAYER_N ) if( m_Guide->IgnoreMTextsOnCopper() && module->GetLayer()==COPPER_LAYER_N )
goto exit; goto exit;
if( m_Guide->IgnoreMTextsOnCmp() && module->GetLayer()==LAYER_CMP_N ) if( m_Guide->IgnoreMTextsOnCmp() && module->GetLayer()==LAYER_CMP_N )
goto exit; goto exit;
} }
break; break;
case TYPEMODULE: case TYPEMODULE:
module = (MODULE*) item; module = (MODULE*) item;
break; break;
default: default:
break; break;
} }
// common tests: // common tests:
if( module ) // true from case TYPEPAD, TYPETEXTEMODULE, or TYPEMODULE if( module ) // true from case TYPEPAD, TYPETEXTEMODULE, or TYPEMODULE
{ {
if( m_Guide->IgnoreModulesOnCu() && module->GetLayer()==COPPER_LAYER_N ) if( m_Guide->IgnoreModulesOnCu() && module->GetLayer()==COPPER_LAYER_N )
goto exit; goto exit;
if( m_Guide->IgnoreModulesOnCmp() && module->GetLayer()==LAYER_CMP_N ) if( m_Guide->IgnoreModulesOnCmp() && module->GetLayer()==LAYER_CMP_N )
goto exit; goto exit;
} }
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() ) if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() )
{ {
int layer = item->GetLayer(); int layer = item->GetLayer();
// Modules and their subcomponents: text and pads are not sensitive to the layer // Modules and their subcomponents: text and pads are not sensitive to the layer
// visibility controls. They all have their own separate visibility controls // visibility controls. They all have their own separate visibility controls
if( module || m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() ) if( module || m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() )
{ {
if( !m_Guide->IsLayerLocked(layer) || !m_Guide->IgnoreLockedLayers() ) if( !m_Guide->IsLayerLocked( layer ) || !m_Guide->IgnoreLockedLayers() )
{ {
if( !item->IsLocked() || !m_Guide->IgnoreLockedItems() ) if( !item->IsLocked() || !m_Guide->IgnoreLockedItems() )
{ {
...@@ -280,20 +299,20 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* ...@@ -280,20 +299,20 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
} }
} }
if( m_Guide->IncludeSecondary() ) if( m_Guide->IncludeSecondary() )
{ {
// for now, "secondary" means "tolerate any layer". It has // for now, "secondary" means "tolerate any layer". It has
// no effect on other criteria, since there is a separate "ignore" control for // no effect on other criteria, since there is a separate "ignore" control for
// those in the COLLECTORS_GUIDE // those in the COLLECTORS_GUIDE
int layer = item->GetLayer(); int layer = item->GetLayer();
// Modules and their subcomponents: text and pads are not sensitive to the layer // Modules and their subcomponents: text and pads are not sensitive to the layer
// visibility controls. They all have their own separate visibility controls // visibility controls. They all have their own separate visibility controls
if( module || m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() ) if( module || m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() )
{ {
if( !m_Guide->IsLayerLocked(layer) || !m_Guide->IgnoreLockedLayers() ) if( !m_Guide->IsLayerLocked( layer ) || !m_Guide->IgnoreLockedLayers() )
{ {
if( !item->IsLocked() || !m_Guide->IgnoreLockedItems() ) if( !item->IsLocked() || !m_Guide->IgnoreLockedItems() )
{ {
...@@ -306,15 +325,15 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* ...@@ -306,15 +325,15 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
} }
} }
} }
exit: exit:
return SEARCH_CONTINUE; // always when collecting return SEARCH_CONTINUE; // always when collecting
} }
// see collectors.h // see collectors.h
void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[], void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[],
const wxPoint& aRefPos, const COLLECTORS_GUIDE& aGuide ) const wxPoint& aRefPos, const COLLECTORS_GUIDE& aGuide )
{ {
Empty(); // empty the collection, primary criteria list Empty(); // empty the collection, primary criteria list
Empty2nd(); // empty the collection, secondary criteria list Empty2nd(); // empty the collection, secondary criteria list
...@@ -323,25 +342,25 @@ void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[], ...@@ -323,25 +342,25 @@ void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const KICAD_T aScanList[],
SetGuide( &aGuide ); SetGuide( &aGuide );
SetScanTypes( aScanList ); SetScanTypes( aScanList );
// remember where the snapshot was taken from and pass refPos to // remember where the snapshot was taken from and pass refPos to
// the Inspect() function. // the Inspect() function.
SetRefPos( aRefPos ); SetRefPos( aRefPos );
// visit the board or module with the INSPECTOR (me). // visit the board or module with the INSPECTOR (me).
aItem->Visit( this, // INSPECTOR* inspector aItem->Visit( this, // INSPECTOR* inspector
NULL, // const void* testData, not used here NULL, // const void* testData, not used here
m_ScanTypes); m_ScanTypes );
SetTimeNow(); // when snapshot was taken SetTimeNow(); // when snapshot was taken
// record the length of the primary list before concatonating on to it. // record the length of the primary list before concatonating on to it.
m_PrimaryLength = m_List.size(); m_PrimaryLength = m_List.size();
// append 2nd list onto end of the first list // append 2nd list onto end of the first list
for( unsigned i=0; i<m_List2nd.size(); ++i ) for( unsigned i = 0; i<m_List2nd.size(); ++i )
Append( m_List2nd[i] ); Append( m_List2nd[i] );
Empty2nd(); Empty2nd();
} }
......
...@@ -459,12 +459,15 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( wxDC* DC ) ...@@ -459,12 +459,15 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
if( diag == ZONE_ABORT ) if( diag == ZONE_ABORT )
return NULL; return NULL;
GetScreen()->m_Active_Layer = s_Zone_Layer; // Set by the dialog frame
} }
else /* Start a new contour: init zone params (net and layer) from an existing zone */ else /* Start a new contour: init zone params (net and layer) from an existing zone */
{ {
GetScreen()->m_Active_Layer = s_Zone_Layer = s_CurrentZone->GetLayer(); GetScreen()->m_Active_Layer = s_Zone_Layer = s_CurrentZone->GetLayer();
s_Zone_Hatching = s_CurrentZone->m_Poly->GetHatchStyle(); s_Zone_Hatching = s_CurrentZone->m_Poly->GetHatchStyle();
} }
/* Show the Net */ /* Show the Net */
if( g_HightLigt_Status && (g_HightLigth_NetCode != s_NetcodeSelection) ) if( g_HightLigt_Status && (g_HightLigth_NetCode != s_NetcodeSelection) )
{ {
......
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