Commit 716d21d8 authored by Dick Hollenbeck's avatar Dick Hollenbeck

get rid of some globals, share BOARD_DESIGN_SETTINGS from PCB_EDIT_FRAME with FOOTPRINT_EDIT_FRAME

parent cc46daa6
...@@ -89,7 +89,7 @@ static void CALLBACK tesswxPoint2Vertex( const GLvoid* data ); ...@@ -89,7 +89,7 @@ static void CALLBACK tesswxPoint2Vertex( const GLvoid* data );
void EDA_3D_CANVAS::Redraw( bool finish ) void EDA_3D_CANVAS::Redraw( bool finish )
{ {
/* SwapBuffer requires the window to be shown before calling */ // SwapBuffer requires the window to be shown before calling
if( !IsShown() ) if( !IsShown() )
return; return;
...@@ -112,8 +112,8 @@ void EDA_3D_CANVAS::Redraw( bool finish ) ...@@ -112,8 +112,8 @@ void EDA_3D_CANVAS::Redraw( bool finish )
InitGL(); InitGL();
glMatrixMode( GL_MODELVIEW ); /* position viewer */ glMatrixMode( GL_MODELVIEW ); // position viewer
/* transformations */ // transformations
GLfloat mat[4][4]; GLfloat mat[4][4];
// Translate motion first, so rotations don't mess up the orientation... // Translate motion first, so rotations don't mess up the orientation...
...@@ -180,7 +180,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -180,7 +180,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
g_Parm_3D_Visu.m_Epoxy_Width = pcb->GetDesignSettings().m_BoardThickness g_Parm_3D_Visu.m_Epoxy_Width = pcb->GetDesignSettings().m_BoardThickness
* g_Parm_3D_Visu.m_BoardScale; * g_Parm_3D_Visu.m_BoardScale;
/* calculate z position for each layer */ // calculate z position for each layer
for( ii = 0; ii < 32; ii++ ) for( ii = 0; ii < 32; ii++ )
{ {
if( ii < g_Parm_3D_Visu.m_Layers ) if( ii < g_Parm_3D_Visu.m_Layers )
...@@ -205,7 +205,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -205,7 +205,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
/* draw axis */ // draw axis
if( g_Parm_3D_Visu.m_Draw3DAxis ) if( g_Parm_3D_Visu.m_Draw3DAxis )
{ {
glEnable( GL_COLOR_MATERIAL ); glEnable( GL_COLOR_MATERIAL );
...@@ -222,7 +222,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -222,7 +222,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
glEnd(); glEnd();
} }
/* Draw epoxy limits (do not use, works and test in progress) */ // Draw epoxy limits (do not use, works and test in progress)
#if 0 #if 0
glEnable( GL_FOG ); glEnable( GL_FOG );
GLfloat param; GLfloat param;
...@@ -255,14 +255,14 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -255,14 +255,14 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
glEnd(); glEnd();
#endif #endif
/* move the board in order to draw it with its center at 0,0 3D coordinates */ // move the board in order to draw it with its center at 0,0 3D coordinates
glTranslatef( -g_Parm_3D_Visu.m_BoardPos.x * g_Parm_3D_Visu.m_BoardScale, glTranslatef( -g_Parm_3D_Visu.m_BoardPos.x * g_Parm_3D_Visu.m_BoardScale,
-g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BoardScale, -g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BoardScale,
0.0F ); 0.0F );
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
/* draw tracks and vias : */ // draw tracks and vias :
for( track = pcb->m_Track; track != NULL; track = track->Next() ) for( track = pcb->m_Track; track != NULL; track = track->Next() )
{ {
if( track->Type() == PCB_VIA_T ) if( track->Type() == PCB_VIA_T )
...@@ -370,7 +370,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -370,7 +370,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
} }
} }
/* draw graphic items */ // draw graphic items
EDA_ITEM* PtStruct; EDA_ITEM* PtStruct;
for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
...@@ -390,7 +390,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -390,7 +390,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
} }
} }
/* draw footprints */ // draw footprints
MODULE* Module = pcb->m_Modules; MODULE* Module = pcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
...@@ -400,7 +400,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ...@@ -400,7 +400,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
glEndList(); glEndList();
/* Test for errors */ // Test for errors
CheckGLError(); CheckGLError();
return m_gllist; return m_gllist;
...@@ -694,7 +694,7 @@ void MODULE::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -694,7 +694,7 @@ void MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
{ {
D_PAD* pad = m_Pads; D_PAD* pad = m_Pads;
/* Draw pads */ // Draw pads
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
...@@ -703,7 +703,7 @@ void MODULE::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -703,7 +703,7 @@ void MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
pad->Draw3D( glcanvas ); pad->Draw3D( glcanvas );
} }
/* Draw module shape: 3D shape if exists (or module outlines if not exists) */ // Draw module shape: 3D shape if exists (or module outlines if not exists)
S3D_MASTER* Struct3D = m_3D_Drawings; S3D_MASTER* Struct3D = m_3D_Drawings;
bool As3dShape = false; bool As3dShape = false;
...@@ -890,7 +890,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -890,7 +890,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
} }
/* Draw 3D pads. */ // Draw 3D pads.
void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
{ {
int ii, ll, layer, nlmax; int ii, ll, layer, nlmax;
...@@ -912,7 +912,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -912,7 +912,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
holeY = (double) m_Drill.y * scale / 2; holeY = (double) m_Drill.y * scale / 2;
hole = fmin( holeX, holeY ); hole = fmin( holeX, holeY );
/* Calculate the center of the pad. */ // Calculate the center of the pad.
shape_pos = ReturnShapePos(); shape_pos = ReturnShapePos();
ux0 = shape_pos.x; ux0 = shape_pos.x;
uy0 = shape_pos.y; uy0 = shape_pos.y;
...@@ -926,7 +926,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -926,7 +926,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
drillx = m_Pos.x * scale; drillx = m_Pos.x * scale;
drilly = m_Pos.y * scale; drilly = m_Pos.y * scale;
/* Draw the pad hole (TODO: draw OBLONG hole) */ // Draw the pad hole (TODO: draw OBLONG hole)
if( holeX && holeY ) if( holeX && holeY )
{ {
SetGLColor( DARKGRAY ); SetGLColor( DARKGRAY );
...@@ -981,13 +981,13 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) ...@@ -981,13 +981,13 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
break; break;
case PAD_OVAL: case PAD_OVAL:
if( dx > dy ) /* Horizontal ellipse */ if( dx > dy ) // Horizontal ellipse
{ {
delta_cx = dx - dy; delta_cx = dx - dy;
delta_cy = 0; delta_cy = 0;
w = m_Size.y * scale; w = m_Size.y * scale;
} }
else /* Vertical ellipse */ else // Vertical ellipse
{ {
delta_cx = 0; delta_cx = 0;
delta_cy = dy - dx; delta_cy = dy - dx;
...@@ -1195,7 +1195,7 @@ static void Draw3D_FilledCylinder( double posx, double posy, double rayon, ...@@ -1195,7 +1195,7 @@ static void Draw3D_FilledCylinder( double posx, double posy, double rayon,
} }
/* Draw a polygon similar to a segment has rounded tips */ // Draw a polygon similar to a segment has rounded tips
static void Draw3D_FilledSegment( double startx, double starty, double endx, static void Draw3D_FilledSegment( double startx, double starty, double endx,
double endy, double width, double zpos ) double endy, double width, double zpos )
{ {
......
...@@ -111,8 +111,6 @@ class BOARD_DESIGN_SETTINGS g_DesignSettings; ...@@ -111,8 +111,6 @@ class BOARD_DESIGN_SETTINGS g_DesignSettings;
*/ */
DLIST<TRACK> g_CurrentTrackList; DLIST<TRACK> g_CurrentTrackList;
BOARD* g_ModuleEditor_Pcb = NULL;
bool g_Zone_45_Only = false; bool g_Zone_45_Only = false;
// Default setting used when creating a new zone // Default setting used when creating a new zone
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* @file pcbcommon.h * @file pcbcommon.h
*/ */
#ifndef __PCBCOMMON_H__ #ifndef PCBCOMMON_H_
#define __PCBCOMMON_H__ #define PCBCOMMON_H_
#include <dlist.h> #include <dlist.h>
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
//#include <wx/arrstr.h> // wxArrayString class. //#include <wx/arrstr.h> // wxArrayString class.
#define MIN_DRAW_WIDTH 1 /* Minimum trace drawing width. */ #define MIN_DRAW_WIDTH 1 ///< Minimum trace drawing width.
//class PCB_SCREEN; //class PCB_SCREEN;
...@@ -30,7 +30,7 @@ class DISPLAY_OPTIONS; ...@@ -30,7 +30,7 @@ class DISPLAY_OPTIONS;
*/ */
int GetLayerMask( int aLayerNumber ); int GetLayerMask( int aLayerNumber );
/* Look up Table for conversion copper layer count -> general copper layer mask: */ /// Look up Table for conversion copper layer count -> general copper layer mask:
extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS]; extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
extern DISPLAY_OPTIONS DisplayOpt; extern DISPLAY_OPTIONS DisplayOpt;
...@@ -52,10 +52,8 @@ extern DLIST<TRACK> g_CurrentTrackList; ...@@ -52,10 +52,8 @@ extern DLIST<TRACK> g_CurrentTrackList;
#define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created #define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created
extern BOARD* g_ModuleEditor_Pcb; /// Pad editing
/* Pad editing */
extern D_PAD g_Pad_Master; extern D_PAD g_Pad_Master;
#endif /* __PCBCOMMON_H__ */ #endif // PCBCOMMON_H_
...@@ -122,6 +122,14 @@ public: ...@@ -122,6 +122,14 @@ public:
const TITLE_BLOCK& GetTitleBlock() const; // overload const TITLE_BLOCK& GetTitleBlock() const; // overload
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload
/**
* Function GetDesignSettings
* returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame.
* Overloaded in FOOTPRINT_EDIT_FRAME.
*/
virtual BOARD_DESIGN_SETTINGS& GetDesignSettings() const;
virtual void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings );
/** /**
* Function SetBoard * Function SetBoard
* sets the m_Pcb member in such as way as to ensure deleting any previous * sets the m_Pcb member in such as way as to ensure deleting any previous
...@@ -130,9 +138,9 @@ public: ...@@ -130,9 +138,9 @@ public:
*/ */
void SetBoard( BOARD* aBoard ); void SetBoard( BOARD* aBoard );
BOARD* GetBoard() BOARD* GetBoard() const
{ {
wxASSERT( m_Pcb ); // phasing out m_Pcb for GerbView wxASSERT( m_Pcb );
return m_Pcb; return m_Pcb;
} }
......
...@@ -113,15 +113,13 @@ PCB_BASE_FRAME::~PCB_BASE_FRAME() ...@@ -113,15 +113,13 @@ PCB_BASE_FRAME::~PCB_BASE_FRAME()
{ {
delete m_Collector; delete m_Collector;
// delete m_Pcb; delete m_Pcb; // is already NULL for FOOTPRINT_EDIT_FRAME
} }
void PCB_BASE_FRAME::SetBoard( BOARD* aBoard ) void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
{ {
if( m_Pcb != g_ModuleEditor_Pcb ) delete m_Pcb;
delete m_Pcb;
m_Pcb = aBoard; m_Pcb = aBoard;
} }
...@@ -182,6 +180,20 @@ void PCB_BASE_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) ...@@ -182,6 +180,20 @@ void PCB_BASE_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
} }
BOARD_DESIGN_SETTINGS& PCB_BASE_FRAME::GetDesignSettings() const
{
wxASSERT( m_Pcb );
return m_Pcb->GetDesignSettings();
}
void PCB_BASE_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings )
{
wxASSERT( m_Pcb );
m_Pcb->SetDesignSettings( aSettings );
}
EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
{ {
wxASSERT( m_Pcb ); wxASSERT( m_Pcb );
......
...@@ -93,13 +93,6 @@ BOARD::~BOARD() ...@@ -93,13 +93,6 @@ BOARD::~BOARD()
} }
void BOARD::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings )
{
// copy all members.
m_designSettings = aDesignSettings;
}
void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList ) void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList )
{ {
TRACK* segment; // The current segment being analyzed. TRACK* segment; // The current segment being analyzed.
......
...@@ -528,17 +528,17 @@ public: ...@@ -528,17 +528,17 @@ public:
* Function GetDesignSettings * Function GetDesignSettings
* @return the BOARD_DESIGN_SETTINGS for this BOARD * @return the BOARD_DESIGN_SETTINGS for this BOARD
*/ */
// const BOARD_DESIGN_SETTINGS& GetDesignSettings() const want to use this one BOARD_DESIGN_SETTINGS& GetDesignSettings() const
BOARD_DESIGN_SETTINGS& GetDesignSettings()
{ {
return m_designSettings; // remove const-ness with cast.
return (BOARD_DESIGN_SETTINGS&) m_designSettings;
} }
/** /**
* Function SetDesignSettings * Function SetDesignSettings
* @param aDesignSettings the new BOARD_DESIGN_SETTINGS to use * @param aDesignSettings the new BOARD_DESIGN_SETTINGS to use
*/ */
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings ); void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings ) { m_designSettings = aDesignSettings; }
const PAGE_INFO& GetPageSettings() const { return m_paper; } const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; } void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
......
...@@ -331,8 +331,8 @@ int D_PAD::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const ...@@ -331,8 +331,8 @@ int D_PAD::GetClearance( BOARD_CONNECTED_ITEM* aItem ) const
*/ */
int D_PAD::GetSolderMaskMargin() int D_PAD::GetSolderMaskMargin()
{ {
int margin = m_LocalSolderMaskMargin; int margin = m_LocalSolderMaskMargin;
MODULE * module = (MODULE*) GetParent(); MODULE* module = (MODULE*) GetParent();
if( module ) if( module )
{ {
...@@ -344,7 +344,7 @@ int D_PAD::GetSolderMaskMargin() ...@@ -344,7 +344,7 @@ int D_PAD::GetSolderMaskMargin()
if( margin == 0 ) if( margin == 0 )
{ {
BOARD * brd = GetBoard(); BOARD* brd = GetBoard();
margin = brd->GetDesignSettings().m_SolderMaskMargin; margin = brd->GetDesignSettings().m_SolderMaskMargin;
} }
} }
......
This diff is collapsed.
...@@ -355,14 +355,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -355,14 +355,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
else else
{ {
int v_type = GetBoard()->GetDesignSettings().m_CurrentViaType; int v_type = GetDesignSettings().m_CurrentViaType;
// place micro via and switch layer. // place micro via and switch layer.
if( id == ID_POPUP_PCB_PLACE_MICROVIA ) if( id == ID_POPUP_PCB_PLACE_MICROVIA )
GetBoard()->GetDesignSettings().m_CurrentViaType = VIA_MICROVIA; GetDesignSettings().m_CurrentViaType = VIA_MICROVIA;
Other_Layer_Route( (TRACK*) GetCurItem(), &dc ); Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
GetBoard()->GetDesignSettings().m_CurrentViaType = v_type; GetDesignSettings().m_CurrentViaType = v_type;
if( DisplayOpt.ContrastModeDisplay ) if( DisplayOpt.ContrastModeDisplay )
m_canvas->Refresh(); m_canvas->Refresh();
......
...@@ -51,7 +51,7 @@ static wxPoint s_InitialPosition; // Initial cursor position. ...@@ -51,7 +51,7 @@ static wxPoint s_InitialPosition; // Initial cursor position.
static wxPoint s_LastPosition; // Current cursor position. static wxPoint s_LastPosition; // Current cursor position.
/* Start move of a graphic element type DRAWSEGMENT */ // Start move of a graphic element type DRAWSEGMENT
void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
{ {
if( drawitem == NULL ) if( drawitem == NULL )
...@@ -119,7 +119,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) ...@@ -119,7 +119,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
if( Segment->IsNew() ) // Trace in progress. if( Segment->IsNew() ) // Trace in progress.
{ {
/* Delete current segment. */ // Delete current segment.
DisplayOpt.DisplayDrawItems = SKETCH; DisplayOpt.DisplayDrawItems = SKETCH;
Segment->Draw( m_canvas, DC, GR_XOR ); Segment->Draw( m_canvas, DC, GR_XOR );
PtStruct = Segment->Back(); PtStruct = Segment->Back();
...@@ -236,14 +236,14 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, ...@@ -236,14 +236,14 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
int s_large; int s_large;
DRAWSEGMENT* DrawItem; DRAWSEGMENT* DrawItem;
s_large = GetBoard()->GetDesignSettings().m_DrawSegmentWidth; s_large = GetDesignSettings().m_DrawSegmentWidth;
if( getActiveLayer() == EDGE_N ) if( getActiveLayer() == EDGE_N )
{ {
s_large = GetBoard()->GetDesignSettings().m_EdgeSegmentWidth; s_large = GetDesignSettings().m_EdgeSegmentWidth;
} }
if( Segment == NULL ) /* Create new trace. */ if( Segment == NULL ) // Create new trace.
{ {
SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) ); SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
Segment->SetFlags( IS_NEW ); Segment->SetFlags( IS_NEW );
......
...@@ -60,7 +60,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -60,7 +60,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
return true; return true;
} }
/* Avoid more than one via on the current location: */ // Avoid more than one via on the current location:
if( GetBoard()->GetViaByPosition( g_CurrentTrackSegment->m_End, if( GetBoard()->GetViaByPosition( g_CurrentTrackSegment->m_End,
g_CurrentTrackSegment->GetLayer() ) ) g_CurrentTrackSegment->GetLayer() ) )
return false; return false;
...@@ -71,11 +71,11 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -71,11 +71,11 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
return false; return false;
} }
/* Is the current segment Ok (no DRC error) ? */ // Is the current segment Ok (no DRC error) ?
if( Drc_On ) if( Drc_On )
{ {
if( BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) if( BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
/* DRC error, the change layer is not made */ // DRC error, the change layer is not made
return false; return false;
// Handle 2 segments. // Handle 2 segments.
...@@ -94,10 +94,10 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -94,10 +94,10 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
/* create the via */ // create the via
SEGVIA* via = new SEGVIA( GetBoard() ); SEGVIA* via = new SEGVIA( GetBoard() );
via->SetFlags( IS_NEW ); via->SetFlags( IS_NEW );
via->m_Shape = GetBoard()->GetDesignSettings().m_CurrentViaType; via->m_Shape = GetDesignSettings().m_CurrentViaType;
via->m_Width = GetBoard()->GetCurrentViaSize(); via->m_Width = GetBoard()->GetCurrentViaSize();
via->SetNet( GetBoard()->GetHighLightNetCode() ); via->SetNet( GetBoard()->GetHighLightNetCode() );
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End; via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
...@@ -116,7 +116,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -116,7 +116,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
else else
last_layer = GetScreen()->m_Route_Layer_BOTTOM; last_layer = GetScreen()->m_Route_Layer_BOTTOM;
/* Adjust the actual via layer pair */ // Adjust the actual via layer pair
switch ( via->GetShape() ) switch ( via->GetShape() )
{ {
case VIA_BLIND_BURIED: case VIA_BLIND_BURIED:
...@@ -150,7 +150,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -150,7 +150,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
if( Drc_On && BAD_DRC == m_drc->Drc( via, GetBoard()->m_Track ) ) if( Drc_On && BAD_DRC == m_drc->Drc( via, GetBoard()->m_Track ) )
{ {
/* DRC fault: the Via cannot be placed here ... */ // DRC fault: the Via cannot be placed here ...
delete via; delete via;
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
...@@ -235,7 +235,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ) ...@@ -235,7 +235,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
Module = (MODULE*) pt_pad->GetParent(); Module = (MODULE*) pt_pad->GetParent();
} }
if( pt_pad ) /* Displaying the ratsnest of the corresponding net. */ if( pt_pad ) // Displaying the ratsnest of the corresponding net.
{ {
pt_pad->DisplayInfo( this ); pt_pad->DisplayInfo( this );
...@@ -300,7 +300,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ) ...@@ -300,7 +300,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
} }
} }
/* Erase if no pad or module has been selected. */ // Erase if no pad or module has been selected.
if( ( pt_pad == NULL ) && ( Module == NULL ) ) if( ( pt_pad == NULL ) && ( Module == NULL ) )
{ {
DrawGeneralRatsnest( DC ); DrawGeneralRatsnest( DC );
......
...@@ -76,10 +76,10 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC ) ...@@ -76,10 +76,10 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
Text->m_Text = wxT( "text" ); Text->m_Text = wxT( "text" );
GetBoard()->GetDesignSettings().m_ModuleTextWidth = Clamp_Text_PenSize( GetBoard()->GetDesignSettings().m_ModuleTextWidth, GetDesignSettings().m_ModuleTextWidth = Clamp_Text_PenSize( GetDesignSettings().m_ModuleTextWidth,
MIN( GetBoard()->GetDesignSettings().m_ModuleTextSize.x, GetBoard()->GetDesignSettings().m_ModuleTextSize.y ), true ); MIN( GetDesignSettings().m_ModuleTextSize.x, GetDesignSettings().m_ModuleTextSize.y ), true );
Text->m_Size = GetBoard()->GetDesignSettings().m_ModuleTextSize; Text->m_Size = GetDesignSettings().m_ModuleTextSize;
Text->m_Thickness = GetBoard()->GetDesignSettings().m_ModuleTextWidth; Text->m_Thickness = GetDesignSettings().m_ModuleTextWidth;
Text->m_Pos = GetScreen()->GetCrossHairPosition(); Text->m_Pos = GetScreen()->GetCrossHairPosition();
Text->SetLocalCoord(); Text->SetLocalCoord();
...@@ -309,15 +309,15 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC ) ...@@ -309,15 +309,15 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_TEXT_T: case PCB_TEXT_T:
newSize = GetBoard()->GetDesignSettings().m_PcbTextSize; newSize = GetDesignSettings().m_PcbTextSize;
newThickness = GetBoard()->GetDesignSettings().m_PcbTextWidth; newThickness = GetDesignSettings().m_PcbTextWidth;
pcbText = (TEXTE_PCB*) aItem; pcbText = (TEXTE_PCB*) aItem;
text = (EDA_TEXT*) pcbText; text = (EDA_TEXT*) pcbText;
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
newSize = GetBoard()->GetDesignSettings().m_ModuleTextSize; newSize = GetDesignSettings().m_ModuleTextSize;
newThickness = GetBoard()->GetDesignSettings().m_ModuleTextWidth; newThickness = GetDesignSettings().m_ModuleTextWidth;
moduleText = (TEXTE_MODULE*) aItem; moduleText = (TEXTE_MODULE*) aItem;
text = (EDA_TEXT*) moduleText; text = (EDA_TEXT*) moduleText;
break; break;
...@@ -380,7 +380,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC ) ...@@ -380,7 +380,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
case TEXT_is_REFERENCE: case TEXT_is_REFERENCE:
item = module->m_Reference; item = module->m_Reference;
if( item->GetSize() != GetBoard()->GetDesignSettings().m_ModuleTextSize || item->GetThickness() != GetBoard()->GetDesignSettings().m_ModuleTextWidth ) if( item->GetSize() != GetDesignSettings().m_ModuleTextSize || item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
undoItemList.PushItem( itemWrapper ); undoItemList.PushItem( itemWrapper );
break; break;
...@@ -388,7 +388,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC ) ...@@ -388,7 +388,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
case TEXT_is_VALUE: case TEXT_is_VALUE:
item = module->m_Value; item = module->m_Value;
if( item->GetSize() != GetBoard()->GetDesignSettings().m_ModuleTextSize || item->GetThickness() != GetBoard()->GetDesignSettings().m_ModuleTextWidth ) if( item->GetSize() != GetDesignSettings().m_ModuleTextSize || item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
undoItemList.PushItem( itemWrapper ); undoItemList.PushItem( itemWrapper );
break; break;
...@@ -401,8 +401,8 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC ) ...@@ -401,8 +401,8 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
{ {
item = (TEXTE_MODULE*) boardItem; item = (TEXTE_MODULE*) boardItem;
if( item->GetSize() != GetBoard()->GetDesignSettings().m_ModuleTextSize if( item->GetSize() != GetDesignSettings().m_ModuleTextSize
|| item->GetThickness() != GetBoard()->GetDesignSettings().m_ModuleTextWidth ) || item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
{ {
undoItemList.PushItem( itemWrapper ); undoItemList.PushItem( itemWrapper );
break; break;
...@@ -432,13 +432,13 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC ) ...@@ -432,13 +432,13 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
switch( aType ) switch( aType )
{ {
case TEXT_is_REFERENCE: case TEXT_is_REFERENCE:
module->m_Reference->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth ); module->m_Reference->SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->m_Reference->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize ); module->m_Reference->SetSize( GetDesignSettings().m_ModuleTextSize );
break; break;
case TEXT_is_VALUE: case TEXT_is_VALUE:
module->m_Value->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth ); module->m_Value->SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->m_Value->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize ); module->m_Value->SetSize( GetDesignSettings().m_ModuleTextSize );
break; break;
case TEXT_is_DIVERS: case TEXT_is_DIVERS:
...@@ -447,8 +447,8 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC ) ...@@ -447,8 +447,8 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
if( boardItem->Type() == PCB_MODULE_TEXT_T ) if( boardItem->Type() == PCB_MODULE_TEXT_T )
{ {
item = (TEXTE_MODULE*) boardItem; item = (TEXTE_MODULE*) boardItem;
item->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth ); item->SetThickness( GetDesignSettings().m_ModuleTextWidth );
item->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize ); item->SetSize( GetDesignSettings().m_ModuleTextSize );
} }
} }
......
...@@ -35,19 +35,19 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -35,19 +35,19 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH: case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = GetDesignSettings().m_UseConnectedTrackWidth =
not GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth; not GetDesignSettings().m_UseConnectedTrackWidth;
break; break;
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES: case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = false; GetDesignSettings().m_UseConnectedTrackWidth = false;
GetBoard()->m_TrackWidthSelector = 0; GetBoard()->m_TrackWidthSelector = 0;
GetBoard()->m_ViaSizeSelector = 0; GetBoard()->m_ViaSizeSelector = 0;
break; break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH: case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = true; GetDesignSettings().m_UseConnectedTrackWidth = true;
break; break;
case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection
...@@ -59,7 +59,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -59,7 +59,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_WIDTH7: case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_WIDTH8: case ID_POPUP_PCB_SELECT_WIDTH8:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = false; GetDesignSettings().m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1; ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii; GetBoard()->m_TrackWidthSelector = ii;
break; break;
......
...@@ -703,13 +703,13 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName ) ...@@ -703,13 +703,13 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
// Update reference: // Update reference:
Module->m_Reference->m_Text = moduleName; Module->m_Reference->m_Text = moduleName;
Module->m_Reference->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth ); Module->m_Reference->SetThickness( GetDesignSettings().m_ModuleTextWidth );
Module->m_Reference->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize ); Module->m_Reference->SetSize( GetDesignSettings().m_ModuleTextSize );
// Set the value field to a default value // Set the value field to a default value
Module->m_Value->m_Text = wxT( "VAL**" ); Module->m_Value->m_Text = wxT( "VAL**" );
Module->m_Value->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth ); Module->m_Value->SetThickness( GetDesignSettings().m_ModuleTextWidth );
Module->m_Value->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize ); Module->m_Value->SetSize( GetDesignSettings().m_ModuleTextSize );
Module->SetPosition( wxPoint( 0, 0 ) ); Module->SetPosition( wxPoint( 0, 0 ) );
......
...@@ -215,7 +215,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC ) ...@@ -215,7 +215,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
GetBoard()->Add( target ); GetBoard()->Add( target );
target->SetLayer( EDGE_N ); target->SetLayer( EDGE_N );
target->SetWidth( GetBoard()->GetDesignSettings().m_EdgeSegmentWidth ); target->SetWidth( GetDesignSettings().m_EdgeSegmentWidth );
target->SetSize( MireDefaultSize ); target->SetSize( MireDefaultSize );
target->SetPosition( m_canvas->GetScreen()->GetCrossHairPosition() ); target->SetPosition( m_canvas->GetScreen()->GetCrossHairPosition() );
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* @brief Definition of class FOOTPRINT_EDIT_FRAME. * @brief Definition of class FOOTPRINT_EDIT_FRAME.
*/ */
#ifndef _MODULE_EDITOR_FRAME_H_ #ifndef MODULE_EDITOR_FRAME_H_
#define _MODULE_EDITOR_FRAME_H_ #define MODULE_EDITOR_FRAME_H_
class FOOTPRINT_EDIT_FRAME : public PCB_BASE_FRAME class FOOTPRINT_EDIT_FRAME : public PCB_BASE_FRAME
...@@ -13,13 +13,16 @@ public: ...@@ -13,13 +13,16 @@ public:
MODULE* CurrentModule; MODULE* CurrentModule;
public: public:
FOOTPRINT_EDIT_FRAME( wxWindow* father, FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~FOOTPRINT_EDIT_FRAME(); ~FOOTPRINT_EDIT_FRAME();
BOARD_DESIGN_SETTINGS& GetDesignSettings() const; // overload PCB_BASE_FRAME, get parent's
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings ); // overload
void InstallOptionsFrame( const wxPoint& pos ); void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
...@@ -199,6 +202,8 @@ public: ...@@ -199,6 +202,8 @@ public:
private: private:
static wxString m_CurrentLib; static wxString m_CurrentLib;
static BOARD* s_Pcb; ///< retain board accross invocations of module editor
/** /**
* Function GetComponentFromUndoList * Function GetComponentFromUndoList
* performs an undo operation on the last edition: * performs an undo operation on the last edition:
...@@ -328,10 +333,10 @@ public: ...@@ -328,10 +333,10 @@ public:
*/ */
void Enter_Edge_Width( EDGE_MODULE* aEdge ); void Enter_Edge_Width( EDGE_MODULE* aEdge );
/* Function to initialize the move function params of a graphic item type DRAWSEGMENT */ /// Function to initialize the move function params of a graphic item type DRAWSEGMENT
void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC ); void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
/* Function to place a graphic item type EDGE_MODULE currently moved */ /// Function to place a graphic item type EDGE_MODULE currently moved
void Place_EdgeMod( EDGE_MODULE* drawitem ); void Place_EdgeMod( EDGE_MODULE* drawitem );
/** /**
...@@ -355,4 +360,4 @@ public: ...@@ -355,4 +360,4 @@ public:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#endif // #define _MODULE_EDITOR_FRAME_H_ #endif // MODULE_EDITOR_FRAME_H_
...@@ -49,11 +49,9 @@ ...@@ -49,11 +49,9 @@
static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the footprint editor static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the footprint editor
// Design setting for the module editor:
static BOARD_DESIGN_SETTINGS s_ModuleEditorDesignSetting;
wxString FOOTPRINT_EDIT_FRAME::m_CurrentLib = wxEmptyString; wxString FOOTPRINT_EDIT_FRAME::m_CurrentLib = wxEmptyString;
BOARD* FOOTPRINT_EDIT_FRAME::s_Pcb;
BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END, EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
...@@ -134,12 +132,12 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -134,12 +132,12 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
END_EVENT_TABLE() END_EVENT_TABLE()
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father, FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
const wxSize& size, const wxSize& size,
long style ) : long style ) :
PCB_BASE_FRAME( father, MODULE_EDITOR_FRAME, wxEmptyString, pos, size, style ) PCB_BASE_FRAME( aParent, MODULE_EDITOR_FRAME, wxEmptyString, pos, size, style )
{ {
m_FrameName = wxT( "ModEditFrame" ); m_FrameName = wxT( "ModEditFrame" );
m_showBorderAndTitleBlock = false; // true to show the frame references m_showBorderAndTitleBlock = false; // true to show the frame references
...@@ -154,16 +152,21 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father, ...@@ -154,16 +152,21 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
UpdateTitle(); UpdateTitle();
if( g_ModuleEditor_Pcb == NULL ) if( !s_Pcb )
g_ModuleEditor_Pcb = new BOARD(); s_Pcb = new BOARD();
SetBoard( g_ModuleEditor_Pcb ); SetBoard( s_Pcb );
if( s_screenModule == NULL ) if( s_screenModule == NULL )
s_screenModule = new PCB_SCREEN( GetPageSettings().GetSizeIU() ); s_screenModule = new PCB_SCREEN( GetPageSettings().GetSizeIU() );
SetScreen( s_screenModule ); SetScreen( s_screenModule );
GetBoard()->SetDesignSettings( s_ModuleEditorDesignSetting );
/* not sure why this was here, formerly s_ModuleEditorDesignSetting, since
we get default BOARD_DESIGN_SETTINGS in BOARD's constructor.
GetBoard()->SetDesignSettings( BOARD_DESIGN_SETTINGS() );
*/
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
LoadSettings(); LoadSettings();
...@@ -215,16 +218,42 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father, ...@@ -215,16 +218,42 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME() FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME()
{ {
/* g_ModuleEditor_Pcb and its corresponding PCB_SCREEN are not deleted // When user reopens the Footprint editor, user would like to find the last edited item.
* here, because if we reopen the Footprint editor, we expect to find // Do not delete PCB_SCREEN (by the destructor of EDA_DRAW_FRAME)
* the last edited item SetScreen( NULL );
*/
SetScreen( NULL ); /* Do not delete (by the destructor of EDA_DRAW_FRAME) the
* PCB_SCREEN handling g_ModuleEditor_Pcb
*/
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) GetParent(); PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) GetParent();
frame->m_ModuleEditFrame = NULL; frame->m_ModuleEditFrame = NULL;
// Do not allow PCB_BASE_FRAME::~PCB_BASE_FRAME()
// to delete our precious BOARD, which is also in static FOOTPRINT_EDIT_FRAME::s_Pcb.
// That function, PCB_BASE_FRAME::~PCB_BASE_FRAME(), runs immediately next
// as we return from here.
m_Pcb = 0;
}
BOARD_DESIGN_SETTINGS& FOOTPRINT_EDIT_FRAME::GetDesignSettings() const
{
// get the BOARD_DESIGN_SETTINGS from the parent editor, not our BOARD.
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent();
wxASSERT( parentFrame );
return parentFrame->GetDesignSettings();
}
void FOOTPRINT_EDIT_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings )
{
// set the BOARD_DESIGN_SETTINGS int parent editor, not our BOARD.
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent();
wxASSERT( parentFrame );
parentFrame->SetDesignSettings( aSettings );
} }
......
...@@ -623,7 +623,7 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void ) ...@@ -623,7 +623,7 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void )
int copperlayercnt = GetBoard()->GetCopperLayerCount( ); int copperlayercnt = GetBoard()->GetCopperLayerCount( );
int currLayer = getActiveLayer(); int currLayer = getActiveLayer();
if( !GetBoard()->GetDesignSettings().m_MicroViasAllowed ) if( !GetDesignSettings().m_MicroViasAllowed )
return false; // Obvious.. return false; // Obvious..
if( copperlayercnt < 4 ) if( copperlayercnt < 4 )
......
...@@ -127,7 +127,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator() ...@@ -127,7 +127,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
change = true; change = true;
} }
int via_type = GetBoard()->GetDesignSettings().m_CurrentViaType; int via_type = GetDesignSettings().m_CurrentViaType;
via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type); via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type);
if( previous_via_color != via_color ) if( previous_via_color != via_color )
......
...@@ -60,7 +60,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ) ...@@ -60,7 +60,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
{ {
bool check = ( ( ( ID_POPUP_PCB_SELECT_WIDTH1 + bool check = ( ( ( ID_POPUP_PCB_SELECT_WIDTH1 +
(int) GetBoard()->m_TrackWidthSelector ) == aEvent.GetId() ) && (int) GetBoard()->m_TrackWidthSelector ) == aEvent.GetId() ) &&
!GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth ); !GetDesignSettings().m_UseConnectedTrackWidth );
aEvent.Check( check ); aEvent.Check( check );
} }
} }
...@@ -68,7 +68,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ) ...@@ -68,7 +68,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
void PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth ); aEvent.Check( GetDesignSettings().m_UseConnectedTrackWidth );
} }
...@@ -85,7 +85,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent ) ...@@ -85,7 +85,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent )
{ {
bool check = ( ( ( ID_POPUP_PCB_SELECT_VIASIZE1 + bool check = ( ( ( ID_POPUP_PCB_SELECT_VIASIZE1 +
(int) GetBoard()->m_ViaSizeSelector ) == aEvent.GetId() ) && (int) GetBoard()->m_ViaSizeSelector ) == aEvent.GetId() ) &&
!GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth ); !GetDesignSettings().m_UseConnectedTrackWidth );
aEvent.Check( check ); aEvent.Check( check );
} }
......
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