Commit 74a635c1 authored by dickelbeck's avatar dickelbeck

see 2007-Sep-4 change_log.txt

parent 8383ce25
...@@ -4,6 +4,18 @@ Started 2007-June-11 ...@@ -4,6 +4,18 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Sep-4 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew
* Made GENERAL_COLLECTORS_GUIDE and GENERAL_COLLECTOR useable. They can now
serve as a fully functional replacement for PcbGeneralLocateAndDisplay(),
see DEBUG code in BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay().
* Made GENERAL_COLLECTOR capable of Collect()ing from a MODULE as well as a BOARD.
* pcbnew/onrightclick.cpp changed English from "Free Module" to "Unlock Module".
Next I hope to add some UI to handle multiple items under the mouse in onrightclick.cpp
2007-sept-04 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-sept-04 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+ pcbnew + pcbnew
...@@ -39,8 +51,6 @@ email address. ...@@ -39,8 +51,6 @@ email address.
be instantiated. This was not happening in ioascii.cpp when reading be instantiated. This was not happening in ioascii.cpp when reading
the vias. Bug fixed. the vias. Bug fixed.
* GENERAL_COLLECTOR getting closer to useable. * GENERAL_COLLECTOR getting closer to useable.
@todo search further for new TRACK( TRACK* ) and make sure no vias are
being made this way.
2007-aug-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-aug-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
......
...@@ -43,7 +43,8 @@ OBJECTS = $(TARGET).o \ ...@@ -43,7 +43,8 @@ OBJECTS = $(TARGET).o \
class_edge_mod.o \ class_edge_mod.o \
class_equipot.o \ class_equipot.o \
class_track.o\ class_track.o\
basepcbframe.o basepcbframe.o\
collectors.o
cvpcb.o: cvpcb.cpp cvpcb.h $(DEPEND) cvpcb.o: cvpcb.cpp cvpcb.h $(DEPEND)
...@@ -99,6 +100,9 @@ class_equipot.o: ../pcbnew/class_equipot.cpp $(DEPEND) ...@@ -99,6 +100,9 @@ class_equipot.o: ../pcbnew/class_equipot.cpp $(DEPEND)
basepcbframe.o: ../pcbnew/basepcbframe.cpp $(DEPEND) basepcbframe.o: ../pcbnew/basepcbframe.cpp $(DEPEND)
$(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp
collectors.o: ../pcbnew/collectors.cpp $(COMMON)
$(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp
readschematicnetlist.o: readschematicnetlist.cpp $(DEPEND) readschematicnetlist.o: readschematicnetlist.cpp $(DEPEND)
viewlogi.o: viewlogi.cpp $(DEPEND) viewlogi.o: viewlogi.cpp $(DEPEND)
......
...@@ -45,7 +45,8 @@ OBJECTS= \ ...@@ -45,7 +45,8 @@ OBJECTS= \
block.o\ block.o\
controle.o\ controle.o\
basepcbframe.o\ basepcbframe.o\
export_to_pcbnew.o export_to_pcbnew.o\
collectors.o
setpage.o: ../share/setpage.cpp setpage.o: ../share/setpage.cpp
$(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
...@@ -85,6 +86,9 @@ class_board.o: ../pcbnew/class_board.cpp $(DEPEND) ...@@ -85,6 +86,9 @@ class_board.o: ../pcbnew/class_board.cpp $(DEPEND)
basepcbframe.o: ../pcbnew/basepcbframe.cpp $(COMMON) basepcbframe.o: ../pcbnew/basepcbframe.cpp $(COMMON)
$(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp
collectors.o: ../pcbnew/collectors.cpp $(COMMON)
$(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp
class_track.o: ../pcbnew/class_track.cpp $(COMMON) class_track.o: ../pcbnew/class_track.cpp $(COMMON)
$(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp
......
...@@ -97,6 +97,7 @@ class PARAM_CFG_BASE; ...@@ -97,6 +97,7 @@ class PARAM_CFG_BASE;
class Ki_PageDescr; class Ki_PageDescr;
class Ki_HotkeyInfo; class Ki_HotkeyInfo;
class GENERAL_COLLECTOR; class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
enum id_librarytype { enum id_librarytype {
...@@ -338,6 +339,12 @@ public: ...@@ -338,6 +339,12 @@ public:
bool m_DisplayPcbTrackFill; /* FALSE = sketch , TRUE = rempli */ bool m_DisplayPcbTrackFill; /* FALSE = sketch , TRUE = rempli */
WinEDA3D_DrawFrame* m_Draw3DFrame; WinEDA3D_DrawFrame* m_Draw3DFrame;
protected:
#if defined(DEBUG)
GENERAL_COLLECTOR* m_Collector;
#endif
public: public:
WinEDA_BasePcbFrame( wxWindow* father, WinEDA_App* parent, int idtype, WinEDA_BasePcbFrame( wxWindow* father, WinEDA_App* parent, int idtype,
const wxString& title, const wxString& title,
...@@ -372,11 +379,6 @@ private: ...@@ -372,11 +379,6 @@ private:
virtual void GetComponentFromUndoList(); virtual void GetComponentFromUndoList();
virtual void GetComponentFromRedoList(); virtual void GetComponentFromRedoList();
#if defined(DEBUG)
protected:
GENERAL_COLLECTOR* m_Collector;
#endif
public: public:
// Read/write fonctions: // Read/write fonctions:
...@@ -393,6 +395,14 @@ public: ...@@ -393,6 +395,14 @@ public:
BOARD_ITEM* PcbGeneralLocateAndDisplay(); BOARD_ITEM* PcbGeneralLocateAndDisplay();
BOARD_ITEM* Locate( int typeloc, int LayerSearch ); BOARD_ITEM* Locate( int typeloc, int LayerSearch );
#if defined(DEBUG)
/**
* Function GetCollectorsGuide
* @return GENERAL_COLLECTORS_GUIDE - that considers the global configuration options.
*/
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
#endif
// Gestion du curseur // Gestion du curseur
void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap, void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap,
int DrawMode, int color, int type ); int DrawMode, int color, int type );
...@@ -522,6 +532,7 @@ private: ...@@ -522,6 +532,7 @@ private:
bool m_SelViaSizeBox_Changed; bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu; wxMenu* m_FilesMenu;
public: public:
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
...@@ -764,6 +775,8 @@ public: ...@@ -764,6 +775,8 @@ public:
EDA_BaseStruct* GerberGeneralLocateAndDisplay(); EDA_BaseStruct* GerberGeneralLocateAndDisplay();
EDA_BaseStruct* Locate( int typeloc ); EDA_BaseStruct* Locate( int typeloc );
void SetToolbars(); void SetToolbars();
void Process_Settings( wxCommandEvent& event ); void Process_Settings( wxCommandEvent& event );
......
/************************************************************************/ /************************************************************************/
/* basepcbframe.cpp - fonctions des classes du type WinEDA_BasePcbFrame */ /* basepcbframe.cpp - fonctions des classes du type WinEDA_BasePcbFrame */
/************************************************************************/ /************************************************************************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
...@@ -15,89 +15,108 @@ ...@@ -15,89 +15,108 @@
#include "protos.h" #include "protos.h"
#include "id.h" #include "id.h"
#if defined(DEBUG)
#include "collectors.h"
#endif
/*******************************/ /*******************************/
/* class WinEDA_BasePcbFrame */ /* class WinEDA_BasePcbFrame */
/*******************************/ /*******************************/
/****************/ /****************/
/* Constructeur */ /* Constructeur */
/****************/ /****************/
WinEDA_BasePcbFrame::WinEDA_BasePcbFrame(wxWindow * father, WinEDA_App *parent, WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
int idtype, WinEDA_App* parent,
const wxString & title, const wxPoint& pos, const wxSize& size) : int idtype,
WinEDA_DrawFrame(father, idtype, parent, title, pos, size) const wxString& title,
const wxPoint& pos,
const wxSize& size ) :
WinEDA_DrawFrame( father, idtype, parent, title, pos, size )
{ {
m_InternalUnits = 10000; // Internal unit = 1/10000 inch m_InternalUnits = 10000; // Internal unit = 1/10000 inch
m_CurrentScreen = NULL; m_CurrentScreen = NULL;
m_Pcb = NULL; m_Pcb = NULL;
m_DisplayPadFill = TRUE; // How to draw pads m_DisplayPadFill = TRUE; // How to draw pads
m_DisplayPadNum = TRUE; // show pads number m_DisplayPadNum = TRUE; // show pads number
m_DisplayModEdge = FILLED; // How to show module drawings m_DisplayModEdge = FILLED; // How to show module drawings
m_DisplayModText = FILLED; // How to show module texts m_DisplayModText = FILLED; // How to show module texts
m_DisplayPcbTrackFill = TRUE; /* FALSE = sketch , TRUE = filled */ m_DisplayPcbTrackFill = TRUE; /* FALSE = sketch , TRUE = filled */
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL) m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
#if defined(DEBUG)
m_Collector = new GENERAL_COLLECTOR();
#endif
} }
WinEDA_BasePcbFrame::~WinEDA_BasePcbFrame(void)
WinEDA_BasePcbFrame::~WinEDA_BasePcbFrame( void )
{ {
#if defined(DEBUG)
delete m_Collector;
#endif
} }
/**************************************/ /**************************************/
int WinEDA_BasePcbFrame::BestZoom(void) int WinEDA_BasePcbFrame::BestZoom( void )
/**************************************/ /**************************************/
{ {
int dx, dy, ii,jj ; int dx, dy, ii, jj;
int bestzoom; int bestzoom;
wxSize size; wxSize size;
if ( m_Pcb == NULL ) return 32; if( m_Pcb == NULL )
return 32;
m_Pcb->ComputeBoundaryBox(); m_Pcb->ComputeBoundaryBox();
/* calcul du zoom montrant tout le dessim */ /* calcul du zoom montrant tout le dessim */
dx = m_Pcb->m_BoundaryBox.GetWidth(); dx = m_Pcb->m_BoundaryBox.GetWidth();
dy = m_Pcb->m_BoundaryBox.GetHeight(); dy = m_Pcb->m_BoundaryBox.GetHeight();
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
ii = (dx + (size.x/2)) / size.x; ii = ( dx + (size.x / 2) ) / size.x;
jj = (dy + (size.y/2)) / size.y; jj = ( dy + (size.y / 2) ) / size.y;
bestzoom = MAX(ii, jj) + 1; bestzoom = MAX( ii, jj ) + 1;
m_CurrentScreen->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); m_CurrentScreen->m_Curseur = m_Pcb->m_BoundaryBox.Centre();
return(bestzoom); return bestzoom;
} }
void WinEDA_BasePcbFrame::ReCreateMenuBar(void) // fonction virtuelle void WinEDA_BasePcbFrame::ReCreateMenuBar( void ) // fonction virtuelle
{ {
} }
#include "3d_viewer.h" #include "3d_viewer.h"
/***********************************************************/ /***********************************************************/
void WinEDA_BasePcbFrame::Show3D_Frame(wxCommandEvent& event) void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event )
/***********************************************************/ /***********************************************************/
/* Ouvre la frame d'affichage 3D /* Ouvre la frame d'affichage 3D
*/ */
{ {
#ifndef GERBVIEW #ifndef GERBVIEW
// Create the main frame window
if ( m_Draw3DFrame ) // Create the main frame window
{ if( m_Draw3DFrame )
DisplayInfo(this, _("3D Frame already opened") ); {
return; DisplayInfo( this, _( "3D Frame already opened" ) );
} return;
m_Draw3DFrame = new WinEDA3D_DrawFrame(this, m_Parent, _("3D Viewer") ); }
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, m_Parent, _( "3D Viewer" ) );
// Show the frame
m_Draw3DFrame->Show(TRUE); // Show the frame
m_Draw3DFrame->Show( TRUE );
#endif #endif
} }
...@@ -105,43 +124,67 @@ void WinEDA_BasePcbFrame::Show3D_Frame(wxCommandEvent& event) ...@@ -105,43 +124,67 @@ void WinEDA_BasePcbFrame::Show3D_Frame(wxCommandEvent& event)
/* Virtual functions: Do nothing for WinEDA_BasePcbFrame window */ /* Virtual functions: Do nothing for WinEDA_BasePcbFrame window */
/***********************************************************************************/ /***********************************************************************************/
void WinEDA_BasePcbFrame::SaveCopyInUndoList(EDA_BaseStruct * ItemToCopy, int flag) void WinEDA_BasePcbFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag )
/***********************************************************************************/ /***********************************************************************************/
{ {
} }
/********************************************************/ /********************************************************/
void WinEDA_BasePcbFrame::GetComponentFromUndoList(void) void WinEDA_BasePcbFrame::GetComponentFromUndoList( void )
/********************************************************/ /********************************************************/
{ {
} }
/********************************************************/ /********************************************************/
void WinEDA_BasePcbFrame::GetComponentFromRedoList(void) void WinEDA_BasePcbFrame::GetComponentFromRedoList( void )
/********************************************************/ /********************************************************/
{ {
} }
/****************************************************************/ /****************************************************************/
void WinEDA_BasePcbFrame::SwitchLayer(wxDC *DC, int layer) void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
/*****************************************************************/ /*****************************************************************/
{ {
//Note: virtual, overridden in WinEDA_PcbFrame; //Note: virtual, overridden in WinEDA_PcbFrame;
int preslayer = GetScreen()->m_Active_Layer; int preslayer = GetScreen()->m_Active_Layer;
//if there is only one layer, don't switch.
if ( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1) //if there is only one layer, don't switch.
layer = LAYER_CUIVRE_N; // Of course we select the copper layer if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 )
//otherwise, we select the requested layer only if it is possible layer = LAYER_CUIVRE_N; // Of course we select the copper layer
if( layer != LAYER_CMP_N && layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount-1 )
return; //otherwise, we select the requested layer only if it is possible
if(preslayer == layer) if( layer != LAYER_CMP_N && layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
return; return;
GetScreen()->m_Active_Layer = layer; if( preslayer == layer )
return;
if ( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq(); GetScreen()->m_Active_Layer = layer;
if( DisplayOpt.ContrastModeDisplay )
GetScreen()->SetRefreshReq();
} }
#if defined(DEBUG)
/****************************************************************/
GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
/****************************************************************/
{
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->m_BoardSettings->GetVisibleLayers(),
GetScreen()->m_Active_Layer );
// account for the globals
guide.SetIgnoreMTextsMarkedNoShow( g_ModuleTextNOVColor & ITEM_NOT_SHOW );
guide.SetIgnoreMTextsOnCopper( g_ModuleTextCUColor & ITEM_NOT_SHOW );
guide.SetIgnoreMTextsOnCmp( g_ModuleTextCMPColor & ITEM_NOT_SHOW );
guide.SetIgnoreModulesOnCu( !DisplayOpt.Show_Modules_Cu );
guide.SetIgnoreModulesOnCmp( !DisplayOpt.Show_Modules_Cmp );
return guide;
}
#endif
...@@ -68,62 +68,95 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* ...@@ -68,62 +68,95 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
switch( item->Type() ) switch( item->Type() )
{ {
case TYPEPAD: case TYPEPAD:
breakhere++; breakhere++;
break; break;
case TYPEVIA: case TYPEVIA:
breakhere++; breakhere++;
break; break;
case TYPETRACK: case TYPETRACK:
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; {
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; {
m = (MODULE*) item; MODULE* m = (MODULE*) item;
if( m->GetReference() == wxT("L1") ) if( m->GetReference() == wxT("C98") )
{ {
breakhere++; breakhere++;
} }
break; }
break;
default: default:
breakhere++; breakhere++;
break; break;
} }
#endif #endif
#if 1
/* switch( item->Type() )
int m_PreferredLayer; x {
bool m_IgnorePreferredLayer case TYPEPAD:
int m_LayerVisible; x break;
bool m_IgnoreNonVisibleLayers; case TYPEVIA:
break;
int m_LayerLocked; x case TYPETRACK:
bool m_IgnoreLockedLayers; break;
case TYPETEXTE:
break;
case TYPEDRAWSEGMENT:
break;
case TYPECOTATION:
break;
case TYPETEXTEMODULE:
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
MODULE* parent = (MODULE*)tm->GetParent();
if( m_Guide->IgnoreMTextsMarkedNoShow() && tm->m_NoShow )
goto exit;
if( parent )
{
if( m_Guide->IgnoreMTextsOnCopper() && parent->GetLayer()==LAYER_CUIVRE_N )
goto exit;
if( m_Guide->IgnoreMTextsOnCmp() && parent->GetLayer()==LAYER_CMP_N )
goto exit;
}
}
break;
case TYPEMODULE:
if( m_Guide->IgnoreModulesOnCu() && item->GetLayer()==LAYER_CUIVRE_N )
goto exit;
if( m_Guide->IgnoreModulesOnCmp() && item->GetLayer()==LAYER_CMP_N )
goto exit;
break;
default:
break;
}
bool m_IgnoreLockedItems; x // common tests:
bool m_IncludeSecondary;
*/
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();
...@@ -144,6 +177,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* ...@@ -144,6 +177,7 @@ 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
...@@ -168,27 +202,6 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void* ...@@ -168,27 +202,6 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
} }
} }
#else
// 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 );
}
#endif
exit: exit:
return SEARCH_CONTINUE; // always when collecting return SEARCH_CONTINUE; // always when collecting
} }
...@@ -229,21 +242,21 @@ void GENERAL_COLLECTOR::Collect( BOARD* board, const wxPoint& refPos, ...@@ -229,21 +242,21 @@ void GENERAL_COLLECTOR::Collect( BOARD* board, const wxPoint& refPos,
// see collectors.h // see collectors.h
void GENERAL_COLLECTOR::Collect( BOARD* board, const wxPoint& refPos, void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const wxPoint& refPos,
const COLLECTORS_GUIDE* guide ) 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
// remember guide, pass it to Inspect() // remember guide, pass it to Inspect()
SetGuide( guide ); SetGuide( aGuide );
// 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( refPos ); SetRefPos( refPos );
// visit the board with the INSPECTOR (me). // visit the board with the INSPECTOR (me).
board->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);
...@@ -257,24 +270,6 @@ void GENERAL_COLLECTOR::Collect( BOARD* board, const wxPoint& refPos, ...@@ -257,24 +270,6 @@ void GENERAL_COLLECTOR::Collect( BOARD* board, const wxPoint& refPos,
} }
/** is still inline
* Constructor GENERAL_COLLECTORS_GUIDE
* grabs stuff from global preferences and uses reasonable defaults.
* Add more constructors as needed.
GENERAL_COLLECTORS_GUIDE::GENERAL_COLLECTORS_GUIDE()
{
m_LayerLocked;
m_LayerVisible;
m_IgnoreLockedLayers;
m_IgnoreNonVisibleLayers;
m_PreferredLayer;
m_IgnoreLockedItems;
m_IncludeSecondary;
}
*/
#endif // DEBUG #endif // DEBUG
//EOF //EOF
...@@ -280,11 +280,11 @@ public: ...@@ -280,11 +280,11 @@ public:
/** /**
* Function Collect * Function Collect
* scans a BOARD using this class's Inspector method, which does the collection. * scans a BOARD using this class's Inspector method, which does the collection.
* @param aBoard A BOARD to scan. * @param aItem A BOARD_ITEM to scan, may be a BOARD or MODULE, or whatever.
* @param aRefPos A wxPoint to use in hit-testing. * @param aRefPos A wxPoint to use in hit-testing.
* @param aGuide The COLLECTORS_GUIDE to use in collecting items. * @param aGuide The COLLECTORS_GUIDE to use in collecting items.
*/ */
void Collect( BOARD* aBoard, const wxPoint& aRefPos, const COLLECTORS_GUIDE* aGuide ); void Collect( BOARD_ITEM* aItem, const wxPoint& aRefPos, const COLLECTORS_GUIDE* aGuide );
}; };
...@@ -325,29 +325,31 @@ public: ...@@ -325,29 +325,31 @@ public:
* Add more constructors as needed. * Add more constructors as needed.
* @param settings The EDA_BoardDesignSettings to reference. * @param settings The EDA_BoardDesignSettings to reference.
*/ */
GENERAL_COLLECTORS_GUIDE( const EDA_BoardDesignSettings* settings ) GENERAL_COLLECTORS_GUIDE( int aVisibleLayerMask, int aPreferredLayer )
{ {
m_PreferredLayer = LAYER_CMP_N; m_PreferredLayer = LAYER_CMP_N;
m_IgnorePreferredLayer = false; m_IgnorePreferredLayer = false;
m_LayerLocked = 0; m_LayerLocked = 0;
m_LayerVisible = settings->GetVisibleLayers(); m_LayerVisible = aVisibleLayerMask;
m_IgnoreLockedLayers = true; m_IgnoreLockedLayers = true;
m_IgnoreNonVisibleLayers = true; m_IgnoreNonVisibleLayers = true;
m_IgnoreLockedItems = true; m_IgnoreLockedItems = false;
#if defined(USE_MATCH_LAYER) #if defined(USE_MATCH_LAYER)
m_IncludeSecondary = false; m_IncludeSecondary = false;
#else #else
m_IncludeSecondary = true; m_IncludeSecondary = true;
#endif #endif
// m_IgnoreMTextsMarkedNoShow = g_ModuleTextNOVColor; m_PreferredLayer = aPreferredLayer;
m_IgnoreMTextsOnCopper;
m_IgnoreMTextsOnCmp;
m_IgnoreModulesOnCu;
// m_IgnoreModulesOnCmp = !settings->Show_Modules_Cmp;
}
m_IgnoreMTextsMarkedNoShow = true; // g_ModuleTextNOVColor;
m_IgnoreMTextsOnCopper = true;
m_IgnoreMTextsOnCmp = false;
m_IgnoreModulesOnCu = true; // !Show_Modules_Cmp;
m_IgnoreModulesOnCmp = false;
}
/** /**
* Function IsLayerLocked * Function IsLayerLocked
......
...@@ -131,10 +131,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay() ...@@ -131,10 +131,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
#if defined(DEBUG) #if defined(DEBUG)
// test scaffolding for Collect(): // test scaffolding for Collect():
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->m_BoardSettings ); GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
guide.SetIgnoreLockedItems( false );
guide.SetPreferredLayer( GetScreen()->m_Active_Layer );
m_Collector->Collect( m_Pcb, m_Collector->Collect( m_Pcb,
GetScreen()->RefPos(true), GetScreen()->RefPos(true),
......
...@@ -423,6 +423,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) ...@@ -423,6 +423,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
} }
else else
continue; continue;
data = strtok( NULL, " =\n\r" ); data = strtok( NULL, " =\n\r" );
if( data ) if( data )
{ {
...@@ -431,6 +432,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) ...@@ -431,6 +432,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
} }
else else
g_UserGrid.y = g_UserGrid.x; g_UserGrid.y = g_UserGrid.x;
GetScreen()->m_UserGrid = g_UserGrid; GetScreen()->m_UserGrid = g_UserGrid;
data = strtok( NULL, " =\n\r" ); data = strtok( NULL, " =\n\r" );
if( data ) if( data )
...@@ -565,6 +567,7 @@ static int WriteSetup( FILE* File, WinEDA_BasePcbFrame* frame ) ...@@ -565,6 +567,7 @@ static int WriteSetup( FILE* File, WinEDA_BasePcbFrame* frame )
ii = frame->GetScreen()->GetGrid().x; ii = frame->GetScreen()->GetGrid().x;
jj = frame->GetScreen()->GetGrid().y; jj = frame->GetScreen()->GetGrid().y;
} }
sprintf( text, "GridSize %d %d\n", ii, jj ); sprintf( text, "GridSize %d %d\n", ii, jj );
fprintf( File, text ); fprintf( File, text );
...@@ -602,6 +605,7 @@ static int WriteSetup( FILE* File, WinEDA_BasePcbFrame* frame ) ...@@ -602,6 +605,7 @@ static int WriteSetup( FILE* File, WinEDA_BasePcbFrame* frame )
fprintf( File, "TextPcbWidth %d\n", g_DesignSettings.m_PcbTextWidth ); fprintf( File, "TextPcbWidth %d\n", g_DesignSettings.m_PcbTextWidth );
fprintf( File, "TextPcbSize %d %d\n", fprintf( File, "TextPcbSize %d %d\n",
g_DesignSettings.m_PcbTextSize.x, g_DesignSettings.m_PcbTextSize.y ); g_DesignSettings.m_PcbTextSize.x, g_DesignSettings.m_PcbTextSize.y );
fprintf( File, "EdgeModWidth %d\n", ModuleSegmentWidth ); fprintf( File, "EdgeModWidth %d\n", ModuleSegmentWidth );
fprintf( File, "TextModSize %d %d\n", ModuleTextSize.x, ModuleTextSize.y ); fprintf( File, "TextModSize %d %d\n", ModuleTextSize.x, ModuleTextSize.y );
fprintf( File, "TextModWidth %d\n", ModuleTextWidth ); fprintf( File, "TextModWidth %d\n", ModuleTextWidth );
...@@ -613,11 +617,11 @@ static int WriteSetup( FILE* File, WinEDA_BasePcbFrame* frame ) ...@@ -613,11 +617,11 @@ static int WriteSetup( FILE* File, WinEDA_BasePcbFrame* frame )
fprintf( File, "AuxiliaryAxisOrg %d %d\n", fprintf( File, "AuxiliaryAxisOrg %d %d\n",
frame->m_Auxiliary_Axis_Position.x, frame->m_Auxiliary_Axis_Position.y ); frame->m_Auxiliary_Axis_Position.x, frame->m_Auxiliary_Axis_Position.y );
fprintf( File, "$EndSETUP\n\n" ); fprintf( File, "$EndSETUP\n\n" );
return 1; return 1;
} }
#endif #endif
......
...@@ -187,7 +187,8 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -187,7 +187,8 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
if( BlockActive ) if( BlockActive )
{ {
DrawPanel->CursorOn( &dc ); return; DrawPanel->CursorOn( &dc );
return;
} }
m_CurrentScreen->SetCurItem( DrawStruct ); m_CurrentScreen->SetCurItem( DrawStruct );
...@@ -218,7 +219,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -218,7 +219,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, _( "Lock Module" ), ADD_MENUITEM( PopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, _( "Lock Module" ),
Locked_xpm ); Locked_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, _( "Free Module" ), ADD_MENUITEM( PopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, _( "Unlock Module" ),
Unlocked_xpm ); Unlocked_xpm );
if( !flags ) if( !flags )
PopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE, PopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE,
......
...@@ -11,10 +11,6 @@ ...@@ -11,10 +11,6 @@
#include "protos.h" #include "protos.h"
#include "id.h" #include "id.h"
#if defined(DEBUG)
#include "collectors.h"
#endif
/*******************************/ /*******************************/
/* class WinEDA_PcbFrame */ /* class WinEDA_PcbFrame */
...@@ -192,10 +188,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, ...@@ -192,10 +188,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
m_SelTrackWidthBox_Changed = FALSE; m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE; m_SelViaSizeBox_Changed = FALSE;
#if defined(DEBUG)
m_Collector = new GENERAL_COLLECTOR();
#endif
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum; m_DisplayPadNum = DisplayOpt.DisplayPadNum;
...@@ -241,10 +233,6 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame() ...@@ -241,10 +233,6 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
{ {
m_Parent->m_PcbFrame = NULL; m_Parent->m_PcbFrame = NULL;
m_CurrentScreen = ScreenPcb; m_CurrentScreen = ScreenPcb;
#if defined(DEBUG)
delete m_Collector;
#endif
} }
...@@ -551,3 +539,4 @@ void WinEDA_PcbFrame::SetToolbars() ...@@ -551,3 +539,4 @@ void WinEDA_PcbFrame::SetToolbars()
DisplayUnitsMsg(); DisplayUnitsMsg();
} }
...@@ -4,14 +4,8 @@ folks will see these items and volunteer to do them. ...@@ -4,14 +4,8 @@ folks will see these items and volunteer to do them.
*** Look at @todo in editrack-part2.cpp. Is this is a bug? ** Done (JP Charras) ** *** Add hierarchical menu to right mouse click in PCBNEW for the case when
Concerns: multiple items are under the mouse cursor.
a) Isn't there a problem with losing the memory of the original?
b) If this is supposed to duplicate a SEGVIA to, then this call should be changed
to the new TRACK::Copy(), i.e. g_CurrentTrackSegment->Copy()
>> (JP Charras:) No problem. the code is correct.
I have put comments to explain this code section and modified some line for a more intelligible code
*** Set up a DOXYGEN environment starting with a configuration file that: *** Set up a DOXYGEN environment starting with a configuration file that:
......
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