Commit e6239e74 authored by dickelbeck's avatar dickelbeck

moved m_Layer into EDA_BaseStruct

parent 755c3a1b
......@@ -4,6 +4,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Aug-22 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ eeschema & pcbnew
* Fixed a filename case sensitivity problem that would show up on Linux
but probably not on Windows: bitmap/Reload.xpm needed uppercase R.
* Since so many classes introduced m_Layer, I moved m_Layer into
EDA_BaseStruct so all classes can inherit it and that way we can test
layer using a general, polymorphic test, i.e. don't have to cast a
EDA_BaseStruct* to a class specific pointer to test layer. Could also have
used a virtual function but too many places use m_Layer directly.
2007-aug-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ eeschema & pcbnew
......@@ -15,6 +28,7 @@ email address.
================================================================================
+ administrative
Added copyright.h as a proposed copyright header for Mr. Charras's review.
Added uncrustify.cfg the configuration program for "uncrustify" C++ beautifier.
2007-Aug-20 UPDATE Dick Hollenbeck <dick@softplc.com>
......
......@@ -557,5 +557,10 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList( void )
void BASE_SCREEN::SetCurItem( EDA_BaseStruct* aCurItem )
{
#if defined(DEBUG)
printf( "SetCurItem(%p)\n", aCurItem );
#endif
m_CurrentItem = aCurItem;
}
......@@ -106,6 +106,7 @@ void EDA_BaseStruct::InitVars( void )
m_TimeStamp = 0; // Time stamp used for logical links
m_Status = 0;
m_Selected = 0; /* Used by block commands, and selective editing */
m_Layer = 0;
}
......@@ -297,7 +298,6 @@ EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStruct
/*********************************************************/
EDA_TextStruct::EDA_TextStruct( const wxString& text )
{
m_Layer = 0;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; /* XY size of font */
m_Orient = 0; /* Orient in 0.1 degrees */
m_Attributs = 0;
......
This diff is collapsed.
......@@ -141,7 +141,6 @@ public:
int m_FileNameSize;
wxPoint m_Pos;
wxSize m_Size; /* Position and Size of sheet symbol */
int m_Layer;
DrawSheetLabelStruct* m_Label; /* Points de connection */
int m_NbLabel; /* Nombre de points de connexion */
......
......@@ -106,7 +106,6 @@ class DrawBusEntryStruct: public EDA_BaseStruct /* Struct de descr 1 raccord
a 45 degres de BUS ou WIRE */
{
public:
int m_Layer;
int m_Width;
wxPoint m_Pos;
wxSize m_Size;
......@@ -122,7 +121,6 @@ public:
class DrawPolylineStruct: public EDA_BaseStruct /* Polyligne (serie de segments) */
{
public:
int m_Layer;
int m_Width;
int m_NumOfPoints; /* Number of XY pairs in Points array. */
int *m_Points; /* XY pairs that forms the polyline. */
......@@ -137,7 +135,6 @@ public:
class DrawJunctionStruct: public EDA_BaseStruct
{
public:
int m_Layer;
wxPoint m_Pos; /* XY coordinates of connection. */
public:
......
......@@ -154,6 +154,7 @@ 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;
......@@ -347,7 +348,6 @@ class EDA_TextStruct
{
public:
wxString m_Text; /* text! */
int m_Layer; /* couche d'appartenance */
wxPoint m_Pos; /* XY position of anchor text. */
wxSize m_Size; /* XY size of text */
int m_Width; /* epaisseur du trait */
......@@ -389,7 +389,6 @@ public:
class EDA_BaseLineStruct : public EDA_BaseStruct
{
public:
int m_Layer; // Layer number
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
......
......@@ -276,7 +276,7 @@ public:
/**
* Function FindNet
* searches for a net with the given netcode.
* @param anetcode The netcode to search for.
* @param anetcode A netcode to search for.
* @return EQUIPOT* - the net or NULL if not found.
*/
EQUIPOT* FindNet( int anetcode );
......
......@@ -27,7 +27,7 @@
#include "New_Project.xpm"
#include "Open_Project.xpm"
#include "../bitmaps/icon_python.xpm"
#include "../bitmaps/reload.xpm"
#include "../bitmaps/Reload.xpm"
#include "id.h"
......
......@@ -9,7 +9,6 @@
class COTATION : public EDA_BaseStruct
{
public:
int m_Layer; // 0.. 32 ( NON bit a bit)
int m_Width;
wxPoint m_Pos;
int m_Shape;
......
......@@ -10,7 +10,6 @@
class MIREPCB : public EDA_BaseStruct
{
public:
int m_Layer; // 0.. 32 ( NON bit a bit)
int m_Width;
wxPoint m_Pos;
int m_Shape; // bit 0 : 0 = forme +, 1 = forme X
......
......@@ -38,7 +38,6 @@ enum Mod_Attribut /* Attributs d'un module */
class MODULE : public EDA_BaseStruct
{
public:
int m_Layer; // layer number
wxPoint m_Pos; // Real coord on board
D_PAD* m_Pads; /* Pad list (linked list) */
EDA_BaseStruct* m_Drawings; /* Graphic items list (linked list) */
......
......@@ -37,6 +37,18 @@ public:
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& refPos )
{
return EDA_TextStruct::HitTest( refPos );
}
#if defined(DEBUG)
/**
* Function GetClass
......
......@@ -16,7 +16,6 @@
class TEXTE_MODULE : public EDA_BaseStruct
{
public:
int m_Layer; // layer number
int m_Width;
wxPoint m_Pos; // Real coord
wxPoint m_Pos0; // coord du debut du texte /ancre, orient 0
......
......@@ -483,16 +483,18 @@ D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int masque_layer )
}
/********************************************************/
MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
/********************************************************/
/*
* localisation d'une empreinte par son rectangle d'encadrement
* Si plusieurs empreintes sont possibles, la priorite est:
* - sur la couche active
* - la plus petite
/**
* Function Locate_Prefered_Module
* locates a footprint by its bounding rectangle. If several footprints
* are possible, then the priority is: on the active layer, then smallest.
* The current mouse or cursor coordinates are grabbed from the active window
* to performe hit-testing.
*
* @param Pcb The BOARD to search within.
* @param typeloc Flag bits, tuning the search, see pcbnew.h
* @return MODULE* - the best module or NULL if none.
*/
MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
{
MODULE* pt_module;
int lx, ly; /* dimensions du rectangle d'encadrement du module */
......@@ -898,10 +900,7 @@ TEXTE_PCB* Locate_Texte_Pcb( EDA_BaseStruct* PtStruct, int LayerSearch, int type
if( pt_txt_pcb->m_Layer == LayerSearch )
{
// because HitTest() is present in both base classes of TEXTE_PCB
// use a clarifying cast to tell compiler which HitTest()
// to call.
if( static_cast<EDA_TextStruct*>(pt_txt_pcb)->HitTest( ref ) )
if( pt_txt_pcb->HitTest( ref ) )
{
return pt_txt_pcb;
}
......
......@@ -202,6 +202,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST,
_( "Get and Move Footprint" ), Move_Module_xpm );
}
if( DrawStruct )
{
switch( DrawStruct->m_StructType )
......
......@@ -12,7 +12,7 @@
#include "id.h"
#if defined(DEBUG)
#include <class_collector.h>
#include "class_collector.h"
#endif
......@@ -69,8 +69,8 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, wxFrame )
EVT_MENU( ID_CONFIG_REQ, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU(ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config)
EVT_MENU(ID_PREFERENCES_READ_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config)
EVT_MENU( ID_PREFERENCES_CREATE_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PREFERENCES_READ_CONFIG_HOTKEYS, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
......@@ -172,11 +172,77 @@ END_EVENT_TABLE()
#if defined(DEBUG)
class RAT1COLLECTOR : public COLLECTOR
{
;
};
class ARROWCOLLECTOR : public COLLECTOR
{
const KICAD_T* m_ScanTypes;
/**
* A place to hold collected objects which don't match precisely the search
* criteria, but would be acceptable if nothing else is found.
* "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;
public:
ARROWCOLLECTOR() :
COLLECTOR(0),
m_ScanTypes(0)
{
}
~ARROWCOLLECTOR()
{
// empty list2nd so that ~list2nd() does not try and delete all
// the objects that it holds, it is not the owner of such objects
// and this prevents a double free()ing.
Empty2nd();
}
void Empty2nd()
{
list2nd.clear();
}
/**
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* Iterate function. It is used primarily for searching, but not limited to
* that. It can also collect or modify the scanned objects.
*
* @param testItem An EDA_BaseStruct to examine.
* @param testData is arbitrary data needed by the inspector to determine
* if the EDA_BaseStruct under test meets its match criteria.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData )
{
const wxPoint& refPos = *(const wxPoint*) testData;
switch( testItem->m_StructType )
{
case TYPEMODULE:
if( testItem->HitTest( refPos ) )
Append( testItem );
break;
}
return SEARCH_CONTINUE;
}
void SetScanTypes( const KICAD_T* scanTypes )
{
m_ScanTypes = scanTypes;
}
};
#endif
......
This diff is collapsed.
......@@ -329,7 +329,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
int ii;
wxString line;
grid_list_struct grid_list_pcb[] =
static const grid_list_struct grid_list_pcb[] =
{
{ 1000, ID_POPUP_GRID_LEVEL_1000, wxT( " 100" ) },
{ 500, ID_POPUP_GRID_LEVEL_500, wxT( " 50" ) },
......@@ -346,7 +346,7 @@ void WinEDA_DrawPanel::AddMenuZoom( wxMenu* MasterMenu )
{ 0, ID_POPUP_GRID_USER, _( "grid user" ) }
};
grid_list_struct grid_list_schematic[] =
static const grid_list_struct grid_list_schematic[] =
{
{ 50, ID_POPUP_GRID_LEVEL_50, wxT( " 50" ) },
{ 25, ID_POPUP_GRID_LEVEL_25, wxT( " 25" ) },
......
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