see change_log.txt's 2007-Aug-23 UPDATE
This commit is contained in:
parent
cc62305777
commit
2e13ccf048
|
@ -7,9 +7,21 @@ email address.
|
|||
|
||||
2007-Aug-23 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
@todo add constructor initializers for classes that were derived from
|
||||
+ eeschema & pcbnew
|
||||
* Fixed MODULE::Visit() and BOARD::Vist() so they traverse certain lists
|
||||
only once and they are working nicely now.
|
||||
* You can test the GENERALCOLLECTOR::Scan() code by compiling with DEBUG=1 on
|
||||
the command line and enabling the stuff near line 124 in
|
||||
pcbnew/controle.cpp, then watch Show( std::cout ) show the selected items in
|
||||
xml format on your console. (launch pcbnew from command line.)
|
||||
@todo:
|
||||
The layer selection mechanism used by the collector is still inadequate, so
|
||||
tomorrow I will add a new class COLLECTORS_GUIDE which can be used by a
|
||||
COLLECTOR to control its operation. It adds the concept of layer
|
||||
locking, even though PCBNEW does not support that in the UI yet.
|
||||
@todo:
|
||||
add constructor initializers for classes that were derived from
|
||||
EDA_BaseLineStruct but are now not. Its late, will do tomorrow.
|
||||
@todo test yesterday's changes, it builds, may not run right yet.
|
||||
|
||||
|
||||
2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
|
@ -18,15 +30,15 @@ email address.
|
|||
Things are still pretty transient, should be stable a day or two:
|
||||
* Fixed a filename case sensitivity problem that would show up on Linux
|
||||
but probably not on Windows: bitmap/Reload.xpm needed uppercase R.
|
||||
* Wedged a new class BOARD_ITEM underneath all PCB drawable classes, this is
|
||||
* Wedged a new class BOARD_ITEM underneath all PCB drawable classes. This is
|
||||
a big change and may introduce a bug or two, but it is worth it for the
|
||||
future, because we can introduce virtual functions there that do not impact
|
||||
future, because we can add virtual functions there that do not impact
|
||||
the entire project (since everything is derived from EDA_BaseStruct).
|
||||
The corresponding class in EESCHEMA seems to be DrawPartStruct, so we had
|
||||
nothing in PCBNEW like that.
|
||||
BOARD_ITEM::GetLayer() and SetLayer() introduced, more functions to come.
|
||||
Much of this work is geared towards making collectors.cpp's ARROWCOLLECTOR::Inspect()
|
||||
very very simple, and that can be model for future work.
|
||||
very very simple, and that can be a model for future work.
|
||||
* Changed min() and max() macros to MIN() and MAX() because min() and max()
|
||||
are actually reserved according to the C++ standard! (and their usage prevented
|
||||
the use of #include <vector>).
|
||||
|
|
|
@ -211,6 +211,10 @@ SEARCH_RESULT EDA_BaseStruct::Visit( INSPECTOR* inspector, const void* testData,
|
|||
{
|
||||
KICAD_T stype;
|
||||
|
||||
#if defined(DEBUG)
|
||||
std::cout << GetClass().mb_str() << ' ';
|
||||
#endif
|
||||
|
||||
for( const KICAD_T* p = scanTypes; (stype=*p) != EOT; ++p )
|
||||
{
|
||||
// If caller wants to inspect my type
|
||||
|
|
|
@ -133,7 +133,7 @@ public:
|
|||
EDA_BaseStruct* m_Son; /* Linked list: Link (son struct) */
|
||||
EDA_BaseStruct* m_Image; /* Link to an image copy for undelete or abort command */
|
||||
|
||||
int m_Flags; // flags for editions and other
|
||||
int m_Flags; // flags for editing and other misc. uses
|
||||
#define IS_CHANGED (1<<0)
|
||||
#define IS_LINKED (1<<1)
|
||||
#define IN_EDIT (1<<2)
|
||||
|
@ -154,7 +154,6 @@ public:
|
|||
|
||||
unsigned long m_TimeStamp; // Time stamp used for logical links
|
||||
int m_Selected; /* Used by block commands, and selective editing */
|
||||
// int m_Layer; ///< used by many derived classes, so make common
|
||||
|
||||
private:
|
||||
int m_Status;
|
||||
|
@ -394,8 +393,8 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
BOARD_ITEM* Next() { return (BOARD_ITEM*) Pnext; }
|
||||
|
||||
BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; }
|
||||
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
|
||||
|
||||
/**
|
||||
* Function GetLayer
|
||||
|
@ -411,6 +410,43 @@ public:
|
|||
void SetLayer( int aLayer ) { m_Layer = aLayer; }
|
||||
|
||||
|
||||
/**
|
||||
* Function IsOnLayer
|
||||
* tests to see if this object is on the given layer. Is virtual so
|
||||
* objects like D_PAD, which reside on multiple layers can do their own
|
||||
* form of testing.
|
||||
* @param aLayer The layer to test for.
|
||||
* @return bool - true if on given layer, else false.
|
||||
*/
|
||||
virtual bool IsOnLayer( int aLayer ) const
|
||||
{
|
||||
return m_Layer == aLayer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function IsOnOneOfTheseLayers
|
||||
* returns true if this object is on one of the given layers. Is virtual so
|
||||
* objects like D_PAD, which reside on multiple layers, can do their own
|
||||
* form of testing.
|
||||
* @param aLayerMask The bit-mapped set of layers to test for.
|
||||
* @return bool - true if on one of the given layers, else false.
|
||||
*/
|
||||
virtual bool IsOnOneOfTheseLayers( int aLayerMask ) const
|
||||
{
|
||||
return ( (1<<m_Layer) & aLayerMask ) != 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function IsLocked
|
||||
* @returns bool - true if the object is locked, else false
|
||||
*/
|
||||
virtual bool IsLocked() const
|
||||
{
|
||||
return false; // only MODULEs can be locked at this time.
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
|
||||
class EDA_BaseStruct;
|
||||
class BOARD;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -48,16 +47,10 @@ class BOARD;
|
|||
*
|
||||
* Later, after collection, the user can iterate through all the objects
|
||||
* in the remembered collection using GetCount() and the [int] operator.
|
||||
*
|
||||
* Philosophy: this class knows nothing of the context in which as BOARD is used
|
||||
* and that means it knows nothing about which layers are visible or current,
|
||||
* but can handle those concerns by the SetPreferredLayer() function.
|
||||
*/
|
||||
class COLLECTOR : public INSPECTOR
|
||||
{
|
||||
protected:
|
||||
// int m_Type;
|
||||
|
||||
/// Which object types to scan
|
||||
const KICAD_T* m_ScanTypes;
|
||||
|
||||
|
@ -84,20 +77,9 @@ public:
|
|||
|
||||
virtual ~COLLECTOR()
|
||||
{
|
||||
// empty the list so that ~list() does not try and delete all
|
||||
// the objects that it holds. list is not the owner of such objects
|
||||
// and this prevents a double free()ing.
|
||||
Empty();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Type
|
||||
* returns the type of the collector.
|
||||
int Type() const { return m_Type; }
|
||||
*/
|
||||
|
||||
|
||||
void SetPreferredLayer( int aPreferredLayer )
|
||||
{
|
||||
m_PreferredLayer = aPreferredLayer;
|
||||
|
@ -108,7 +90,7 @@ public:
|
|||
* Function GetCount
|
||||
* returns the number of objects in the list
|
||||
*/
|
||||
int GetCount() const
|
||||
unsigned GetCount() const
|
||||
{
|
||||
return list.size();
|
||||
}
|
||||
|
@ -143,7 +125,7 @@ public:
|
|||
*/
|
||||
EDA_BaseStruct* operator[]( int ndx ) const
|
||||
{
|
||||
if( (unsigned)ndx < (unsigned)GetCount() )
|
||||
if( (unsigned)ndx < GetCount() )
|
||||
return list[ ndx ];
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -175,6 +175,13 @@ public:
|
|||
|
||||
public:
|
||||
EDA_BoardDesignSettings( void );
|
||||
|
||||
/**
|
||||
* Function GetVisibleLayers
|
||||
* returns a bit-map of all the layers that are visible.
|
||||
* @return int - the visible layers in bit-mapped form.
|
||||
*/
|
||||
int GetVisibleLayers();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class WinEDA3D_DrawFrame;
|
|||
class PARAM_CFG_BASE;
|
||||
class Ki_PageDescr;
|
||||
class Ki_HotkeyInfo;
|
||||
class ARROWCOLLECTOR;
|
||||
class GENERALCOLLECTOR;
|
||||
|
||||
|
||||
enum id_librarytype {
|
||||
|
@ -372,6 +372,11 @@ private:
|
|||
virtual void GetComponentFromUndoList( void );
|
||||
virtual void GetComponentFromRedoList( void );
|
||||
|
||||
#if defined(DEBUG)
|
||||
protected:
|
||||
GENERALCOLLECTOR* m_Collector;
|
||||
#endif
|
||||
|
||||
|
||||
public:
|
||||
// Read/write fonctions:
|
||||
|
@ -385,8 +390,8 @@ public:
|
|||
|
||||
// Gestion du PCB
|
||||
bool Clear_Pcb( wxDC* DC, bool query );
|
||||
EDA_BaseStruct* PcbGeneralLocateAndDisplay();
|
||||
EDA_BaseStruct* Locate( int typeloc, int LayerSearch );
|
||||
BOARD_ITEM* PcbGeneralLocateAndDisplay();
|
||||
BOARD_ITEM* Locate( int typeloc, int LayerSearch );
|
||||
|
||||
// Gestion du curseur
|
||||
void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap,
|
||||
|
@ -517,11 +522,6 @@ private:
|
|||
bool m_SelViaSizeBox_Changed;
|
||||
wxMenu* m_FilesMenu;
|
||||
|
||||
#if defined(DEBUG)
|
||||
ARROWCOLLECTOR* m_ArrowCollector; ///< while arrow icon tool
|
||||
#endif
|
||||
|
||||
|
||||
public:
|
||||
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size );
|
||||
|
|
|
@ -311,13 +311,21 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
|||
KICAD_T stype;
|
||||
SEARCH_RESULT result = SEARCH_CONTINUE;
|
||||
const KICAD_T* p = scanTypes;
|
||||
bool done=false;
|
||||
|
||||
while( (stype = *p++) != EOT )
|
||||
#if defined(DEBUG)
|
||||
std::cout << GetClass().mb_str() << ' ';
|
||||
#endif
|
||||
|
||||
while( !done )
|
||||
{
|
||||
stype = *p;
|
||||
switch( stype )
|
||||
{
|
||||
case TYPEPCB:
|
||||
result = inspector->Inspect( this, testData ); // inspect me
|
||||
// skip over any types handled in the above call.
|
||||
++p;
|
||||
break;
|
||||
|
||||
/* Instances of the requested KICAD_T live in a list, either one
|
||||
|
@ -332,7 +340,21 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
|||
case TYPETEXTEMODULE:
|
||||
case TYPEEDGEMODULE:
|
||||
// this calls MODULE::Visit() on each module.
|
||||
result = IterateForward( m_Modules, inspector, testData, scanTypes );
|
||||
result = IterateForward( m_Modules, inspector, testData, p );
|
||||
// skip over any types handled in the above call.
|
||||
for(;;)
|
||||
{
|
||||
switch( stype = *++p )
|
||||
{
|
||||
case TYPEMODULE:
|
||||
case TYPEPAD:
|
||||
case TYPETEXTEMODULE:
|
||||
case TYPEEDGEMODULE:
|
||||
continue;
|
||||
default:;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPEDRAWSEGMENT:
|
||||
|
@ -340,27 +362,59 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
|||
case TYPEMARQUEUR:
|
||||
case TYPECOTATION:
|
||||
case TYPEMIRE:
|
||||
result = IterateForward( m_Drawings, inspector, testData, scanTypes );
|
||||
result = IterateForward( m_Drawings, inspector, testData, p );
|
||||
// skip over any types handled in the above call.
|
||||
for(;;)
|
||||
{
|
||||
switch( stype = *++p )
|
||||
{
|
||||
case TYPEDRAWSEGMENT:
|
||||
case TYPETEXTE:
|
||||
case TYPEMARQUEUR:
|
||||
case TYPECOTATION:
|
||||
case TYPEMIRE:
|
||||
continue;
|
||||
default:;
|
||||
}
|
||||
break;
|
||||
}
|
||||
;
|
||||
break;
|
||||
|
||||
case TYPEVIA:
|
||||
case TYPETRACK:
|
||||
result = IterateForward( m_Track, inspector, testData, scanTypes );
|
||||
result = IterateForward( m_Track, inspector, testData, p );
|
||||
// skip over any types handled in the above call.
|
||||
for(;;)
|
||||
{
|
||||
switch( stype = *++p )
|
||||
{
|
||||
case TYPEVIA:
|
||||
case TYPETRACK:
|
||||
continue;
|
||||
default:;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_EQUIPOT_STRUCT_TYPE:
|
||||
result = IterateForward( m_Equipots, inspector, testData, scanTypes );
|
||||
result = IterateForward( m_Equipots, inspector, testData, p );
|
||||
++p;
|
||||
break;
|
||||
|
||||
case TYPEZONE:
|
||||
result = IterateForward( m_Zone, inspector, testData, scanTypes );
|
||||
result = IterateForward( m_Zone, inspector, testData, p );
|
||||
++p;
|
||||
break;
|
||||
|
||||
case TYPEEDGEZONE:
|
||||
result = IterateForward( m_CurrentLimitZone, inspector, testData, scanTypes );
|
||||
result = IterateForward( m_CurrentLimitZone, inspector, testData, p );
|
||||
++p;
|
||||
break;
|
||||
|
||||
default:
|
||||
default: // catch EOT or ANY OTHER type here and return.
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1181,17 +1181,25 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
|
|||
KICAD_T stype;
|
||||
SEARCH_RESULT result = SEARCH_CONTINUE;
|
||||
const KICAD_T* p = scanTypes;
|
||||
bool done = false;
|
||||
|
||||
while( (stype = *p++) != EOT )
|
||||
#if defined(DEBUG)
|
||||
std::cout << GetClass().mb_str() << ' ';
|
||||
#endif
|
||||
|
||||
while( !done )
|
||||
{
|
||||
stype = *p;
|
||||
switch( stype )
|
||||
{
|
||||
case TYPEMODULE:
|
||||
result = inspector->Inspect( this, testData ); // inspect me
|
||||
++p;
|
||||
break;
|
||||
|
||||
case TYPEPAD:
|
||||
result = IterateForward( m_Pads, inspector, testData, scanTypes );
|
||||
result = IterateForward( m_Pads, inspector, testData, p );
|
||||
++p;
|
||||
break;
|
||||
|
||||
case TYPETEXTEMODULE:
|
||||
|
@ -1203,15 +1211,26 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
|
|||
if( result == SEARCH_QUIT )
|
||||
break;
|
||||
|
||||
// m_Drawings can hold TYPETEXTMODULE also?
|
||||
result = IterateForward( m_Drawings, inspector, testData, scanTypes );
|
||||
break;
|
||||
// m_Drawings can hold TYPETEXTMODULE also, so fall thru
|
||||
|
||||
case TYPEEDGEMODULE:
|
||||
result = IterateForward( m_Drawings, inspector, testData, scanTypes );
|
||||
result = IterateForward( m_Drawings, inspector, testData, p );
|
||||
// skip over any types handled in the above call.
|
||||
for(;;)
|
||||
{
|
||||
switch( stype = *++p )
|
||||
{
|
||||
case TYPETEXTEMODULE:
|
||||
case TYPEEDGEMODULE:
|
||||
continue;
|
||||
default: ;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,9 +92,10 @@ public:
|
|||
|
||||
/**
|
||||
* Function IsLocked
|
||||
* (virtual from BOARD_ITEM )
|
||||
* @returns bool - true if the MODULE is locked, else false
|
||||
*/
|
||||
bool IsLocked()
|
||||
bool IsLocked() const
|
||||
{
|
||||
return (m_ModuleStatus & MODULE_is_LOCKED) != 0;
|
||||
}
|
||||
|
@ -114,7 +115,7 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/* Readind and writing data on files */
|
||||
/* Reading and writing data on files */
|
||||
int WriteDescr( FILE* File );
|
||||
int Write_3D_Descr( FILE* File );
|
||||
int ReadDescr( FILE* File, int* LineNum = NULL );
|
||||
|
@ -147,6 +148,16 @@ public:
|
|||
bool HitTest( const wxPoint& refPos );
|
||||
|
||||
|
||||
/**
|
||||
* Function GetReference
|
||||
* @return wxString - the reference designator text.
|
||||
*/
|
||||
const wxString& GetReference()
|
||||
{
|
||||
return m_Reference->m_Text;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Visit
|
||||
* should be re-implemented for each derived class in order to handle
|
||||
|
|
|
@ -369,6 +369,40 @@ void TEXTE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
|
|||
}
|
||||
|
||||
|
||||
// see class_text_mod.h
|
||||
bool TEXTE_MODULE::IsOnLayer( int aLayer ) const
|
||||
{
|
||||
if( m_Layer == aLayer )
|
||||
return true;
|
||||
|
||||
/* test the parent, which is a MODULE */
|
||||
if( aLayer == GetParent()->GetLayer() )
|
||||
return true;
|
||||
|
||||
if( aLayer == CUIVRE_N )
|
||||
{
|
||||
if( m_Layer==ADHESIVE_N_CU || m_Layer==SILKSCREEN_N_CU )
|
||||
return true;
|
||||
}
|
||||
|
||||
else if( aLayer == CMP_N )
|
||||
{
|
||||
if( m_Layer==ADHESIVE_N_CMP || m_Layer==SILKSCREEN_N_CMP )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* see class_text_mod.h
|
||||
bool TEXTE_MODULE::IsOnOneOfTheseLayers( int aLayerMask ) const
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
/**
|
||||
* Function Show
|
||||
|
|
|
@ -74,6 +74,31 @@ public:
|
|||
*/
|
||||
bool HitTest( const wxPoint& posref );
|
||||
|
||||
/**
|
||||
* Function IsOnLayer
|
||||
* tests to see if this object is on the given layer. Is virtual so
|
||||
* objects like D_PAD, which reside on multiple layers can do their own
|
||||
* form of testing.
|
||||
* virtual inheritance from BOARD_ITEM.
|
||||
* @param aLayer The layer to test for.
|
||||
* @return bool - true if on given layer, else false.
|
||||
*/
|
||||
bool IsOnLayer( int aLayer ) const;
|
||||
|
||||
/**
|
||||
* Function IsOnOneOfTheseLayers
|
||||
* returns true if this object is on one of the given layers. Is virtual so
|
||||
* objects like D_PAD, which reside on multiple layers, can do their own
|
||||
* form of testing.
|
||||
* virtual inheritance from BOARD_ITEM.
|
||||
* @param aLayerMask The bit-mapped set of layers to test for.
|
||||
* @return bool - true if on one of the given layers, else false.
|
||||
bool IsOnOneOfTheseLayers( int aLayerMask ) const;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
/**
|
||||
* Function GetClass
|
||||
|
|
|
@ -429,3 +429,19 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings( void )
|
|||
m_PadCMPColor = RED; // Pad color for the COPPER side of the pad
|
||||
m_RatsnestColor = WHITE; // Ratsnest color
|
||||
}
|
||||
|
||||
|
||||
// see pcbstruct.h
|
||||
int EDA_BoardDesignSettings::GetVisibleLayers()
|
||||
{
|
||||
int layerMask = 0;
|
||||
|
||||
for( int i=0, mask=1; i< 32; ++i, mask<<=1 )
|
||||
{
|
||||
if( !(m_LayerColor[i] & ITEM_NOT_SHOW) )
|
||||
layerMask |= mask;
|
||||
}
|
||||
|
||||
return layerMask;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#endif
|
||||
|
||||
|
||||
|
||||
/**************************************/
|
||||
/* Classes pour Pistes, Vias et Zones */
|
||||
/**************************************/
|
||||
|
@ -29,19 +28,23 @@ TRACK::TRACK(EDA_BaseStruct * StructFather, DrawStructureType idtype):
|
|||
m_Sous_Netcode = 0;
|
||||
}
|
||||
|
||||
|
||||
SEGZONE::SEGZONE( EDA_BaseStruct* StructFather ) :
|
||||
TRACK( StructFather, TYPEZONE )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SEGVIA::SEGVIA( EDA_BaseStruct* StructFather ) :
|
||||
TRACK( StructFather, TYPEVIA )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/******************************************/
|
||||
bool SEGVIA::IsViaOnLayer( int layer_number )
|
||||
/******************************************/
|
||||
|
||||
/* Retoune TRUE si Via sur layer layer_number
|
||||
*/
|
||||
{
|
||||
|
@ -49,8 +52,10 @@ int via_type = Shape();
|
|||
|
||||
if( via_type == VIA_NORMALE )
|
||||
{
|
||||
if ( layer_number <= LAYER_CMP_N ) return TRUE;
|
||||
else return FALSE;
|
||||
if( layer_number <= LAYER_CMP_N )
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// VIA_BORGNE ou VIA_ENTERREE:
|
||||
|
@ -59,15 +64,17 @@ int bottom_layer, top_layer;
|
|||
ReturnLayerPair( &top_layer, &bottom_layer );
|
||||
if( (bottom_layer <= layer_number) && (top_layer >= layer_number) )
|
||||
return TRUE;
|
||||
else return FALSE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
|
||||
/*********************************************************/
|
||||
|
||||
/* Met a jour .m_Layer pour une via:
|
||||
m_Layer code les 2 couches limitant la via
|
||||
* m_Layer code les 2 couches limitant la via
|
||||
*/
|
||||
{
|
||||
int via_type = m_Shape & 255;
|
||||
|
@ -77,23 +84,29 @@ int via_type = m_Shape & 255;
|
|||
top_layer = LAYER_CMP_N; bottom_layer = LAYER_CUIVRE_N;
|
||||
}
|
||||
|
||||
if ( bottom_layer > top_layer ) EXCHG (bottom_layer, top_layer);
|
||||
if( bottom_layer > top_layer )
|
||||
EXCHG( bottom_layer, top_layer );
|
||||
m_Layer = (top_layer & 15) + ( (bottom_layer & 15) << 4 );
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer )
|
||||
/***************************************************************/
|
||||
|
||||
/* Retourne les 2 couches limitant la via
|
||||
les pointeurs top_layer et bottom_layer peuvent etre NULLs
|
||||
* les pointeurs top_layer et bottom_layer peuvent etre NULLs
|
||||
*/
|
||||
{
|
||||
int b_layer = (m_Layer >> 4) & 15;
|
||||
int t_layer = m_Layer & 15;
|
||||
|
||||
if ( b_layer > t_layer ) EXCHG (b_layer, t_layer);
|
||||
if ( top_layer ) * top_layer = t_layer;
|
||||
if ( bottom_layer ) * bottom_layer = b_layer;
|
||||
if( b_layer > t_layer )
|
||||
EXCHG( b_layer, t_layer );
|
||||
if( top_layer )
|
||||
*top_layer = t_layer;
|
||||
if( bottom_layer )
|
||||
*bottom_layer = b_layer;
|
||||
}
|
||||
|
||||
|
||||
|
@ -105,9 +118,8 @@ TRACK * TRACK::Next(void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* supprime du chainage la structure Struct
|
||||
les structures arrieres et avant sont chainees directement
|
||||
* les structures arrieres et avant sont chainees directement
|
||||
*/
|
||||
void TRACK::UnLink( void )
|
||||
{
|
||||
|
@ -118,12 +130,12 @@ void TRACK::UnLink( void )
|
|||
{
|
||||
Pback->Pnext = Pnext;
|
||||
}
|
||||
|
||||
else /* Le chainage arriere pointe sur la structure "Pere" */
|
||||
{
|
||||
if( GetState( DELETED ) ) // A REVOIR car Pback = NULL si place en undelete
|
||||
{
|
||||
if( g_UnDeleteStack ) g_UnDeleteStack[g_UnDeleteStackPtr-1] = Pnext;
|
||||
if( g_UnDeleteStack )
|
||||
g_UnDeleteStack[g_UnDeleteStackPtr - 1] = Pnext;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -140,22 +152,26 @@ void TRACK::UnLink( void )
|
|||
}
|
||||
|
||||
/* Modification du chainage avant */
|
||||
if( Pnext) Pnext->Pback = Pback;
|
||||
if( Pnext )
|
||||
Pnext->Pback = Pback;
|
||||
|
||||
Pnext = Pback = NULL;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************/
|
||||
void TRACK::Insert( BOARD* Pcb, EDA_BaseStruct* InsertPoint )
|
||||
/************************************************************/
|
||||
|
||||
/* Ajoute un element ou une liste a une liste de base
|
||||
Si Insertpoint == NULL: insertion en debut de
|
||||
liste Pcb->Track ou Pcb->Zone
|
||||
Insertion a la suite de InsertPoint
|
||||
Si InsertPoint == NULL, insertion en tete de liste
|
||||
* Si Insertpoint == NULL: insertion en debut de
|
||||
* liste Pcb->Track ou Pcb->Zone
|
||||
* Insertion a la suite de InsertPoint
|
||||
* Si InsertPoint == NULL, insertion en tete de liste
|
||||
*/
|
||||
{
|
||||
TRACK* track, * NextS;
|
||||
|
||||
/* Insertion du debut de la chaine a greffer */
|
||||
if( InsertPoint == NULL )
|
||||
{
|
||||
|
@ -169,7 +185,6 @@ TRACK* track, *NextS;
|
|||
NextS = Pcb->m_Track; Pcb->m_Track = this;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
NextS = (TRACK*) InsertPoint->Pnext;
|
||||
|
@ -179,104 +194,130 @@ TRACK* track, *NextS;
|
|||
|
||||
/* Chainage de la fin de la liste a greffer */
|
||||
track = this;
|
||||
while ( track->Pnext ) track = (TRACK*) track->Pnext;
|
||||
while( track->Pnext )
|
||||
track = (TRACK*) track->Pnext;
|
||||
|
||||
/* Track pointe la fin de la chaine a greffer */
|
||||
track->Pnext = NextS;
|
||||
if ( NextS ) NextS->Pback = track;
|
||||
if( NextS )
|
||||
NextS->Pback = track;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************/
|
||||
TRACK* TRACK::GetBestInsertPoint( BOARD* Pcb )
|
||||
/***********************************************/
|
||||
|
||||
/* Recherche du meilleur point d'insertion pour le nouveau segment de piste
|
||||
Retourne
|
||||
un pointeur sur le segment de piste APRES lequel l'insertion
|
||||
doit se faire ( dernier segment du net d'apartenance )
|
||||
NULL si pas de piste ( liste vide );
|
||||
* Retourne
|
||||
* un pointeur sur le segment de piste APRES lequel l'insertion
|
||||
* doit se faire ( dernier segment du net d'apartenance )
|
||||
* NULL si pas de piste ( liste vide );
|
||||
*/
|
||||
{
|
||||
TRACK* track, * NextTrack;
|
||||
|
||||
if( m_StructType == TYPEZONE ) track = Pcb->m_Zone;
|
||||
else track = Pcb->m_Track;
|
||||
if( m_StructType == TYPEZONE )
|
||||
track = Pcb->m_Zone;
|
||||
else
|
||||
track = Pcb->m_Track;
|
||||
|
||||
/* Traitement du debut de liste */
|
||||
if ( track == NULL ) return(NULL); /* pas de piste ! */
|
||||
if( track == NULL )
|
||||
return NULL; /* pas de piste ! */
|
||||
if( m_NetCode < track->m_NetCode ) /* insertion en tete de liste */
|
||||
return(NULL);
|
||||
return NULL;
|
||||
|
||||
while( (NextTrack = (TRACK*) track->Pnext) != NULL )
|
||||
{
|
||||
if ( NextTrack->m_NetCode > this->m_NetCode ) break;
|
||||
if( NextTrack->m_NetCode > this->m_NetCode )
|
||||
break;
|
||||
track = NextTrack;
|
||||
}
|
||||
return ( track);
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
|
||||
/* Recherche du debut du net
|
||||
( les elements sont classes par net_code croissant )
|
||||
la recherche se fait a partir de this
|
||||
si net_code == -1 le netcode de this sera utilise
|
||||
Retourne un pointeur sur le debut du net, ou NULL si net non trouve
|
||||
* ( les elements sont classes par net_code croissant )
|
||||
* la recherche se fait a partir de this
|
||||
* si net_code == -1 le netcode de this sera utilise
|
||||
* Retourne un pointeur sur le debut du net, ou NULL si net non trouve
|
||||
*/
|
||||
TRACK* TRACK::GetStartNetCode( int NetCode )
|
||||
{
|
||||
TRACK* Track = this;
|
||||
int ii = 0;
|
||||
|
||||
if( NetCode == -1 ) NetCode = m_NetCode;
|
||||
if( NetCode == -1 )
|
||||
NetCode = m_NetCode;
|
||||
|
||||
while( Track != NULL )
|
||||
{
|
||||
if ( Track->m_NetCode > NetCode ) break;
|
||||
if( Track->m_NetCode > NetCode )
|
||||
break;
|
||||
if( Track->m_NetCode == NetCode )
|
||||
{
|
||||
ii++; break;
|
||||
}
|
||||
Track = (TRACK*) Track->Pnext;
|
||||
}
|
||||
if ( ii ) return(Track);
|
||||
else return (NULL);
|
||||
|
||||
if( ii )
|
||||
return Track;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Recherche de la fin du net
|
||||
Retourne un pointeur sur la fin du net, ou NULL si net non trouve
|
||||
* Retourne un pointeur sur la fin du net, ou NULL si net non trouve
|
||||
*/
|
||||
TRACK* TRACK::GetEndNetCode( int NetCode )
|
||||
{
|
||||
TRACK* NextS, * Track = this;
|
||||
int ii = 0;
|
||||
|
||||
if( Track == NULL ) return(NULL);
|
||||
if( Track == NULL )
|
||||
return NULL;
|
||||
|
||||
if( NetCode == -1 ) NetCode = m_NetCode;
|
||||
if( NetCode == -1 )
|
||||
NetCode = m_NetCode;
|
||||
|
||||
while( Track != NULL )
|
||||
{
|
||||
NextS = (TRACK*) Track->Pnext;
|
||||
if(Track->m_NetCode == NetCode) ii++;
|
||||
if ( NextS == NULL ) break;
|
||||
if ( NextS->m_NetCode > NetCode) break;
|
||||
if( Track->m_NetCode == NetCode )
|
||||
ii++;
|
||||
if( NextS == NULL )
|
||||
break;
|
||||
if( NextS->m_NetCode > NetCode )
|
||||
break;
|
||||
Track = NextS;
|
||||
}
|
||||
if ( ii ) return(Track);
|
||||
else return (NULL);
|
||||
|
||||
if( ii )
|
||||
return Track;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**********************************/
|
||||
TRACK* TRACK:: Copy( int NbSegm )
|
||||
/**********************************/
|
||||
|
||||
/* Copie d'un Element ou d'une chaine de n elements
|
||||
Retourne un pointeur sur le nouvel element ou le debut de la
|
||||
nouvelle chaine
|
||||
* Retourne un pointeur sur le nouvel element ou le debut de la
|
||||
* nouvelle chaine
|
||||
*/
|
||||
{
|
||||
TRACK* NewTrack, * FirstTrack, * OldTrack, * Source = this;
|
||||
int ii;
|
||||
|
||||
FirstTrack = NewTrack = new TRACK( NULL );
|
||||
|
||||
*NewTrack = *Source;
|
||||
|
||||
/* correction du chainage */
|
||||
|
@ -285,15 +326,19 @@ int ii;
|
|||
/* reset des pointeurs auxiliaires */
|
||||
NewTrack->start = NewTrack->end = NULL;
|
||||
|
||||
if( NbSegm <=1 ) return (FirstTrack);
|
||||
if( NbSegm <=1 )
|
||||
return FirstTrack;
|
||||
|
||||
for( ii = 1; ii < NbSegm; ii++ )
|
||||
{
|
||||
Source = (TRACK*) Source->Pnext;
|
||||
if( Source == NULL ) break;
|
||||
if( Source == NULL )
|
||||
break;
|
||||
OldTrack = NewTrack;
|
||||
NewTrack = new TRACK( m_Parent );
|
||||
if ( NewTrack == NULL ) break;
|
||||
|
||||
if( NewTrack == NULL )
|
||||
break;
|
||||
NewTrack->m_StructType = Source->m_StructType;
|
||||
NewTrack->m_Shape = Source->m_Shape;
|
||||
NewTrack->m_NetCode = Source->m_NetCode;
|
||||
|
@ -308,9 +353,10 @@ int ii;
|
|||
NewTrack->Insert( NULL, OldTrack );
|
||||
}
|
||||
|
||||
return (FirstTrack);
|
||||
return FirstTrack;
|
||||
}
|
||||
|
||||
|
||||
/********************************************/
|
||||
bool TRACK::WriteTrackDescr( FILE* File )
|
||||
/********************************************/
|
||||
|
@ -318,9 +364,11 @@ bool TRACK::WriteTrackDescr(FILE * File)
|
|||
int type;
|
||||
|
||||
type = 0;
|
||||
if( m_StructType == TYPEVIA ) type = 1;
|
||||
if( m_StructType == TYPEVIA )
|
||||
type = 1;
|
||||
|
||||
if( GetState(DELETED) ) return FALSE;
|
||||
if( GetState( DELETED ) )
|
||||
return FALSE;
|
||||
|
||||
fprintf( File, "Po %d %d %d %d %d %d\n", m_Shape,
|
||||
m_Start.x, m_Start.y, m_End.x, m_End.y, m_Width );
|
||||
|
@ -331,12 +379,14 @@ int type;
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
|
||||
/*********************************************************************/
|
||||
|
||||
/* routine de trace de 1 segment de piste.
|
||||
Parametres :
|
||||
draw_mode = mode ( GR_XOR, GR_OR..)
|
||||
* Parametres :
|
||||
* draw_mode = mode ( GR_XOR, GR_OR..)
|
||||
*/
|
||||
{
|
||||
int l_piste;
|
||||
|
@ -352,9 +402,11 @@ int curr_layer = ((PCB_SCREEN*)panel->GetScreen())->m_Active_Layer;
|
|||
|
||||
if( m_StructType == TYPEVIA ) /* VIA rencontree */
|
||||
color = g_DesignSettings.m_ViaColor[m_Shape];
|
||||
else color = g_DesignSettings.m_LayerColor[m_Layer];
|
||||
else
|
||||
color = g_DesignSettings.m_LayerColor[m_Layer];
|
||||
|
||||
if( (color & (ITEM_NOT_SHOW | HIGHT_LIGHT_FLAG)) == ITEM_NOT_SHOW) return ;
|
||||
if( ( color & (ITEM_NOT_SHOW | HIGHT_LIGHT_FLAG) ) == ITEM_NOT_SHOW )
|
||||
return;
|
||||
|
||||
if( DisplayOpt.ContrastModeDisplay )
|
||||
{
|
||||
|
@ -375,8 +427,10 @@ int curr_layer = ((PCB_SCREEN*)panel->GetScreen())->m_Active_Layer;
|
|||
|
||||
if( draw_mode & GR_SURBRILL )
|
||||
{
|
||||
if( draw_mode & GR_AND) color &= ~HIGHT_LIGHT_FLAG;
|
||||
else color |= HIGHT_LIGHT_FLAG;
|
||||
if( draw_mode & GR_AND )
|
||||
color &= ~HIGHT_LIGHT_FLAG;
|
||||
else
|
||||
color |= HIGHT_LIGHT_FLAG;
|
||||
}
|
||||
if( color & HIGHT_LIGHT_FLAG )
|
||||
color = ColorRefs[color & MASKCOLOR].m_LightColor;
|
||||
|
@ -387,7 +441,8 @@ int curr_layer = ((PCB_SCREEN*)panel->GetScreen())->m_Active_Layer;
|
|||
|
||||
if( m_StructType == TYPEVIA ) /* VIA rencontree */
|
||||
{
|
||||
rayon = l_piste; if( rayon < zoom ) rayon = zoom;
|
||||
rayon = l_piste; if( rayon < zoom )
|
||||
rayon = zoom;
|
||||
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color );
|
||||
if( rayon > (4 * zoom) )
|
||||
{
|
||||
|
@ -409,7 +464,6 @@ int curr_layer = ((PCB_SCREEN*)panel->GetScreen())->m_Active_Layer;
|
|||
{
|
||||
GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color );
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if( l_piste <= zoom ) /* trace simplifie si l_piste/zoom <= 1 */
|
||||
|
@ -457,4 +511,3 @@ int curr_layer = ((PCB_SCREEN*)panel->GetScreen())->m_Active_Layer;
|
|||
m_Width + (g_DesignSettings.m_TrackClearence * 2), color );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
// see collectors.h
|
||||
const KICAD_T ARROWCOLLECTOR::AllBoardItems[] = {
|
||||
const KICAD_T GENERALCOLLECTOR::AllBoardItems[] = {
|
||||
TYPETEXTE,
|
||||
TYPEDRAWSEGMENT,
|
||||
TYPECOTATION,
|
||||
|
@ -59,45 +59,82 @@ const KICAD_T ARROWCOLLECTOR::AllBoardItems[] = {
|
|||
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
|
||||
* else SCAN_CONTINUE;
|
||||
*/
|
||||
SEARCH_RESULT ARROWCOLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* notUsed )
|
||||
SEARCH_RESULT GENERALCOLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* notUsed )
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
|
||||
|
||||
#if 1 // debugging
|
||||
static int breakhere = 0;
|
||||
switch( item->m_StructType )
|
||||
{
|
||||
case TYPEPAD:
|
||||
breakhere++;
|
||||
break;
|
||||
case TYPEVIA:
|
||||
breakhere++;
|
||||
break;
|
||||
case TYPETRACK:
|
||||
breakhere++;
|
||||
break;
|
||||
case TYPETEXTE:
|
||||
breakhere++;
|
||||
break;
|
||||
case TYPEDRAWSEGMENT:
|
||||
breakhere++;
|
||||
break;
|
||||
case TYPECOTATION:
|
||||
breakhere++;
|
||||
break;
|
||||
case TYPETEXTEMODULE:
|
||||
TEXTE_MODULE* tm;
|
||||
tm = (TEXTE_MODULE*) item;
|
||||
if( tm->m_Text == wxT("U5") )
|
||||
{
|
||||
breakhere++;
|
||||
}
|
||||
break;
|
||||
case TYPEMODULE:
|
||||
breakhere++;
|
||||
break;
|
||||
default:
|
||||
breakhere++;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch( item->m_StructType )
|
||||
{
|
||||
case TYPEPAD:
|
||||
case TYPEVIA:
|
||||
/*
|
||||
if( item->IsOnOneOfTheseLayers( m_LayerMask ) )
|
||||
{
|
||||
if( item->HitTest( refPos ) )
|
||||
Append2nd( testItem );
|
||||
}
|
||||
*/
|
||||
break;
|
||||
|
||||
case TYPETRACK:
|
||||
case TYPETEXTE:
|
||||
case TYPEDRAWSEGMENT:
|
||||
case TYPECOTATION:
|
||||
case TYPETEXTEMODULE:
|
||||
case TYPEMODULE:
|
||||
if( item->GetLayer() == m_PreferredLayer )
|
||||
|
||||
// The primary search criteria:
|
||||
if( item->IsOnLayer( m_PreferredLayer ) )
|
||||
{
|
||||
if( item->HitTest( m_RefPos ) )
|
||||
{
|
||||
if( !item->IsLocked() )
|
||||
Append( item );
|
||||
else
|
||||
Append2nd( item ); // 2nd if locked.
|
||||
}
|
||||
/*
|
||||
}
|
||||
|
||||
// The secondary search criteria
|
||||
else if( item->IsOnOneOfTheseLayers( m_LayerMask ) )
|
||||
{
|
||||
if( item->HitTest( m_RefPos ) )
|
||||
Append2nd( item );
|
||||
}
|
||||
*/
|
||||
break;
|
||||
|
||||
default:
|
||||
; // nothing
|
||||
printf("OOPS, not expecting class type %d\n", item->m_StructType );
|
||||
}
|
||||
|
||||
return SEARCH_CONTINUE;
|
||||
|
@ -105,17 +142,24 @@ SEARCH_RESULT ARROWCOLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* not
|
|||
|
||||
|
||||
// see collectors.h
|
||||
void ARROWCOLLECTOR::Scan( BOARD* board, const wxPoint& refPos,
|
||||
void GENERALCOLLECTOR::Scan( BOARD* board, const wxPoint& refPos,
|
||||
int aPreferredLayer, int aLayerMask )
|
||||
{
|
||||
Empty(); // empty the collection, primary criteria list
|
||||
Empty2nd(); // empty the collection, secondary criteria list
|
||||
|
||||
SetPreferredLayer( aPreferredLayer );
|
||||
SetLayerMask( aLayerMask );
|
||||
|
||||
/* remember where the snapshot was taken from and pass refPos to
|
||||
the Inspect() function.
|
||||
*/
|
||||
SetRefPos( refPos );
|
||||
|
||||
#if defined(DEBUG)
|
||||
std::cout << '\n';
|
||||
#endif
|
||||
|
||||
// visit the board with the INSPECTOR (me).
|
||||
board->Visit( this, // INSPECTOR* inspector
|
||||
NULL, // const void* testData, not used here
|
||||
|
@ -123,7 +167,9 @@ void ARROWCOLLECTOR::Scan( BOARD* board, const wxPoint& refPos,
|
|||
|
||||
SetTimeNow(); // when snapshot was taken
|
||||
|
||||
// @todo: append 2nd list onto end of the first "list"
|
||||
// append 2nd list onto end of the first "list"
|
||||
for( unsigned i=0; i<list2nd.size(); ++i )
|
||||
Append( list2nd[i] );
|
||||
|
||||
Empty2nd();
|
||||
}
|
||||
|
|
|
@ -33,26 +33,18 @@
|
|||
|
||||
#include "class_collector.h"
|
||||
|
||||
|
||||
|
||||
class RAT1COLLECTOR : public COLLECTOR
|
||||
{
|
||||
;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Class ARROWCOLLECTOR
|
||||
* Class GENERALCOLLECTOR
|
||||
* is intended for use when the right click button is pressed, or when the
|
||||
* plain "arrow" tool is in effect. This class can be used by window classes
|
||||
* such as WinEDA_PcbFrame.
|
||||
*
|
||||
* Philosophy: this class knows nothing of the context in which as BOARD is used
|
||||
* Philosophy: this class knows nothing of the context in which a BOARD is used
|
||||
* and that means it knows nothing about which layers are visible or current,
|
||||
* but can handle those concerns by the SetPreferredLayer() function and the
|
||||
* SetLayerMask() fuction.
|
||||
*/
|
||||
class ARROWCOLLECTOR : public COLLECTOR
|
||||
class GENERALCOLLECTOR : public COLLECTOR
|
||||
{
|
||||
/**
|
||||
* A place to hold collected objects which don't match precisely the search
|
||||
|
@ -60,7 +52,7 @@ class ARROWCOLLECTOR : public COLLECTOR
|
|||
* "2nd" choice, which will be appended to the end of COLLECTOR's prime
|
||||
* "list" at the end of the search.
|
||||
*/
|
||||
std::vector<EDA_BaseStruct*> list2nd;
|
||||
std::vector<BOARD_ITEM*> list2nd;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -77,9 +69,9 @@ public:
|
|||
|
||||
|
||||
/**
|
||||
* Constructor ARROWCOLLECTOR
|
||||
* Constructor GENERALCOLLECTOR
|
||||
*/
|
||||
ARROWCOLLECTOR()
|
||||
GENERALCOLLECTOR()
|
||||
{
|
||||
m_LayerMask = 0;
|
||||
SetScanTypes( AllBoardItems );
|
||||
|
@ -90,7 +82,7 @@ public:
|
|||
list2nd.clear();
|
||||
}
|
||||
|
||||
void Append2nd( EDA_BaseStruct* item )
|
||||
void Append2nd( BOARD_ITEM* item )
|
||||
{
|
||||
list2nd.push_back( item );
|
||||
}
|
||||
|
@ -99,7 +91,7 @@ public:
|
|||
/**
|
||||
* Function SetLayerMask
|
||||
* takes a bit-mapped layer mask and records it. During the scan/search,
|
||||
* this is used as a secondary criterion. That is, if there is no direct
|
||||
* this is used as a secondary search criterion. That is, if there is no direct
|
||||
* layer match with COLLECTOR::m_PreferredLayer (the primary criterion),
|
||||
* then an object on any layer given in this bit-map is recorded as a
|
||||
* second choice object if it also HitTest()s true.
|
||||
|
@ -115,6 +107,21 @@ public:
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function operator[int]
|
||||
* overloads COLLECTOR::operator[](int) to return a BOARD_ITEM* instead of
|
||||
* an EDA_BaseStruct* type.
|
||||
* @param ndx The index into the list.
|
||||
* @return BOARD_ITEM* - or something derived from it, or NULL.
|
||||
*/
|
||||
BOARD_ITEM* operator[]( int ndx ) const
|
||||
{
|
||||
if( (unsigned)ndx < (unsigned)GetCount() )
|
||||
return (BOARD_ITEM*) list[ ndx ];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Inspect
|
||||
* is the examining function within the INSPECTOR which is passed to the
|
||||
|
@ -133,6 +140,8 @@ public:
|
|||
* scans a BOARD using this class's Inspector method, which does the collection.
|
||||
* @param board A BOARD to scan.
|
||||
* @param refPos A wxPoint to use in hit-testing.
|
||||
* @param aPreferredLayer The layer meeting the primary search criterion.
|
||||
* @param aLayerMask The layers, in bit-mapped form, meeting the secondary search criterion.
|
||||
*/
|
||||
void Scan( BOARD* board, const wxPoint& refPos, int aPreferredLayer, int aLayerMask );
|
||||
};
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "id.h"
|
||||
#include "protos.h"
|
||||
#include "collectors.h"
|
||||
|
||||
/* Routines Locales : */
|
||||
|
||||
|
@ -44,8 +45,6 @@ void RemoteCommand( const char* cmdline )
|
|||
if( (idcmd == NULL) || (text == NULL) )
|
||||
return;
|
||||
|
||||
// @todo: this code does not reposition the window when the chosen part is scrolled off screen.
|
||||
|
||||
if( strcmp( idcmd, "$PART:" ) == 0 )
|
||||
{
|
||||
msg = CONV_FROM_UTF8( text );
|
||||
|
@ -113,13 +112,13 @@ void RemoteCommand( const char* cmdline )
|
|||
frame->Affiche_Message( msg );
|
||||
}
|
||||
|
||||
if( module ) // center the module on screen.
|
||||
if( module ) // if found, center the module on screen.
|
||||
frame->Recadre_Trace( false );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
EDA_BaseStruct* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( void )
|
||||
BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
|
||||
/***********************************************************************/
|
||||
|
||||
/* Search an item under the mouse cursor.
|
||||
|
@ -127,12 +126,43 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( void )
|
|||
* if nothing found, an item will be searched without layer restriction
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* item;
|
||||
BOARD_ITEM* item;
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
// test scaffolding for Scan():
|
||||
m_Collector->Scan( m_Pcb,
|
||||
GetScreen()->RefPos(true),
|
||||
|
||||
// these two are inadequate, because the layer support
|
||||
// in Kicad is not elegant or easily understood.
|
||||
// The final solution will be a new class COLLECTORS_GUIDE!
|
||||
GetScreen()->m_Active_Layer,
|
||||
g_DesignSettings.GetVisibleLayers()
|
||||
);
|
||||
|
||||
// use only the first one collected for now.
|
||||
item = (*m_Collector)[0]; // grab first one, may be NULL
|
||||
|
||||
std::cout << "collected " << m_Collector->GetCount() << '\n'; // debugging only
|
||||
|
||||
if( item )
|
||||
{
|
||||
item->Display_Infos( this );
|
||||
|
||||
// debugging: print out the collected items, showing their order too.
|
||||
for( unsigned i=0; i<m_Collector->GetCount(); ++i )
|
||||
(*m_Collector)[i]->Show( 0, std::cout );
|
||||
}
|
||||
return item;
|
||||
|
||||
#else
|
||||
|
||||
item = Locate( CURSEUR_OFF_GRILLE, GetScreen()->m_Active_Layer );
|
||||
if( item == NULL )
|
||||
item = Locate( CURSEUR_OFF_GRILLE, -1 );
|
||||
return item;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC* DC, boo
|
|||
g_SaveTime = time( NULL );
|
||||
|
||||
|
||||
#if 0 && defined(DEBUG)
|
||||
#if 1 && defined(DEBUG)
|
||||
// note this seems to freeze up pcbnew when run under the kicad project
|
||||
// manager. runs fine from command prompt.
|
||||
// output the board object tree to stdout:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
|
||||
/* fonctions locales */
|
||||
EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch, int typeloc );
|
||||
MIREPCB* Locate_MirePcb( BOARD_ITEM* PtStruct, int LayerSearch, int typeloc );
|
||||
D_PAD* Locate_Any_Pad( BOARD* Pcb, const wxPoint& ref_pos, bool OnlyCurrentLayer );
|
||||
|
||||
|
||||
|
@ -84,7 +84,7 @@ D_PAD* ReturnPad( MODULE* module, const wxString& name )
|
|||
|
||||
|
||||
/*******************************************************************************/
|
||||
EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
|
||||
BOARD_ITEM* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
|
||||
/*******************************************************************************/
|
||||
|
||||
/* General locate function
|
||||
|
@ -93,7 +93,7 @@ EDA_BaseStruct* WinEDA_BasePcbFrame::Locate( int typeloc, int LayerSearch )
|
|||
*/
|
||||
{
|
||||
int masque_layer;
|
||||
EDA_BaseStruct* item;
|
||||
BOARD_ITEM* item;
|
||||
|
||||
item = Locate_Texte_Pcb( m_Pcb->m_Drawings, LayerSearch, typeloc );
|
||||
if( item )
|
||||
|
@ -324,7 +324,7 @@ EDGE_MODULE* Locate_Edge_Module( MODULE* module, int typeloc )
|
|||
|
||||
|
||||
/*************************************************************************/
|
||||
EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
|
||||
COTATION* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
|
||||
/*************************************************************************/
|
||||
|
||||
/* Serach for a cotation item , on LayerSearch,
|
||||
|
@ -334,8 +334,8 @@ EDA_BaseStruct* Locate_Cotation( BOARD* Pcb, int LayerSearch, int typeloc )
|
|||
{
|
||||
wxPoint ref_pos = RefPos( typeloc );
|
||||
|
||||
EDA_BaseStruct* PtStruct = Pcb->m_Drawings;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
||||
BOARD_ITEM* PtStruct = Pcb->m_Drawings;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
{
|
||||
if( PtStruct->m_StructType != TYPECOTATION )
|
||||
continue;
|
||||
|
@ -1027,8 +1027,7 @@ TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr,
|
|||
|
||||
|
||||
/***********************************************************************/
|
||||
EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch,
|
||||
int typeloc )
|
||||
MIREPCB* Locate_MirePcb( BOARD_ITEM* PtStruct, int LayerSearch, int typeloc )
|
||||
/***********************************************************************/
|
||||
|
||||
/* Search for a photo target
|
||||
|
@ -1041,20 +1040,18 @@ EDA_BaseStruct* Locate_MirePcb( EDA_BaseStruct* PtStruct, int LayerSearch,
|
|||
|
||||
ref_pos = RefPos( typeloc );
|
||||
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
{
|
||||
MIREPCB* item;
|
||||
if( PtStruct->m_StructType != TYPEMIRE )
|
||||
continue;
|
||||
|
||||
item = (MIREPCB*) PtStruct;
|
||||
if( LayerSearch != -1 && item->GetLayer() != LayerSearch )
|
||||
if( LayerSearch != -1 && PtStruct->GetLayer() != LayerSearch )
|
||||
continue;
|
||||
|
||||
if( item->HitTest( ref_pos ) )
|
||||
if( PtStruct->HitTest( ref_pos ) )
|
||||
break;
|
||||
}
|
||||
|
||||
return PtStruct;
|
||||
return (MIREPCB*) PtStruct;
|
||||
}
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
|
|||
m_SelViaSizeBox_Changed = FALSE;
|
||||
|
||||
#if defined(DEBUG)
|
||||
m_ArrowCollector = new ARROWCOLLECTOR();
|
||||
m_Collector = new GENERALCOLLECTOR();
|
||||
#endif
|
||||
|
||||
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
|
||||
|
@ -243,7 +243,7 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame( void )
|
|||
m_CurrentScreen = ScreenPcb;
|
||||
|
||||
#if defined(DEBUG)
|
||||
delete m_ArrowCollector;
|
||||
delete m_Collector;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ TRACK * Locate_Zone(TRACK * start_adresse, const wxPoint & ref_pos,int layer);
|
|||
La recherche commence a l'adresse start_adresse
|
||||
*/
|
||||
|
||||
EDA_BaseStruct * Locate_Cotation(BOARD * Pcb, int LayerSearch, int typeloc);
|
||||
COTATION* Locate_Cotation(BOARD * Pcb, int LayerSearch, int typeloc);
|
||||
/* Localise un element de cotation, en priorite sur la couche active,
|
||||
et a defaut sur les autres couches
|
||||
retourne un pointeur sur l'element (TRACK ou TEXTE_PCB) localise
|
||||
|
|
|
@ -452,6 +452,7 @@ static ColorButton * laytool_list[] = {
|
|||
&Layer_27_Butt,
|
||||
&Layer_28_Butt,
|
||||
&Layer_29_Butt,
|
||||
|
||||
// &Layer_30_Butt,
|
||||
// &Layer_31_Butt,
|
||||
|
||||
|
@ -496,9 +497,11 @@ private:
|
|||
void SetColor( wxCommandEvent& event );
|
||||
void SetDisplayOnOff( wxCommandEvent& event );
|
||||
void ResetDisplayLayersCu( wxCommandEvent& event );
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
/* Table des evenements pour WinEDA_SetColorsFrame */
|
||||
BEGIN_EVENT_TABLE( WinEDA_SetColorsFrame, wxDialog )
|
||||
EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_OFF, WinEDA_SetColorsFrame::ResetDisplayLayersCu )
|
||||
|
@ -559,6 +562,7 @@ void DisplayColorSetupFrame(WinEDA_DrawFrame * parent,
|
|||
{
|
||||
WinEDA_SetColorsFrame* frame =
|
||||
new WinEDA_SetColorsFrame( parent,framepos);
|
||||
|
||||
frame->ShowModal(); frame->Destroy();
|
||||
}
|
||||
|
||||
|
@ -576,39 +580,47 @@ wxBitmapButton * ButtonB;
|
|||
int ii, yy, xx, butt_ID, buttcolor;
|
||||
wxPoint pos;
|
||||
wxSize winsize;
|
||||
int w = BUTT_SIZE_X, h = BUTT_SIZE_Y;
|
||||
int w = BUTT_SIZE_X;
|
||||
int h = BUTT_SIZE_Y;
|
||||
wxString msg;
|
||||
|
||||
m_Parent = parent;
|
||||
SetFont( *g_DialogFont );
|
||||
|
||||
pos.x = 5; pos.y = START_Y;
|
||||
pos.x = 5;
|
||||
pos.y = START_Y;
|
||||
|
||||
for( ii = 0; laytool_list[ii] != NULL; ii++ )
|
||||
{
|
||||
if( !laytool_list[ii]->m_Color && !laytool_list[ii]->m_NoDisplay )
|
||||
{
|
||||
if( pos.y != START_Y )
|
||||
{
|
||||
pos.x += w + 120; pos.y = START_Y;
|
||||
pos.x += w + 120;
|
||||
pos.y = START_Y;
|
||||
}
|
||||
|
||||
if( laytool_list[ii]->m_LayerNumber >= 0 )
|
||||
{
|
||||
if( laytool_list[ii]->m_Title == wxT( "*" ) )
|
||||
{
|
||||
msg = g_ViaType_Name[laytool_list[ii]->m_LayerNumber];
|
||||
}
|
||||
else msg = ReturnPcbLayerName(laytool_list[ii]->m_LayerNumber);
|
||||
else
|
||||
msg = ReturnPcbLayerName( laytool_list[ii]->m_LayerNumber );
|
||||
}
|
||||
else
|
||||
msg = wxGetTranslation( laytool_list[ii]->m_Title.GetData() );
|
||||
|
||||
new wxStaticText( this, -1, msg,
|
||||
wxPoint (pos.x + 10, pos.y - 18 ), wxSize( -1, -1 ), 0 );
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if( laytool_list[ii]->m_Id == 0 )
|
||||
laytool_list[ii]->m_Id = ID_COLOR_SETUP + ii;
|
||||
|
||||
butt_ID = laytool_list[ii]->m_Id;
|
||||
|
||||
laytool_list[ii]->m_CheckBox = new wxCheckBox( this,
|
||||
|
@ -619,9 +631,9 @@ wxString msg;
|
|||
{
|
||||
if( *laytool_list[ii]->m_Color & ITEM_NOT_SHOW )
|
||||
laytool_list[ii]->m_CheckBox->SetValue( FALSE );
|
||||
else laytool_list[ii]->m_CheckBox->SetValue(TRUE);
|
||||
else
|
||||
laytool_list[ii]->m_CheckBox->SetValue( TRUE );
|
||||
}
|
||||
|
||||
else if( laytool_list[ii]->m_NoDisplay )
|
||||
laytool_list[ii]->m_CheckBox->SetValue( *laytool_list[ii]->m_NoDisplay );
|
||||
|
||||
|
@ -630,17 +642,24 @@ wxString msg;
|
|||
if( laytool_list[ii]->m_Color )
|
||||
{
|
||||
wxMemoryDC iconDC;
|
||||
|
||||
wxBitmap ButtBitmap( w, h );
|
||||
|
||||
iconDC.SelectObject( ButtBitmap );
|
||||
|
||||
buttcolor = *laytool_list[ii]->m_Color & MASKCOLOR;
|
||||
|
||||
wxBrush Brush;
|
||||
|
||||
iconDC.SelectObject( ButtBitmap );
|
||||
iconDC.SetPen( *wxBLACK_PEN );
|
||||
|
||||
Brush.SetColour(
|
||||
ColorRefs[buttcolor].m_Red,
|
||||
ColorRefs[buttcolor].m_Green,
|
||||
ColorRefs[buttcolor].m_Blue
|
||||
);
|
||||
|
||||
Brush.SetStyle( wxSOLID );
|
||||
|
||||
iconDC.SetBrush( Brush );
|
||||
|
@ -650,6 +669,7 @@ wxString msg;
|
|||
ButtBitmap,
|
||||
wxPoint(pos.x + xx, pos.y),
|
||||
wxSize(w, h) );
|
||||
|
||||
laytool_list[ii]->m_Button = ButtonB;
|
||||
xx += 3 + w;
|
||||
}
|
||||
|
@ -660,7 +680,8 @@ wxString msg;
|
|||
{
|
||||
msg = g_ViaType_Name[laytool_list[ii]->m_LayerNumber];
|
||||
}
|
||||
else msg = ReturnPcbLayerName(laytool_list[ii]->m_LayerNumber);
|
||||
else
|
||||
msg = ReturnPcbLayerName( laytool_list[ii]->m_LayerNumber );
|
||||
}
|
||||
else
|
||||
msg = wxGetTranslation( laytool_list[ii]->m_Title.GetData() );
|
||||
|
@ -673,21 +694,28 @@ wxString msg;
|
|||
pos.y += yy;
|
||||
}
|
||||
|
||||
pos.x = 150; pos.y = 300;
|
||||
pos.x = 150;
|
||||
pos.y = 300;
|
||||
|
||||
wxButton* Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_ON,
|
||||
_( "Show All" ), pos );
|
||||
|
||||
Button->SetForegroundColour( wxColor( 0, 100, 0 ) );
|
||||
|
||||
pos.y += Button->GetSize().y + 2;
|
||||
Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_OFF,
|
||||
_( "Show None" ), pos );
|
||||
|
||||
Button->SetForegroundColour( wxColor( 100, 0, 0 ) );
|
||||
|
||||
pos.x += Button->GetSize().x + 50;
|
||||
Button = new wxButton( this, ID_COLOR_EXIT,
|
||||
_( "Exit" ), pos );
|
||||
|
||||
Button->SetForegroundColour( *wxBLUE );
|
||||
winsize.x = 500; winsize.y = pos.y + Button->GetSize().y + 5;
|
||||
|
||||
winsize.x = 500;
|
||||
winsize.y = pos.y + Button->GetSize().y + 5;
|
||||
SetClientSize( winsize );
|
||||
}
|
||||
|
||||
|
@ -709,16 +737,20 @@ int id = event.GetId();
|
|||
int color;
|
||||
int w = BUTT_SIZE_X, h = BUTT_SIZE_Y;
|
||||
|
||||
|
||||
color = DisplayColorFrame( this );
|
||||
if ( color < 0) return;
|
||||
if( color < 0 )
|
||||
return;
|
||||
|
||||
for( ii = 0; laytool_list[ii] != NULL; ii++ )
|
||||
{
|
||||
if( laytool_list[ii]->m_Id != id) continue;
|
||||
if( laytool_list[ii]->m_Color == NULL) continue;
|
||||
if( laytool_list[ii]->m_Id != id )
|
||||
continue;
|
||||
|
||||
if( *laytool_list[ii]->m_Color == color) break;
|
||||
if( laytool_list[ii]->m_Color == NULL )
|
||||
continue;
|
||||
|
||||
if( *laytool_list[ii]->m_Color == color )
|
||||
break;
|
||||
|
||||
*laytool_list[ii]->m_Color = color;
|
||||
wxMemoryDC iconDC;
|
||||
|
@ -728,13 +760,16 @@ int w = BUTT_SIZE_X, h = BUTT_SIZE_Y;
|
|||
wxBitmap ButtBitmap = Button->GetBitmapLabel();
|
||||
iconDC.SelectObject( ButtBitmap );
|
||||
int buttcolor = *laytool_list[ii]->m_Color;
|
||||
|
||||
wxBrush Brush;
|
||||
|
||||
iconDC.SetPen( *wxBLACK_PEN );
|
||||
Brush.SetColour(
|
||||
ColorRefs[buttcolor].m_Red,
|
||||
ColorRefs[buttcolor].m_Green,
|
||||
ColorRefs[buttcolor].m_Blue
|
||||
);
|
||||
|
||||
Brush.SetStyle( wxSOLID );
|
||||
|
||||
iconDC.SetBrush( Brush );
|
||||
|
@ -744,6 +779,7 @@ int w = BUTT_SIZE_X, h = BUTT_SIZE_Y;
|
|||
SetDisplayOnOff( event );
|
||||
m_Parent->m_CurrentScreen->SetRefreshReq();
|
||||
}
|
||||
|
||||
Refresh( FALSE );
|
||||
}
|
||||
|
||||
|
@ -754,17 +790,20 @@ void WinEDA_SetColorsFrame::SetDisplayOnOff(wxCommandEvent& event)
|
|||
{
|
||||
for( int ii = 0; laytool_list[ii] != NULL; ii++ )
|
||||
{
|
||||
if ( laytool_list[ii]->m_CheckBox == NULL ) continue;
|
||||
if ( ! laytool_list[ii]->m_NoDisplayIsColor &&
|
||||
(laytool_list[ii]->m_NoDisplay == NULL) ) continue;
|
||||
if( laytool_list[ii]->m_CheckBox == NULL )
|
||||
continue;
|
||||
|
||||
if( !laytool_list[ii]->m_NoDisplayIsColor
|
||||
&& (laytool_list[ii]->m_NoDisplay == NULL) )
|
||||
continue;
|
||||
|
||||
if( laytool_list[ii]->m_NoDisplayIsColor )
|
||||
{
|
||||
if( laytool_list[ii]->m_CheckBox->GetValue() )
|
||||
*laytool_list[ii]->m_Color &= ~ITEM_NOT_SHOW;
|
||||
else *laytool_list[ii]->m_Color |= ITEM_NOT_SHOW;
|
||||
else
|
||||
*laytool_list[ii]->m_Color |= ITEM_NOT_SHOW;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
*laytool_list[ii]->m_NoDisplay = laytool_list[ii]->m_CheckBox->GetValue();
|
||||
|
@ -783,10 +822,11 @@ bool NewState = (event.GetId() == ID_COLOR_RESET_SHOW_LAYER_ON) ? TRUE : FALSE;
|
|||
|
||||
for( int ii = 1; ii < 17; ii++ )
|
||||
{
|
||||
if ( laytool_list[ii]->m_CheckBox == NULL ) continue;
|
||||
if( laytool_list[ii]->m_CheckBox == NULL )
|
||||
continue;
|
||||
|
||||
laytool_list[ii]->m_CheckBox->SetValue( NewState );
|
||||
}
|
||||
|
||||
SetDisplayOnOff( event );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue