get rid of some globals, share BOARD_DESIGN_SETTINGS from PCB_EDIT_FRAME with FOOTPRINT_EDIT_FRAME
This commit is contained in:
parent
cc46daa67f
commit
716d21d88a
|
@ -89,7 +89,7 @@ static void CALLBACK tesswxPoint2Vertex( const GLvoid* data );
|
|||
|
||||
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() )
|
||||
return;
|
||||
|
||||
|
@ -112,8 +112,8 @@ void EDA_3D_CANVAS::Redraw( bool finish )
|
|||
|
||||
InitGL();
|
||||
|
||||
glMatrixMode( GL_MODELVIEW ); /* position viewer */
|
||||
/* transformations */
|
||||
glMatrixMode( GL_MODELVIEW ); // position viewer
|
||||
// transformations
|
||||
GLfloat mat[4][4];
|
||||
|
||||
// Translate motion first, so rotations don't mess up the orientation...
|
||||
|
@ -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_BoardScale;
|
||||
|
||||
/* calculate z position for each layer */
|
||||
// calculate z position for each layer
|
||||
for( ii = 0; ii < 32; ii++ )
|
||||
{
|
||||
if( ii < g_Parm_3D_Visu.m_Layers )
|
||||
|
@ -205,7 +205,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
|
||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||
|
||||
/* draw axis */
|
||||
// draw axis
|
||||
if( g_Parm_3D_Visu.m_Draw3DAxis )
|
||||
{
|
||||
glEnable( GL_COLOR_MATERIAL );
|
||||
|
@ -222,7 +222,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
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
|
||||
glEnable( GL_FOG );
|
||||
GLfloat param;
|
||||
|
@ -255,14 +255,14 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
glEnd();
|
||||
#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,
|
||||
-g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BoardScale,
|
||||
0.0F );
|
||||
|
||||
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() )
|
||||
{
|
||||
if( track->Type() == PCB_VIA_T )
|
||||
|
@ -370,7 +370,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
}
|
||||
}
|
||||
|
||||
/* draw graphic items */
|
||||
// draw graphic items
|
||||
EDA_ITEM* PtStruct;
|
||||
|
||||
for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
|
@ -390,7 +390,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
}
|
||||
}
|
||||
|
||||
/* draw footprints */
|
||||
// draw footprints
|
||||
MODULE* Module = pcb->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
|
@ -400,7 +400,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
|
|||
|
||||
glEndList();
|
||||
|
||||
/* Test for errors */
|
||||
// Test for errors
|
||||
CheckGLError();
|
||||
|
||||
return m_gllist;
|
||||
|
@ -694,7 +694,7 @@ void MODULE::Draw3D( EDA_3D_CANVAS* glcanvas )
|
|||
{
|
||||
D_PAD* pad = m_Pads;
|
||||
|
||||
/* Draw pads */
|
||||
// Draw pads
|
||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
||||
|
||||
|
@ -703,7 +703,7 @@ void MODULE::Draw3D( EDA_3D_CANVAS* 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;
|
||||
bool As3dShape = false;
|
||||
|
||||
|
@ -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 )
|
||||
{
|
||||
int ii, ll, layer, nlmax;
|
||||
|
@ -912,7 +912,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
|
|||
holeY = (double) m_Drill.y * scale / 2;
|
||||
hole = fmin( holeX, holeY );
|
||||
|
||||
/* Calculate the center of the pad. */
|
||||
// Calculate the center of the pad.
|
||||
shape_pos = ReturnShapePos();
|
||||
ux0 = shape_pos.x;
|
||||
uy0 = shape_pos.y;
|
||||
|
@ -926,7 +926,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
|
|||
drillx = m_Pos.x * 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 )
|
||||
{
|
||||
SetGLColor( DARKGRAY );
|
||||
|
@ -981,13 +981,13 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas )
|
|||
break;
|
||||
|
||||
case PAD_OVAL:
|
||||
if( dx > dy ) /* Horizontal ellipse */
|
||||
if( dx > dy ) // Horizontal ellipse
|
||||
{
|
||||
delta_cx = dx - dy;
|
||||
delta_cy = 0;
|
||||
w = m_Size.y * scale;
|
||||
}
|
||||
else /* Vertical ellipse */
|
||||
else // Vertical ellipse
|
||||
{
|
||||
delta_cx = 0;
|
||||
delta_cy = dy - dx;
|
||||
|
@ -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,
|
||||
double endy, double width, double zpos )
|
||||
{
|
||||
|
|
|
@ -111,8 +111,6 @@ class BOARD_DESIGN_SETTINGS g_DesignSettings;
|
|||
*/
|
||||
DLIST<TRACK> g_CurrentTrackList;
|
||||
|
||||
BOARD* g_ModuleEditor_Pcb = NULL;
|
||||
|
||||
bool g_Zone_45_Only = false;
|
||||
|
||||
// Default setting used when creating a new zone
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* @file pcbcommon.h
|
||||
*/
|
||||
|
||||
#ifndef __PCBCOMMON_H__
|
||||
#define __PCBCOMMON_H__
|
||||
#ifndef PCBCOMMON_H_
|
||||
#define PCBCOMMON_H_
|
||||
|
||||
|
||||
#include <dlist.h>
|
||||
|
@ -13,7 +13,7 @@
|
|||
//#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;
|
||||
|
@ -30,7 +30,7 @@ class DISPLAY_OPTIONS;
|
|||
*/
|
||||
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 DISPLAY_OPTIONS DisplayOpt;
|
||||
|
@ -52,10 +52,8 @@ extern DLIST<TRACK> g_CurrentTrackList;
|
|||
|
||||
#define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created
|
||||
|
||||
extern BOARD* g_ModuleEditor_Pcb;
|
||||
|
||||
/* Pad editing */
|
||||
/// Pad editing
|
||||
extern D_PAD g_Pad_Master;
|
||||
|
||||
|
||||
#endif /* __PCBCOMMON_H__ */
|
||||
#endif // PCBCOMMON_H_
|
||||
|
|
|
@ -122,6 +122,14 @@ public:
|
|||
const TITLE_BLOCK& GetTitleBlock() const; // 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
|
||||
* sets the m_Pcb member in such as way as to ensure deleting any previous
|
||||
|
@ -130,9 +138,9 @@ public:
|
|||
*/
|
||||
void SetBoard( BOARD* aBoard );
|
||||
|
||||
BOARD* GetBoard()
|
||||
BOARD* GetBoard() const
|
||||
{
|
||||
wxASSERT( m_Pcb ); // phasing out m_Pcb for GerbView
|
||||
wxASSERT( m_Pcb );
|
||||
return m_Pcb;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,15 +113,13 @@ PCB_BASE_FRAME::~PCB_BASE_FRAME()
|
|||
{
|
||||
delete m_Collector;
|
||||
|
||||
// delete m_Pcb;
|
||||
delete m_Pcb; // is already NULL for FOOTPRINT_EDIT_FRAME
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
||||
{
|
||||
if( m_Pcb != g_ModuleEditor_Pcb )
|
||||
delete m_Pcb;
|
||||
|
||||
m_Pcb = aBoard;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
wxASSERT( m_Pcb );
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
TRACK* segment; // The current segment being analyzed.
|
||||
|
|
|
@ -528,17 +528,17 @@ public:
|
|||
* Function GetDesignSettings
|
||||
* @return the BOARD_DESIGN_SETTINGS for this BOARD
|
||||
*/
|
||||
// const BOARD_DESIGN_SETTINGS& GetDesignSettings() const want to use this one
|
||||
BOARD_DESIGN_SETTINGS& GetDesignSettings()
|
||||
BOARD_DESIGN_SETTINGS& GetDesignSettings() const
|
||||
{
|
||||
return m_designSettings;
|
||||
// remove const-ness with cast.
|
||||
return (BOARD_DESIGN_SETTINGS&) m_designSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetDesignSettings
|
||||
* @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; }
|
||||
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
|
||||
|
|
|
@ -56,17 +56,17 @@ static wxPoint MoveVector; // Move vector for move edge
|
|||
static wxPoint CursorInitialPosition; // Mouse cursor initial position for move command
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
|
||||
void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* aEdge, wxDC* DC )
|
||||
{
|
||||
if( Edge == NULL )
|
||||
if( aEdge == NULL )
|
||||
return;
|
||||
|
||||
Edge->Draw( m_canvas, DC, GR_XOR );
|
||||
Edge->SetFlags( IS_MOVED );
|
||||
aEdge->Draw( m_canvas, DC, GR_XOR );
|
||||
aEdge->SetFlags( IS_MOVED );
|
||||
MoveVector.x = MoveVector.y = 0;
|
||||
CursorInitialPosition = GetScreen()->GetCrossHairPosition();
|
||||
m_canvas->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline );
|
||||
SetCurItem( Edge );
|
||||
SetCurItem( aEdge );
|
||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||
}
|
||||
|
||||
|
@ -101,23 +101,23 @@ static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|||
const wxPoint& aPosition, bool aErase )
|
||||
{
|
||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
||||
EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem();
|
||||
EDGE_MODULE* edge = (EDGE_MODULE*) screen->GetCurItem();
|
||||
|
||||
if( Edge == NULL )
|
||||
if( edge == NULL )
|
||||
return;
|
||||
|
||||
MODULE* Module = (MODULE*) Edge->GetParent();
|
||||
MODULE* module = (MODULE*) edge->GetParent();
|
||||
|
||||
if( aErase )
|
||||
{
|
||||
Edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
||||
edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
||||
}
|
||||
|
||||
MoveVector = -(screen->GetCrossHairPosition() - CursorInitialPosition);
|
||||
|
||||
Edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
||||
edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
||||
|
||||
Module->CalculateBoundingBox();
|
||||
module->CalculateBoundingBox();
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,30 +128,30 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
|
|||
bool aErase )
|
||||
{
|
||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
||||
EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem();
|
||||
EDGE_MODULE* edge = (EDGE_MODULE*) screen->GetCurItem();
|
||||
|
||||
if( Edge == NULL )
|
||||
if( edge == NULL )
|
||||
return;
|
||||
|
||||
MODULE* module = (MODULE*) Edge->GetParent();
|
||||
MODULE* module = (MODULE*) edge->GetParent();
|
||||
|
||||
// if( erase )
|
||||
{
|
||||
Edge->Draw( aPanel, aDC, GR_XOR );
|
||||
edge->Draw( aPanel, aDC, GR_XOR );
|
||||
}
|
||||
|
||||
Edge->SetEnd( screen->GetCrossHairPosition() );
|
||||
edge->SetEnd( screen->GetCrossHairPosition() );
|
||||
|
||||
// Update relative coordinate.
|
||||
Edge->SetEnd0( Edge->GetEnd() - module->GetPosition() );
|
||||
edge->SetEnd0( edge->GetEnd() - module->GetPosition() );
|
||||
|
||||
wxPoint pt( Edge->GetEnd0() );
|
||||
wxPoint pt( edge->GetEnd0() );
|
||||
|
||||
RotatePoint( &pt, -module->GetOrientation() );
|
||||
|
||||
Edge->SetEnd0( pt );
|
||||
edge->SetEnd0( pt );
|
||||
|
||||
Edge->Draw( aPanel, aDC, GR_XOR );
|
||||
edge->Draw( aPanel, aDC, GR_XOR );
|
||||
|
||||
module->CalculateBoundingBox();
|
||||
}
|
||||
|
@ -172,12 +172,12 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
|
|||
if( aEdge->Type() != PCB_MODULE_EDGE_T )
|
||||
continue;
|
||||
|
||||
aEdge->SetWidth( GetBoard()->GetDesignSettings().m_ModuleSegmentWidth );
|
||||
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aEdge->SetWidth( GetBoard()->GetDesignSettings().m_ModuleSegmentWidth );
|
||||
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
|
||||
}
|
||||
|
||||
OnModify();
|
||||
|
@ -194,7 +194,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
|
|||
if( aEdge )
|
||||
new_layer = aEdge->GetLayer();
|
||||
|
||||
/* Ask for the new layer */
|
||||
// Ask for the new layer
|
||||
new_layer = SelectLayer( new_layer, FIRST_COPPER_LAYER, LAST_NO_COPPER_LAYER );
|
||||
|
||||
if( new_layer < 0 )
|
||||
|
@ -238,7 +238,7 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
|
|||
{
|
||||
wxString buffer;
|
||||
|
||||
buffer = ReturnStringFromValue( g_UserUnit, GetBoard()->GetDesignSettings().m_ModuleSegmentWidth,
|
||||
buffer = ReturnStringFromValue( g_UserUnit, GetDesignSettings().m_ModuleSegmentWidth,
|
||||
GetScreen()->GetInternalUnits() );
|
||||
wxTextEntryDialog dlg( this, _( "New Width:" ), _( "Edge Width" ), buffer );
|
||||
|
||||
|
@ -246,36 +246,36 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
|
|||
return; // canceled by user
|
||||
|
||||
buffer = dlg.GetValue( );
|
||||
GetBoard()->GetDesignSettings().m_ModuleSegmentWidth =
|
||||
GetDesignSettings().m_ModuleSegmentWidth =
|
||||
ReturnValueFromString( g_UserUnit, buffer, GetScreen()->GetInternalUnits() );
|
||||
|
||||
if( aEdge )
|
||||
{
|
||||
MODULE* module = GetBoard()->m_Modules;
|
||||
aEdge->SetWidth( GetBoard()->GetDesignSettings().m_ModuleSegmentWidth );
|
||||
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
|
||||
module->CalculateBoundingBox();
|
||||
OnModify();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::Delete_Edge_Module( EDGE_MODULE* Edge )
|
||||
void FOOTPRINT_EDIT_FRAME::Delete_Edge_Module( EDGE_MODULE* aEdge )
|
||||
{
|
||||
if( Edge == NULL )
|
||||
if( aEdge == NULL )
|
||||
return;
|
||||
|
||||
if( Edge->Type() != PCB_MODULE_EDGE_T )
|
||||
if( aEdge->Type() != PCB_MODULE_EDGE_T )
|
||||
{
|
||||
DisplayError( this, wxT( "StructType error: PCB_MODULE_EDGE_T expected" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
MODULE* Module = (MODULE*) Edge->GetParent();
|
||||
MODULE* module = (MODULE*) aEdge->GetParent();
|
||||
|
||||
/* Delete segment. */
|
||||
Edge->DeleteStructure();
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
Module->CalculateBoundingBox();
|
||||
// Delete segment.
|
||||
aEdge->DeleteStructure();
|
||||
module->m_LastEdit_Time = time( NULL );
|
||||
module->CalculateBoundingBox();
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
@ -284,24 +284,24 @@ void FOOTPRINT_EDIT_FRAME::Delete_Edge_Module( EDGE_MODULE* Edge )
|
|||
*/
|
||||
static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||
{
|
||||
EDGE_MODULE* Edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem();
|
||||
EDGE_MODULE* edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem();
|
||||
|
||||
Panel->SetMouseCapture( NULL, NULL );
|
||||
|
||||
if( Edge && ( Edge->Type() == PCB_MODULE_EDGE_T ) )
|
||||
if( edge && ( edge->Type() == PCB_MODULE_EDGE_T ) )
|
||||
{
|
||||
if( Edge->IsNew() ) // On aborting, delete new outline.
|
||||
if( edge->IsNew() ) // On aborting, delete new outline.
|
||||
{
|
||||
MODULE* Module = (MODULE*) Edge->GetParent();
|
||||
Edge->Draw( Panel, DC, GR_XOR, MoveVector );
|
||||
Edge->DeleteStructure();
|
||||
Module->CalculateBoundingBox();
|
||||
MODULE* module = (MODULE*) edge->GetParent();
|
||||
edge->Draw( Panel, DC, GR_XOR, MoveVector );
|
||||
edge->DeleteStructure();
|
||||
module->CalculateBoundingBox();
|
||||
}
|
||||
else // On aborting, move existing outline to its initial position.
|
||||
{
|
||||
Edge->Draw( Panel, DC, GR_XOR, MoveVector );
|
||||
Edge->ClearFlags();
|
||||
Edge->Draw( Panel, DC, GR_OR );
|
||||
edge->Draw( Panel, DC, GR_XOR, MoveVector );
|
||||
edge->ClearFlags();
|
||||
edge->Draw( Panel, DC, GR_OR );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
|
||||
EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
|
||||
wxDC* DC,
|
||||
int type_edge )
|
||||
{
|
||||
|
@ -319,45 +319,45 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
|
|||
if( module == NULL )
|
||||
return NULL;
|
||||
|
||||
if( Edge == NULL ) /* Start a new edge item */
|
||||
if( aEdge == NULL ) // Start a new edge item
|
||||
{
|
||||
SaveCopyInUndoList( module, UR_MODEDIT );
|
||||
|
||||
Edge = new EDGE_MODULE( module );
|
||||
aEdge = new EDGE_MODULE( module );
|
||||
MoveVector.x = MoveVector.y = 0;
|
||||
|
||||
// Add the new item to the Drawings list head
|
||||
module->m_Drawings.PushFront( Edge );
|
||||
module->m_Drawings.PushFront( aEdge );
|
||||
|
||||
// Update characteristics of the segment or arc.
|
||||
Edge->SetFlags( IS_NEW );
|
||||
Edge->SetAngle( angle );
|
||||
Edge->SetShape( type_edge );
|
||||
aEdge->SetFlags( IS_NEW );
|
||||
aEdge->SetAngle( angle );
|
||||
aEdge->SetShape( type_edge );
|
||||
|
||||
if( Edge->GetShape() == S_ARC )
|
||||
Edge->SetAngle( ArcValue );
|
||||
if( aEdge->GetShape() == S_ARC )
|
||||
aEdge->SetAngle( ArcValue );
|
||||
|
||||
Edge->SetWidth( GetBoard()->GetDesignSettings().m_ModuleSegmentWidth );
|
||||
Edge->SetLayer( module->GetLayer() );
|
||||
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
|
||||
aEdge->SetLayer( module->GetLayer() );
|
||||
|
||||
if( module->GetLayer() == LAYER_N_FRONT )
|
||||
Edge->SetLayer( SILKSCREEN_N_FRONT );
|
||||
aEdge->SetLayer( SILKSCREEN_N_FRONT );
|
||||
|
||||
if( module->GetLayer() == LAYER_N_BACK )
|
||||
Edge->SetLayer( SILKSCREEN_N_BACK );
|
||||
aEdge->SetLayer( SILKSCREEN_N_BACK );
|
||||
|
||||
// Initialize the starting point of the new segment or arc
|
||||
Edge->SetStart( GetScreen()->GetCrossHairPosition() );
|
||||
aEdge->SetStart( GetScreen()->GetCrossHairPosition() );
|
||||
|
||||
// Initialize the ending point of the new segment or arc
|
||||
Edge->SetEnd( Edge->GetStart() );
|
||||
aEdge->SetEnd( aEdge->GetStart() );
|
||||
|
||||
// Initialize the relative coordinates
|
||||
Edge->SetStart0( Edge->GetStart() - module->GetPosition() );
|
||||
aEdge->SetStart0( aEdge->GetStart() - module->GetPosition() );
|
||||
|
||||
RotatePoint( &Edge->m_Start0, -module->m_Orient );
|
||||
RotatePoint( &aEdge->m_Start0, -module->m_Orient );
|
||||
|
||||
Edge->m_End0 = Edge->m_Start0;
|
||||
aEdge->m_End0 = aEdge->m_Start0;
|
||||
module->CalculateBoundingBox();
|
||||
m_canvas->SetMouseCapture( ShowNewEdgeModule, Abort_Move_ModuleOutline );
|
||||
}
|
||||
|
@ -370,33 +370,33 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
|
|||
{
|
||||
if( type_edge == S_SEGMENT )
|
||||
{
|
||||
if( Edge->m_Start0 != Edge->m_End0 )
|
||||
if( aEdge->m_Start0 != aEdge->m_End0 )
|
||||
{
|
||||
Edge->Draw( m_canvas, DC, GR_OR );
|
||||
aEdge->Draw( m_canvas, DC, GR_OR );
|
||||
|
||||
EDGE_MODULE* newedge = new EDGE_MODULE( *Edge );
|
||||
EDGE_MODULE* newedge = new EDGE_MODULE( *aEdge );
|
||||
|
||||
// insert _after_ Edge, which is the same as inserting before Edge->Next()
|
||||
module->m_Drawings.Insert( newedge, Edge->Next() );
|
||||
Edge->ClearFlags();
|
||||
// insert _after_ aEdge, which is the same as inserting before aEdge->Next()
|
||||
module->m_Drawings.Insert( newedge, aEdge->Next() );
|
||||
aEdge->ClearFlags();
|
||||
|
||||
Edge = newedge; // point now new item
|
||||
aEdge = newedge; // point now new item
|
||||
|
||||
Edge->SetFlags( IS_NEW );
|
||||
Edge->SetWidth( GetBoard()->GetDesignSettings().m_ModuleSegmentWidth );
|
||||
Edge->SetStart( GetScreen()->GetCrossHairPosition() );
|
||||
Edge->SetEnd( Edge->GetStart() );
|
||||
aEdge->SetFlags( IS_NEW );
|
||||
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
|
||||
aEdge->SetStart( GetScreen()->GetCrossHairPosition() );
|
||||
aEdge->SetEnd( aEdge->GetStart() );
|
||||
|
||||
// Update relative coordinate.
|
||||
Edge->SetStart0( Edge->GetStart() - module->GetPosition() );
|
||||
aEdge->SetStart0( aEdge->GetStart() - module->GetPosition() );
|
||||
|
||||
wxPoint pt( Edge->GetStart0() );
|
||||
wxPoint pt( aEdge->GetStart0() );
|
||||
|
||||
RotatePoint( &pt, -module->GetOrientation() );
|
||||
|
||||
Edge->SetStart0( pt );
|
||||
aEdge->SetStart0( pt );
|
||||
|
||||
Edge->SetEnd0( Edge->GetStart0() );
|
||||
aEdge->SetEnd0( aEdge->GetStart0() );
|
||||
|
||||
module->CalculateBoundingBox();
|
||||
module->m_LastEdit_Time = time( NULL );
|
||||
|
@ -409,25 +409,25 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
|
|||
}
|
||||
}
|
||||
|
||||
return Edge;
|
||||
return aEdge;
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* Edge )
|
||||
void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* aEdge )
|
||||
{
|
||||
MODULE* Module = GetBoard()->m_Modules;
|
||||
MODULE* module = GetBoard()->m_Modules;
|
||||
|
||||
if( Edge )
|
||||
if( aEdge )
|
||||
{
|
||||
Edge->ClearFlags();
|
||||
aEdge->ClearFlags();
|
||||
|
||||
/* If last segment length is 0: remove it */
|
||||
if( Edge->GetStart() == Edge->GetEnd() )
|
||||
Edge->DeleteStructure();
|
||||
// If last segment length is 0: remove it
|
||||
if( aEdge->GetStart() == aEdge->GetEnd() )
|
||||
aEdge->DeleteStructure();
|
||||
}
|
||||
|
||||
Module->CalculateBoundingBox();
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
module->CalculateBoundingBox();
|
||||
module->m_LastEdit_Time = time( NULL );
|
||||
OnModify();
|
||||
m_canvas->SetMouseCapture( NULL, NULL );
|
||||
}
|
||||
|
|
|
@ -355,14 +355,14 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
}
|
||||
else
|
||||
{
|
||||
int v_type = GetBoard()->GetDesignSettings().m_CurrentViaType;
|
||||
int v_type = GetDesignSettings().m_CurrentViaType;
|
||||
|
||||
// place micro via and switch layer.
|
||||
if( id == ID_POPUP_PCB_PLACE_MICROVIA )
|
||||
GetBoard()->GetDesignSettings().m_CurrentViaType = VIA_MICROVIA;
|
||||
GetDesignSettings().m_CurrentViaType = VIA_MICROVIA;
|
||||
|
||||
Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
|
||||
GetBoard()->GetDesignSettings().m_CurrentViaType = v_type;
|
||||
GetDesignSettings().m_CurrentViaType = v_type;
|
||||
|
||||
if( DisplayOpt.ContrastModeDisplay )
|
||||
m_canvas->Refresh();
|
||||
|
|
|
@ -51,7 +51,7 @@ static wxPoint s_InitialPosition; // Initial 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 )
|
||||
{
|
||||
if( drawitem == NULL )
|
||||
|
@ -119,7 +119,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
|
|||
|
||||
if( Segment->IsNew() ) // Trace in progress.
|
||||
{
|
||||
/* Delete current segment. */
|
||||
// Delete current segment.
|
||||
DisplayOpt.DisplayDrawItems = SKETCH;
|
||||
Segment->Draw( m_canvas, DC, GR_XOR );
|
||||
PtStruct = Segment->Back();
|
||||
|
@ -236,14 +236,14 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
|
|||
int s_large;
|
||||
DRAWSEGMENT* DrawItem;
|
||||
|
||||
s_large = GetBoard()->GetDesignSettings().m_DrawSegmentWidth;
|
||||
s_large = GetDesignSettings().m_DrawSegmentWidth;
|
||||
|
||||
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() ) );
|
||||
Segment->SetFlags( IS_NEW );
|
||||
|
|
|
@ -60,7 +60,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
|||
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,
|
||||
g_CurrentTrackSegment->GetLayer() ) )
|
||||
return false;
|
||||
|
@ -71,11 +71,11 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Is the current segment Ok (no DRC error) ? */
|
||||
// Is the current segment Ok (no DRC error) ?
|
||||
if( Drc_On )
|
||||
{
|
||||
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;
|
||||
|
||||
// Handle 2 segments.
|
||||
|
@ -94,10 +94,10 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
|||
|
||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||
|
||||
/* create the via */
|
||||
// create the via
|
||||
SEGVIA* via = new SEGVIA( GetBoard() );
|
||||
via->SetFlags( IS_NEW );
|
||||
via->m_Shape = GetBoard()->GetDesignSettings().m_CurrentViaType;
|
||||
via->m_Shape = GetDesignSettings().m_CurrentViaType;
|
||||
via->m_Width = GetBoard()->GetCurrentViaSize();
|
||||
via->SetNet( GetBoard()->GetHighLightNetCode() );
|
||||
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 )
|
|||
else
|
||||
last_layer = GetScreen()->m_Route_Layer_BOTTOM;
|
||||
|
||||
/* Adjust the actual via layer pair */
|
||||
// Adjust the actual via layer pair
|
||||
switch ( via->GetShape() )
|
||||
{
|
||||
case VIA_BLIND_BURIED:
|
||||
|
@ -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 ) )
|
||||
{
|
||||
/* DRC fault: the Via cannot be placed here ... */
|
||||
// DRC fault: the Via cannot be placed here ...
|
||||
delete via;
|
||||
|
||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||
|
@ -235,7 +235,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
|
|||
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 );
|
||||
|
||||
|
@ -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 ) )
|
||||
{
|
||||
DrawGeneralRatsnest( DC );
|
||||
|
|
|
@ -76,10 +76,10 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
|
|||
|
||||
Text->m_Text = wxT( "text" );
|
||||
|
||||
GetBoard()->GetDesignSettings().m_ModuleTextWidth = Clamp_Text_PenSize( GetBoard()->GetDesignSettings().m_ModuleTextWidth,
|
||||
MIN( GetBoard()->GetDesignSettings().m_ModuleTextSize.x, GetBoard()->GetDesignSettings().m_ModuleTextSize.y ), true );
|
||||
Text->m_Size = GetBoard()->GetDesignSettings().m_ModuleTextSize;
|
||||
Text->m_Thickness = GetBoard()->GetDesignSettings().m_ModuleTextWidth;
|
||||
GetDesignSettings().m_ModuleTextWidth = Clamp_Text_PenSize( GetDesignSettings().m_ModuleTextWidth,
|
||||
MIN( GetDesignSettings().m_ModuleTextSize.x, GetDesignSettings().m_ModuleTextSize.y ), true );
|
||||
Text->m_Size = GetDesignSettings().m_ModuleTextSize;
|
||||
Text->m_Thickness = GetDesignSettings().m_ModuleTextWidth;
|
||||
Text->m_Pos = GetScreen()->GetCrossHairPosition();
|
||||
Text->SetLocalCoord();
|
||||
|
||||
|
@ -309,15 +309,15 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
|
|||
switch( aItem->Type() )
|
||||
{
|
||||
case PCB_TEXT_T:
|
||||
newSize = GetBoard()->GetDesignSettings().m_PcbTextSize;
|
||||
newThickness = GetBoard()->GetDesignSettings().m_PcbTextWidth;
|
||||
newSize = GetDesignSettings().m_PcbTextSize;
|
||||
newThickness = GetDesignSettings().m_PcbTextWidth;
|
||||
pcbText = (TEXTE_PCB*) aItem;
|
||||
text = (EDA_TEXT*) pcbText;
|
||||
break;
|
||||
|
||||
case PCB_MODULE_TEXT_T:
|
||||
newSize = GetBoard()->GetDesignSettings().m_ModuleTextSize;
|
||||
newThickness = GetBoard()->GetDesignSettings().m_ModuleTextWidth;
|
||||
newSize = GetDesignSettings().m_ModuleTextSize;
|
||||
newThickness = GetDesignSettings().m_ModuleTextWidth;
|
||||
moduleText = (TEXTE_MODULE*) aItem;
|
||||
text = (EDA_TEXT*) moduleText;
|
||||
break;
|
||||
|
@ -380,7 +380,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
|
|||
case TEXT_is_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 );
|
||||
|
||||
break;
|
||||
|
@ -388,7 +388,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
|
|||
case TEXT_is_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 );
|
||||
|
||||
break;
|
||||
|
@ -401,8 +401,8 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
|
|||
{
|
||||
item = (TEXTE_MODULE*) boardItem;
|
||||
|
||||
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 );
|
||||
break;
|
||||
|
@ -432,13 +432,13 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
|
|||
switch( aType )
|
||||
{
|
||||
case TEXT_is_REFERENCE:
|
||||
module->m_Reference->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth );
|
||||
module->m_Reference->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize );
|
||||
module->m_Reference->SetThickness( GetDesignSettings().m_ModuleTextWidth );
|
||||
module->m_Reference->SetSize( GetDesignSettings().m_ModuleTextSize );
|
||||
break;
|
||||
|
||||
case TEXT_is_VALUE:
|
||||
module->m_Value->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth );
|
||||
module->m_Value->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize );
|
||||
module->m_Value->SetThickness( GetDesignSettings().m_ModuleTextWidth );
|
||||
module->m_Value->SetSize( GetDesignSettings().m_ModuleTextSize );
|
||||
break;
|
||||
|
||||
case TEXT_is_DIVERS:
|
||||
|
@ -447,8 +447,8 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
|
|||
if( boardItem->Type() == PCB_MODULE_TEXT_T )
|
||||
{
|
||||
item = (TEXTE_MODULE*) boardItem;
|
||||
item->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth );
|
||||
item->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize );
|
||||
item->SetThickness( GetDesignSettings().m_ModuleTextWidth );
|
||||
item->SetSize( GetDesignSettings().m_ModuleTextSize );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,19 +35,19 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
|
|||
switch( id )
|
||||
{
|
||||
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
|
||||
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth =
|
||||
not GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth;
|
||||
GetDesignSettings().m_UseConnectedTrackWidth =
|
||||
not GetDesignSettings().m_UseConnectedTrackWidth;
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
|
||||
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = false;
|
||||
GetDesignSettings().m_UseConnectedTrackWidth = false;
|
||||
GetBoard()->m_TrackWidthSelector = 0;
|
||||
GetBoard()->m_ViaSizeSelector = 0;
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = true;
|
||||
GetDesignSettings().m_UseConnectedTrackWidth = true;
|
||||
break;
|
||||
|
||||
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 )
|
|||
case ID_POPUP_PCB_SELECT_WIDTH7:
|
||||
case ID_POPUP_PCB_SELECT_WIDTH8:
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth = false;
|
||||
GetDesignSettings().m_UseConnectedTrackWidth = false;
|
||||
ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
|
||||
GetBoard()->m_TrackWidthSelector = ii;
|
||||
break;
|
||||
|
|
|
@ -703,13 +703,13 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
|
|||
|
||||
// Update reference:
|
||||
Module->m_Reference->m_Text = moduleName;
|
||||
Module->m_Reference->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth );
|
||||
Module->m_Reference->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize );
|
||||
Module->m_Reference->SetThickness( GetDesignSettings().m_ModuleTextWidth );
|
||||
Module->m_Reference->SetSize( GetDesignSettings().m_ModuleTextSize );
|
||||
|
||||
// Set the value field to a default value
|
||||
Module->m_Value->m_Text = wxT( "VAL**" );
|
||||
Module->m_Value->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth );
|
||||
Module->m_Value->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize );
|
||||
Module->m_Value->SetThickness( GetDesignSettings().m_ModuleTextWidth );
|
||||
Module->m_Value->SetSize( GetDesignSettings().m_ModuleTextSize );
|
||||
|
||||
Module->SetPosition( wxPoint( 0, 0 ) );
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
|
|||
GetBoard()->Add( target );
|
||||
|
||||
target->SetLayer( EDGE_N );
|
||||
target->SetWidth( GetBoard()->GetDesignSettings().m_EdgeSegmentWidth );
|
||||
target->SetWidth( GetDesignSettings().m_EdgeSegmentWidth );
|
||||
target->SetSize( MireDefaultSize );
|
||||
target->SetPosition( m_canvas->GetScreen()->GetCrossHairPosition() );
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* @brief Definition of class FOOTPRINT_EDIT_FRAME.
|
||||
*/
|
||||
|
||||
#ifndef _MODULE_EDITOR_FRAME_H_
|
||||
#define _MODULE_EDITOR_FRAME_H_
|
||||
#ifndef MODULE_EDITOR_FRAME_H_
|
||||
#define MODULE_EDITOR_FRAME_H_
|
||||
|
||||
|
||||
class FOOTPRINT_EDIT_FRAME : public PCB_BASE_FRAME
|
||||
|
@ -13,13 +13,16 @@ public:
|
|||
MODULE* CurrentModule;
|
||||
|
||||
public:
|
||||
FOOTPRINT_EDIT_FRAME( wxWindow* father,
|
||||
FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent,
|
||||
const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
||||
|
||||
~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 OnCloseWindow( wxCloseEvent& Event );
|
||||
|
@ -199,6 +202,8 @@ public:
|
|||
private:
|
||||
static wxString m_CurrentLib;
|
||||
|
||||
static BOARD* s_Pcb; ///< retain board accross invocations of module editor
|
||||
|
||||
/**
|
||||
* Function GetComponentFromUndoList
|
||||
* performs an undo operation on the last edition:
|
||||
|
@ -328,10 +333,10 @@ public:
|
|||
*/
|
||||
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 );
|
||||
|
||||
/* 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 );
|
||||
|
||||
/**
|
||||
|
@ -355,4 +360,4 @@ public:
|
|||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // #define _MODULE_EDITOR_FRAME_H_
|
||||
#endif // MODULE_EDITOR_FRAME_H_
|
||||
|
|
|
@ -49,11 +49,9 @@
|
|||
|
||||
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;
|
||||
|
||||
BOARD* FOOTPRINT_EDIT_FRAME::s_Pcb;
|
||||
|
||||
BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
||||
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 )
|
|||
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 wxPoint& pos,
|
||||
const wxSize& size,
|
||||
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_showBorderAndTitleBlock = false; // true to show the frame references
|
||||
|
@ -154,16 +152,21 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
|
|||
|
||||
UpdateTitle();
|
||||
|
||||
if( g_ModuleEditor_Pcb == NULL )
|
||||
g_ModuleEditor_Pcb = new BOARD();
|
||||
if( !s_Pcb )
|
||||
s_Pcb = new BOARD();
|
||||
|
||||
SetBoard( g_ModuleEditor_Pcb );
|
||||
SetBoard( s_Pcb );
|
||||
|
||||
if( s_screenModule == NULL )
|
||||
s_screenModule = new PCB_SCREEN( GetPageSettings().GetSizeIU() );
|
||||
|
||||
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 );
|
||||
LoadSettings();
|
||||
|
||||
|
@ -215,16 +218,42 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
|
|||
|
||||
FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME()
|
||||
{
|
||||
/* g_ModuleEditor_Pcb and its corresponding PCB_SCREEN are not deleted
|
||||
* here, because if we reopen the Footprint editor, we expect to find
|
||||
* the last edited item
|
||||
*/
|
||||
SetScreen( NULL ); /* Do not delete (by the destructor of EDA_DRAW_FRAME) the
|
||||
* PCB_SCREEN handling g_ModuleEditor_Pcb
|
||||
*/
|
||||
// When user reopens the Footprint editor, user would like to find the last edited item.
|
||||
// Do not delete PCB_SCREEN (by the destructor of EDA_DRAW_FRAME)
|
||||
SetScreen( NULL );
|
||||
|
||||
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) GetParent();
|
||||
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 )
|
|||
int copperlayercnt = GetBoard()->GetCopperLayerCount( );
|
||||
int currLayer = getActiveLayer();
|
||||
|
||||
if( !GetBoard()->GetDesignSettings().m_MicroViasAllowed )
|
||||
if( !GetDesignSettings().m_MicroViasAllowed )
|
||||
return false; // Obvious..
|
||||
|
||||
if( copperlayercnt < 4 )
|
||||
|
|
|
@ -127,7 +127,7 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
|
|||
change = true;
|
||||
}
|
||||
|
||||
int via_type = GetBoard()->GetDesignSettings().m_CurrentViaType;
|
||||
int via_type = GetDesignSettings().m_CurrentViaType;
|
||||
via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type);
|
||||
|
||||
if( previous_via_color != via_color )
|
||||
|
|
|
@ -60,7 +60,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
|
|||
{
|
||||
bool check = ( ( ( ID_POPUP_PCB_SELECT_WIDTH1 +
|
||||
(int) GetBoard()->m_TrackWidthSelector ) == aEvent.GetId() ) &&
|
||||
!GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth );
|
||||
!GetDesignSettings().m_UseConnectedTrackWidth );
|
||||
aEvent.Check( check );
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( 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 )
|
|||
{
|
||||
bool check = ( ( ( ID_POPUP_PCB_SELECT_VIASIZE1 +
|
||||
(int) GetBoard()->m_ViaSizeSelector ) == aEvent.GetId() ) &&
|
||||
!GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth );
|
||||
!GetDesignSettings().m_UseConnectedTrackWidth );
|
||||
|
||||
aEvent.Check( check );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue