see 2007-Sep-4 change_log.txt

This commit is contained in:
dickelbeck 2007-09-05 04:48:47 +00:00
parent 8383ce256e
commit 74a635c127
12 changed files with 251 additions and 195 deletions

View File

@ -4,6 +4,18 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================
+ pcbnew
@ -39,8 +51,6 @@ email address.
be instantiated. This was not happening in ioascii.cpp when reading
the vias. Bug fixed.
* 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>

View File

@ -43,7 +43,8 @@ OBJECTS = $(TARGET).o \
class_edge_mod.o \
class_equipot.o \
class_track.o\
basepcbframe.o
basepcbframe.o\
collectors.o
cvpcb.o: cvpcb.cpp cvpcb.h $(DEPEND)
@ -99,6 +100,9 @@ class_equipot.o: ../pcbnew/class_equipot.cpp $(DEPEND)
basepcbframe.o: ../pcbnew/basepcbframe.cpp $(DEPEND)
$(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp
collectors.o: ../pcbnew/collectors.cpp $(COMMON)
$(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp
readschematicnetlist.o: readschematicnetlist.cpp $(DEPEND)
viewlogi.o: viewlogi.cpp $(DEPEND)

View File

@ -45,7 +45,8 @@ OBJECTS= \
block.o\
controle.o\
basepcbframe.o\
export_to_pcbnew.o
export_to_pcbnew.o\
collectors.o
setpage.o: ../share/setpage.cpp
$(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp
@ -85,6 +86,9 @@ class_board.o: ../pcbnew/class_board.cpp $(DEPEND)
basepcbframe.o: ../pcbnew/basepcbframe.cpp $(COMMON)
$(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)
$(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp

View File

@ -97,6 +97,7 @@ class PARAM_CFG_BASE;
class Ki_PageDescr;
class Ki_HotkeyInfo;
class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
enum id_librarytype {
@ -338,6 +339,12 @@ public:
bool m_DisplayPcbTrackFill; /* FALSE = sketch , TRUE = rempli */
WinEDA3D_DrawFrame* m_Draw3DFrame;
protected:
#if defined(DEBUG)
GENERAL_COLLECTOR* m_Collector;
#endif
public:
WinEDA_BasePcbFrame( wxWindow* father, WinEDA_App* parent, int idtype,
const wxString& title,
@ -372,11 +379,6 @@ private:
virtual void GetComponentFromUndoList();
virtual void GetComponentFromRedoList();
#if defined(DEBUG)
protected:
GENERAL_COLLECTOR* m_Collector;
#endif
public:
// Read/write fonctions:
@ -393,6 +395,14 @@ public:
BOARD_ITEM* PcbGeneralLocateAndDisplay();
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
void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap,
int DrawMode, int color, int type );
@ -522,6 +532,7 @@ private:
bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu;
public:
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size );
@ -765,6 +776,8 @@ public:
EDA_BaseStruct* GerberGeneralLocateAndDisplay();
EDA_BaseStruct* Locate( int typeloc );
void SetToolbars();
void Process_Settings( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );

View File

@ -15,6 +15,9 @@
#include "protos.h"
#include "id.h"
#if defined(DEBUG)
#include "collectors.h"
#endif
/*******************************/
@ -25,9 +28,12 @@
/* Constructeur */
/****************/
WinEDA_BasePcbFrame::WinEDA_BasePcbFrame(wxWindow * father, WinEDA_App *parent,
WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
WinEDA_App* parent,
int idtype,
const wxString & title, const wxPoint& pos, const wxSize& 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
@ -41,10 +47,19 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame(wxWindow * father, WinEDA_App *parent,
m_DisplayModText = FILLED; // How to show module texts
m_DisplayPcbTrackFill = TRUE; /* FALSE = sketch , TRUE = filled */
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
#if defined(DEBUG)
m_Collector = new GENERAL_COLLECTOR();
#endif
}
WinEDA_BasePcbFrame::~WinEDA_BasePcbFrame( void )
{
#if defined(DEBUG)
delete m_Collector;
#endif
}
@ -56,7 +71,8 @@ int dx, dy, ii,jj ;
int bestzoom;
wxSize size;
if ( m_Pcb == NULL ) return 32;
if( m_Pcb == NULL )
return 32;
m_Pcb->ComputeBoundaryBox();
@ -71,7 +87,7 @@ wxSize size;
m_CurrentScreen->m_Curseur = m_Pcb->m_BoundaryBox.Centre();
return(bestzoom);
return bestzoom;
}
@ -79,15 +95,18 @@ void WinEDA_BasePcbFrame::ReCreateMenuBar(void) // fonction virtuelle
{
}
#include "3d_viewer.h"
/***********************************************************/
void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event )
/***********************************************************/
/* Ouvre la frame d'affichage 3D
*/
{
#ifndef GERBVIEW
// Create the main frame window
if( m_Draw3DFrame )
{
@ -110,12 +129,14 @@ void WinEDA_BasePcbFrame::SaveCopyInUndoList(EDA_BaseStruct * ItemToCopy, int fl
{
}
/********************************************************/
void WinEDA_BasePcbFrame::GetComponentFromUndoList( void )
/********************************************************/
{
}
/********************************************************/
void WinEDA_BasePcbFrame::GetComponentFromRedoList( void )
/********************************************************/
@ -129,12 +150,15 @@ void WinEDA_BasePcbFrame::SwitchLayer(wxDC *DC, int layer)
{
//Note: virtual, overridden in WinEDA_PcbFrame;
int preslayer = GetScreen()->m_Active_Layer;
//if there is only one layer, don't switch.
if( m_Pcb->m_BoardSettings->m_CopperLayerCount <= 1 )
layer = LAYER_CUIVRE_N; // Of course we select the copper layer
//otherwise, we select the requested layer only if it is possible
if( layer != LAYER_CMP_N && layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1 )
return;
if( preslayer == layer )
return;
@ -144,4 +168,23 @@ void WinEDA_BasePcbFrame::SwitchLayer(wxDC *DC, int layer)
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

View File

@ -86,21 +86,24 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
breakhere++;
break;
case TYPETEXTEMODULE:
TEXTE_MODULE* tm;
tm = (TEXTE_MODULE*) item;
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
if( tm->m_Text == wxT("10uH") )
{
breakhere++;
}
}
break;
case TYPEMODULE:
MODULE* m;
m = (MODULE*) item;
if( m->GetReference() == wxT("L1") )
{
MODULE* m = (MODULE*) item;
if( m->GetReference() == wxT("C98") )
{
breakhere++;
}
}
break;
default:
breakhere++;
break;
@ -108,21 +111,51 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
#endif
#if 1
switch( item->Type() )
{
case TYPEPAD:
break;
case TYPEVIA:
break;
case TYPETRACK:
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;
/*
int m_PreferredLayer; x
bool m_IgnorePreferredLayer
int m_LayerVisible; x
bool m_IgnoreNonVisibleLayers;
if( parent )
{
if( m_Guide->IgnoreMTextsOnCopper() && parent->GetLayer()==LAYER_CUIVRE_N )
goto exit;
int m_LayerLocked; x
bool m_IgnoreLockedLayers;
if( m_Guide->IgnoreMTextsOnCmp() && parent->GetLayer()==LAYER_CMP_N )
goto exit;
}
}
break;
bool m_IgnoreLockedItems; x
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;
bool m_IncludeSecondary;
*/
default:
break;
}
// common tests:
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() )
{
@ -144,6 +177,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_BaseStruct* testItem, const void*
}
}
if( m_Guide->IncludeSecondary() )
{
// for now, "secondary" means "tolerate any layer". It has
@ -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:
return SEARCH_CONTINUE; // always when collecting
}
@ -229,21 +242,21 @@ void GENERAL_COLLECTOR::Collect( BOARD* board, const wxPoint& refPos,
// see collectors.h
void GENERAL_COLLECTOR::Collect( BOARD* board, const wxPoint& refPos,
const COLLECTORS_GUIDE* guide )
void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const wxPoint& refPos,
const COLLECTORS_GUIDE* aGuide )
{
Empty(); // empty the collection, primary criteria list
Empty2nd(); // empty the collection, secondary criteria list
// remember guide, pass it to Inspect()
SetGuide( guide );
SetGuide( aGuide );
// remember where the snapshot was taken from and pass refPos to
// the Inspect() function.
SetRefPos( refPos );
// visit the board with the INSPECTOR (me).
board->Visit( this, // INSPECTOR* inspector
aItem->Visit( this, // INSPECTOR* inspector
NULL, // const void* testData, not used here
m_ScanTypes);
@ -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
//EOF

View File

@ -280,11 +280,11 @@ public:
/**
* Function Collect
* 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 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,15 +325,15 @@ public:
* Add more constructors as needed.
* @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_IgnorePreferredLayer = false;
m_LayerLocked = 0;
m_LayerVisible = settings->GetVisibleLayers();
m_LayerVisible = aVisibleLayerMask;
m_IgnoreLockedLayers = true;
m_IgnoreNonVisibleLayers = true;
m_IgnoreLockedItems = true;
m_IgnoreLockedItems = false;
#if defined(USE_MATCH_LAYER)
m_IncludeSecondary = false;
@ -341,11 +341,13 @@ public:
m_IncludeSecondary = true;
#endif
// m_IgnoreMTextsMarkedNoShow = g_ModuleTextNOVColor;
m_IgnoreMTextsOnCopper;
m_IgnoreMTextsOnCmp;
m_IgnoreModulesOnCu;
// m_IgnoreModulesOnCmp = !settings->Show_Modules_Cmp;
m_PreferredLayer = aPreferredLayer;
m_IgnoreMTextsMarkedNoShow = true; // g_ModuleTextNOVColor;
m_IgnoreMTextsOnCopper = true;
m_IgnoreMTextsOnCmp = false;
m_IgnoreModulesOnCu = true; // !Show_Modules_Cmp;
m_IgnoreModulesOnCmp = false;
}

View File

@ -131,10 +131,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
#if defined(DEBUG)
// test scaffolding for Collect():
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->m_BoardSettings );
guide.SetIgnoreLockedItems( false );
guide.SetPreferredLayer( GetScreen()->m_Active_Layer );
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
m_Collector->Collect( m_Pcb,
GetScreen()->RefPos(true),

View File

@ -423,6 +423,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
}
else
continue;
data = strtok( NULL, " =\n\r" );
if( data )
{
@ -431,6 +432,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
}
else
g_UserGrid.y = g_UserGrid.x;
GetScreen()->m_UserGrid = g_UserGrid;
data = strtok( NULL, " =\n\r" );
if( data )
@ -565,6 +567,7 @@ static int WriteSetup( FILE* File, WinEDA_BasePcbFrame* frame )
ii = frame->GetScreen()->GetGrid().x;
jj = frame->GetScreen()->GetGrid().y;
}
sprintf( text, "GridSize %d %d\n", ii, jj );
fprintf( File, text );
@ -602,6 +605,7 @@ static int WriteSetup( FILE* File, WinEDA_BasePcbFrame* frame )
fprintf( File, "TextPcbWidth %d\n", g_DesignSettings.m_PcbTextWidth );
fprintf( File, "TextPcbSize %d %d\n",
g_DesignSettings.m_PcbTextSize.x, g_DesignSettings.m_PcbTextSize.y );
fprintf( File, "EdgeModWidth %d\n", ModuleSegmentWidth );
fprintf( File, "TextModSize %d %d\n", ModuleTextSize.x, ModuleTextSize.y );
fprintf( File, "TextModWidth %d\n", ModuleTextWidth );
@ -613,11 +617,11 @@ static int WriteSetup( FILE* File, WinEDA_BasePcbFrame* frame )
fprintf( File, "AuxiliaryAxisOrg %d %d\n",
frame->m_Auxiliary_Axis_Position.x, frame->m_Auxiliary_Axis_Position.y );
fprintf( File, "$EndSETUP\n\n" );
return 1;
}
#endif

View File

@ -187,7 +187,8 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
if( BlockActive )
{
DrawPanel->CursorOn( &dc ); return;
DrawPanel->CursorOn( &dc );
return;
}
m_CurrentScreen->SetCurItem( DrawStruct );
@ -218,7 +219,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, _( "Lock Module" ),
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 );
if( !flags )
PopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE,

View File

@ -11,10 +11,6 @@
#include "protos.h"
#include "id.h"
#if defined(DEBUG)
#include "collectors.h"
#endif
/*******************************/
/* class WinEDA_PcbFrame */
@ -192,10 +188,6 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
m_SelTrackWidthBox_Changed = FALSE;
m_SelViaSizeBox_Changed = FALSE;
#if defined(DEBUG)
m_Collector = new GENERAL_COLLECTOR();
#endif
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
m_DisplayPadNum = DisplayOpt.DisplayPadNum;
@ -241,10 +233,6 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
{
m_Parent->m_PcbFrame = NULL;
m_CurrentScreen = ScreenPcb;
#if defined(DEBUG)
delete m_Collector;
#endif
}
@ -551,3 +539,4 @@ void WinEDA_PcbFrame::SetToolbars()
DisplayUnitsMsg();
}

View File

@ -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) **
Concerns:
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
*** Add hierarchical menu to right mouse click in PCBNEW for the case when
multiple items are under the mouse cursor.
*** Set up a DOXYGEN environment starting with a configuration file that: