All: fix a minor bur annoying issue: incorrect cursor shape after a block command (mainly when a tool is selected)
This commit is contained in:
parent
dc24d6fcb2
commit
155a9dbe19
|
@ -305,5 +305,5 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
|||
|
||||
screen->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||
Panel->GetParent()->DisplayToolMsg( wxEmptyString );
|
||||
Panel->SetCursor( Panel->GetDefaultCursor() );
|
||||
Panel->SetCursor( Panel->GetCurrentCursor() );
|
||||
}
|
||||
|
|
|
@ -440,7 +440,7 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
|
|||
|
||||
// Change DrawPanel cursor if requested.
|
||||
if( DrawPanel && aCursor >= 0 )
|
||||
DrawPanel->SetCursor( aCursor );
|
||||
DrawPanel->SetCurrentCursor( aCursor );
|
||||
|
||||
DisplayToolMsg( aToolMsg );
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************/
|
||||
/* drawpanel.cpp */
|
||||
/*****************/
|
||||
/**
|
||||
* @file drawpanel.cpp
|
||||
*/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "appl_wxstruct.h"
|
||||
|
@ -84,10 +84,10 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
|
|||
m_Block_Enable = false;
|
||||
|
||||
#ifdef __WXMAC__
|
||||
m_defaultCursor = m_cursor = wxCURSOR_CROSS;
|
||||
m_defaultCursor = m_currentCursor = wxCURSOR_CROSS;
|
||||
m_showCrossHair = false;
|
||||
#else
|
||||
m_defaultCursor = m_cursor = wxCURSOR_ARROW;
|
||||
m_defaultCursor = m_currentCursor = wxCURSOR_ARROW;
|
||||
m_showCrossHair = true;
|
||||
#endif
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
else
|
||||
{
|
||||
m_AutoPAN_Request = true;
|
||||
SetCursor( m_cursor = wxCURSOR_SIZING );
|
||||
SetCursor( wxCURSOR_SIZING );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1045,20 +1045,19 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
m_AutoPAN_Request = false;
|
||||
}
|
||||
|
||||
SetCursor( m_cursor = m_defaultCursor );
|
||||
}
|
||||
SetCursor( m_currentCursor );
|
||||
}
|
||||
else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END )
|
||||
{
|
||||
m_AutoPAN_Request = false;
|
||||
GetParent()->HandleBlockEnd( &DC );
|
||||
SetCursor( m_cursor = m_defaultCursor );
|
||||
|
||||
SetCursor( m_currentCursor );
|
||||
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
|
||||
{
|
||||
m_AutoPAN_Request = true;
|
||||
SetCursor( wxCURSOR_HAND );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1106,9 +1105,9 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
|||
m_AbortRequest = true;
|
||||
|
||||
if( IsMouseCaptured() )
|
||||
EndMouseCapture( -1, m_defaultCursor );
|
||||
EndMouseCapture( );
|
||||
else
|
||||
EndMouseCapture( ID_NO_TOOL_SELECTED, m_cursor, wxEmptyString );
|
||||
EndMouseCapture( ID_NO_TOOL_SELECTED, m_defaultCursor, wxEmptyString );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
|||
}
|
||||
|
||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||
SetToolID( GetToolId(), DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||
SetToolID( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString );
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
|||
block->m_Command = BLOCK_IDLE;
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||
SetToolID( GetToolId(), DrawPanel->GetDefaultCursor(), wxEmptyString );
|
||||
SetToolID( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString );
|
||||
}
|
||||
|
||||
if( zoom_command )
|
||||
|
|
|
@ -136,7 +136,8 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
|
|||
break;
|
||||
}
|
||||
|
||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||
DrawPanel->EndMouseCapture( );
|
||||
DrawPanel->SetCursor( DrawPanel->GetCurrentCursor() );
|
||||
GetScreen()->SetModify();
|
||||
GetScreen()->ClearBlockCommand();
|
||||
|
||||
|
@ -211,7 +212,8 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
|
|||
if( ! nextcmd )
|
||||
{
|
||||
GetScreen()->ClearBlockCommand();
|
||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||
DrawPanel->EndMouseCapture( );
|
||||
DrawPanel->SetCursor( DrawPanel->GetCurrentCursor() );
|
||||
DisplayToolMsg( wxEmptyString );
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ typedef void ( *END_MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC
|
|||
class EDA_DRAW_PANEL : public wxScrolledWindow
|
||||
{
|
||||
private:
|
||||
int m_cursor; ///< Current mouse cursor shape id.
|
||||
int m_currentCursor; ///< Current mouse cursor shape id.
|
||||
int m_defaultCursor; ///< The default mouse cursor shape id.
|
||||
bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
|
||||
int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
|
||||
|
@ -82,6 +82,7 @@ public:
|
|||
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
|
||||
|
||||
/**
|
||||
* Function DrawBackGround
|
||||
* @param DC = current Device Context
|
||||
|
@ -300,8 +301,28 @@ public:
|
|||
|
||||
inline bool IsMouseCaptured() const { return m_mouseCaptureCallback != NULL; }
|
||||
|
||||
/**
|
||||
* Function SetCurrentCursor
|
||||
* Set the current cursor shape for drawpanel
|
||||
*/
|
||||
void SetCurrentCursor( int aCursor )
|
||||
{
|
||||
m_currentCursor = aCursor;
|
||||
SetCursor( m_currentCursor );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetDefaultCursor
|
||||
* return the default cursor shape
|
||||
*/
|
||||
int GetDefaultCursor() const { return m_defaultCursor; }
|
||||
|
||||
/**
|
||||
* Function GetCurrentCursor
|
||||
* return the current cursor shape, depending on the current selected tool
|
||||
*/
|
||||
int GetCurrentCursor() const { return m_currentCursor; }
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
|
|
@ -59,7 +59,6 @@ int GetApxDist( int, int, int, int );
|
|||
int CalcDist( int, int, int ,int );
|
||||
|
||||
/* BOARD.CPP */
|
||||
bool ComputeMatriceSize( BOARD * aPcb, int aGridRouting );
|
||||
int Build_Work( BOARD * Pcb );
|
||||
void PlaceCells( BOARD * Pcb, int net_code, int flag = 0 );
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ static const float OrientPenality[11] =
|
|||
|
||||
static wxPoint CurrPosition; // Current position of the current module
|
||||
// placement
|
||||
static bool AutoPlaceShowAll = TRUE;
|
||||
static bool AutoPlaceShowAll = true;
|
||||
|
||||
float MinCout;
|
||||
|
||||
|
@ -75,13 +75,13 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
|||
int NbModules = 0;
|
||||
int NbTotalModules = 0;
|
||||
float Pas;
|
||||
int lay_tmp_TOP, lay_tmp_BOTTOM, OldPasRoute;
|
||||
int lay_tmp_TOP, lay_tmp_BOTTOM;
|
||||
|
||||
if( GetBoard()->m_Modules == NULL )
|
||||
return;
|
||||
|
||||
DrawPanel->m_AbortRequest = FALSE;
|
||||
DrawPanel->m_AbortEnable = TRUE;
|
||||
DrawPanel->m_AbortRequest = false;
|
||||
DrawPanel->m_AbortEnable = true;
|
||||
|
||||
switch( place_mode )
|
||||
{
|
||||
|
@ -109,13 +109,12 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
|||
memopos = CurrPosition;
|
||||
lay_tmp_BOTTOM = Route_Layer_BOTTOM;
|
||||
lay_tmp_TOP = Route_Layer_TOP;
|
||||
OldPasRoute = g_GridRoutingSize;
|
||||
|
||||
g_GridRoutingSize = (int) GetScreen()->GetGridSize().x;
|
||||
Board.m_GridRouting = (int) GetScreen()->GetGridSize().x;
|
||||
|
||||
// Ensure g_GridRoutingSize has a reasonnable value:
|
||||
if( g_GridRoutingSize < 10 )
|
||||
g_GridRoutingSize = 10; // Min value = 1/1000 inch
|
||||
// Ensure Board.m_GridRouting has a reasonnable value:
|
||||
if( Board.m_GridRouting < 10 )
|
||||
Board.m_GridRouting = 10; // Min value = 1/1000 inch
|
||||
|
||||
/* Compute module parmeters used in auto place */
|
||||
Module = GetBoard()->m_Modules;
|
||||
|
@ -204,7 +203,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
|||
if( ii != 0 )
|
||||
{
|
||||
int Angle_Rot_Module = 1800;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, FALSE );
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
Module->SetRectangleExinscrit();
|
||||
error = RecherchePlacementModule( Module, DC );
|
||||
MinCout *= OrientPenality[ii];
|
||||
|
@ -216,7 +215,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
|||
else
|
||||
{
|
||||
Angle_Rot_Module = -1800;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, FALSE );
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
}
|
||||
if( error == ESC )
|
||||
goto end_of_tst;
|
||||
|
@ -227,7 +226,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
|||
if( ii != 0 )
|
||||
{
|
||||
int Angle_Rot_Module = 900;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, FALSE );
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
error = RecherchePlacementModule( Module, DC );
|
||||
MinCout *= OrientPenality[ii];
|
||||
if( BestScore > MinCout ) /* This orientation is best. */
|
||||
|
@ -238,7 +237,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
|||
else
|
||||
{
|
||||
Angle_Rot_Module = -900;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, FALSE );
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
}
|
||||
if( error == ESC )
|
||||
goto end_of_tst;
|
||||
|
@ -249,7 +248,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
|||
if( ii != 0 )
|
||||
{
|
||||
int Angle_Rot_Module = 2700;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, FALSE );
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
error = RecherchePlacementModule( Module, DC );
|
||||
MinCout *= OrientPenality[ii];
|
||||
if( BestScore > MinCout ) /* This orientation is best. */
|
||||
|
@ -260,7 +259,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
|||
else
|
||||
{
|
||||
Angle_Rot_Module = -2700;
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, FALSE );
|
||||
Rotate_Module( DC, Module, Angle_Rot_Module, false );
|
||||
}
|
||||
if( error == ESC )
|
||||
goto end_of_tst;
|
||||
|
@ -291,7 +290,6 @@ end_of_tst:
|
|||
|
||||
Route_Layer_TOP = lay_tmp_TOP;
|
||||
Route_Layer_BOTTOM = lay_tmp_BOTTOM;
|
||||
g_GridRoutingSize = OldPasRoute;
|
||||
|
||||
Module = GetBoard()->m_Modules;
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
|
@ -301,9 +299,9 @@ end_of_tst:
|
|||
|
||||
GetBoard()->m_Status_Pcb = 0;
|
||||
Compile_Ratsnest( DC, true );
|
||||
DrawPanel->ReDraw( DC, TRUE );
|
||||
DrawPanel->ReDraw( DC, true );
|
||||
|
||||
DrawPanel->m_AbortEnable = FALSE;
|
||||
DrawPanel->m_AbortEnable = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -316,12 +314,12 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
|
|||
GRSetDrawMode( DC, GR_COPY );
|
||||
for( ii = 0; ii < Board.m_Nrows; ii++ )
|
||||
{
|
||||
oy = GetBoard()->m_BoundaryBox.m_Pos.y + ( ii * g_GridRoutingSize );
|
||||
oy = GetBoard()->m_BoundaryBox.m_Pos.y + ( ii * Board.m_GridRouting );
|
||||
|
||||
for( jj = 0; jj < Board.m_Ncols; jj++ )
|
||||
{
|
||||
ox = GetBoard()->m_BoundaryBox.m_Pos.x +
|
||||
(jj * g_GridRoutingSize);
|
||||
(jj * Board.m_GridRouting);
|
||||
color = BLACK;
|
||||
|
||||
top_state = GetCell( ii, jj, TOP );
|
||||
|
@ -386,19 +384,19 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
|
|||
|
||||
/* The boundary box must have its start point on placing grid: */
|
||||
GetBoard()->m_BoundaryBox.m_Pos.x -= GetBoard()->m_BoundaryBox.m_Pos.x %
|
||||
g_GridRoutingSize;
|
||||
Board.m_GridRouting;
|
||||
GetBoard()->m_BoundaryBox.m_Pos.y -= GetBoard()->m_BoundaryBox.m_Pos.y %
|
||||
g_GridRoutingSize;
|
||||
Board.m_GridRouting;
|
||||
/* The boundary box must have its end point on placing grid: */
|
||||
wxPoint end = GetBoard()->m_BoundaryBox.GetEnd();
|
||||
end.x -= end.x % g_GridRoutingSize;
|
||||
end.x += g_GridRoutingSize;
|
||||
end.y -= end.y % g_GridRoutingSize;
|
||||
end.y += g_GridRoutingSize;
|
||||
end.x -= end.x % Board.m_GridRouting;
|
||||
end.x += Board.m_GridRouting;
|
||||
end.y -= end.y % Board.m_GridRouting;
|
||||
end.y += Board.m_GridRouting;
|
||||
GetBoard()->m_BoundaryBox.SetEnd( end );
|
||||
|
||||
Nrows = GetBoard()->m_BoundaryBox.GetHeight() / g_GridRoutingSize;
|
||||
Ncols = GetBoard()->m_BoundaryBox.GetWidth() / g_GridRoutingSize;
|
||||
Nrows = GetBoard()->m_BoundaryBox.GetHeight() / Board.m_GridRouting;
|
||||
Ncols = GetBoard()->m_BoundaryBox.GetWidth() / Board.m_GridRouting;
|
||||
/* get a small margin for memory allocation: */
|
||||
Ncols += 2; Nrows += 2;
|
||||
NbCells = Ncols * Nrows;
|
||||
|
@ -435,7 +433,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
|
|||
|
||||
TmpSegm.SetLayer( -1 );
|
||||
TmpSegm.SetNet( -1 );
|
||||
TmpSegm.m_Width = g_GridRoutingSize / 2;
|
||||
TmpSegm.m_Width = Board.m_GridRouting / 2;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
{
|
||||
DRAWSEGMENT* DrawSegm;
|
||||
|
@ -453,7 +451,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
|
|||
TmpSegm.m_Param = DrawSegm->m_Angle;
|
||||
|
||||
TraceSegmentPcb( GetBoard(), &TmpSegm, HOLE | CELL_is_EDGE,
|
||||
g_GridRoutingSize, WRITE_CELL );
|
||||
Board.m_GridRouting, WRITE_CELL );
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE:
|
||||
|
@ -490,7 +488,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
|
|||
void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
|
||||
{
|
||||
int ox, oy, fx, fy, Penalite;
|
||||
int marge = g_GridRoutingSize / 2;
|
||||
int marge = Board.m_GridRouting / 2;
|
||||
int masque_layer;
|
||||
D_PAD* Pad;
|
||||
|
||||
|
@ -541,7 +539,7 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
|
|||
}
|
||||
|
||||
/* Trace clearance. */
|
||||
marge = (g_GridRoutingSize * Module->m_PadNum ) / GAIN;
|
||||
marge = (Board.m_GridRouting * Module->m_PadNum ) / GAIN;
|
||||
Penalite = PENALITE;
|
||||
TracePenaliteRectangle( GetBoard(), ox, oy, fx, fy, marge, Penalite,
|
||||
masque_layer );
|
||||
|
@ -582,8 +580,8 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
|||
CurrPosition.x = GetBoard()->m_BoundaryBox.m_Pos.x - ox;
|
||||
CurrPosition.y = GetBoard()->m_BoundaryBox.m_Pos.y - oy;
|
||||
/* Module placement on grid. */
|
||||
CurrPosition.x -= CurrPosition.x % g_GridRoutingSize;
|
||||
CurrPosition.y -= CurrPosition.y % g_GridRoutingSize;
|
||||
CurrPosition.x -= CurrPosition.x % Board.m_GridRouting;
|
||||
CurrPosition.y -= CurrPosition.y % Board.m_GridRouting;
|
||||
|
||||
g_Offset_Module.x = cx - CurrPosition.x;
|
||||
g_Offset_Module.y = cy - CurrPosition.y;
|
||||
|
@ -593,7 +591,7 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
|||
* can become a component on opposite side if there is at least 1 patch
|
||||
* appearing on the other side.
|
||||
*/
|
||||
TstOtherSide = FALSE;
|
||||
TstOtherSide = false;
|
||||
if( Nb_Sides == TWO_SIDES )
|
||||
{
|
||||
D_PAD* Pad; int masque_otherlayer;
|
||||
|
@ -605,7 +603,7 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
|||
{
|
||||
if( ( Pad->m_Masque_Layer & masque_otherlayer ) == 0 )
|
||||
continue;
|
||||
TstOtherSide = TRUE;
|
||||
TstOtherSide = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -617,7 +615,7 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
|||
SetStatusText( wxT( "Score ??, pos ??" ) );
|
||||
|
||||
for( ; CurrPosition.x < GetBoard()->m_BoundaryBox.GetRight() - fx;
|
||||
CurrPosition.x += g_GridRoutingSize )
|
||||
CurrPosition.x += Board.m_GridRouting )
|
||||
{
|
||||
wxYield();
|
||||
if( DrawPanel->m_AbortRequest )
|
||||
|
@ -625,7 +623,7 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
|||
if( IsOK( this, _( "Ok to abort?" ) ) )
|
||||
return ESC;
|
||||
else
|
||||
DrawPanel->m_AbortRequest = FALSE;
|
||||
DrawPanel->m_AbortRequest = false;
|
||||
}
|
||||
|
||||
cx = Module->m_Pos.x; cy = Module->m_Pos.y;
|
||||
|
@ -637,12 +635,12 @@ int PCB_EDIT_FRAME::RecherchePlacementModule( MODULE* Module, wxDC* DC )
|
|||
g_Offset_Module.x = cx - CurrPosition.x;
|
||||
CurrPosition.y = GetBoard()->m_BoundaryBox.m_Pos.y - oy;
|
||||
/* Placement on grid. */
|
||||
CurrPosition.y -= CurrPosition.y % g_GridRoutingSize;
|
||||
CurrPosition.y -= CurrPosition.y % Board.m_GridRouting;
|
||||
|
||||
DrawModuleOutlines( DrawPanel, DC, Module );
|
||||
|
||||
for( ; CurrPosition.y < GetBoard()->m_BoundaryBox.GetBottom() - fy;
|
||||
CurrPosition.y += g_GridRoutingSize )
|
||||
CurrPosition.y += Board.m_GridRouting )
|
||||
{
|
||||
/* Erase traces. */
|
||||
DrawModuleOutlines( DrawPanel, DC, Module );
|
||||
|
@ -714,13 +712,13 @@ int TstRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side )
|
|||
ux1 -= Pcb->m_BoundaryBox.m_Pos.x;
|
||||
uy1 -= Pcb->m_BoundaryBox.m_Pos.y;
|
||||
|
||||
row_max = uy1 / g_GridRoutingSize;
|
||||
col_max = ux1 / g_GridRoutingSize;
|
||||
row_min = uy0 / g_GridRoutingSize;
|
||||
if( uy0 > row_min * g_GridRoutingSize )
|
||||
row_max = uy1 / Board.m_GridRouting;
|
||||
col_max = ux1 / Board.m_GridRouting;
|
||||
row_min = uy0 / Board.m_GridRouting;
|
||||
if( uy0 > row_min * Board.m_GridRouting )
|
||||
row_min++;
|
||||
col_min = ux0 / g_GridRoutingSize;
|
||||
if( ux0 > col_min * g_GridRoutingSize )
|
||||
col_min = ux0 / Board.m_GridRouting;
|
||||
if( ux0 > col_min * Board.m_GridRouting )
|
||||
col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
|
@ -764,13 +762,13 @@ unsigned int CalculePenaliteRectangle( BOARD* Pcb, int ux0, int uy0,
|
|||
ux1 -= Pcb->m_BoundaryBox.m_Pos.x;
|
||||
uy1 -= Pcb->m_BoundaryBox.m_Pos.y;
|
||||
|
||||
row_max = uy1 / g_GridRoutingSize;
|
||||
col_max = ux1 / g_GridRoutingSize;
|
||||
row_min = uy0 / g_GridRoutingSize;
|
||||
if( uy0 > row_min * g_GridRoutingSize )
|
||||
row_max = uy1 / Board.m_GridRouting;
|
||||
col_max = ux1 / Board.m_GridRouting;
|
||||
row_min = uy0 / Board.m_GridRouting;
|
||||
if( uy0 > row_min * Board.m_GridRouting )
|
||||
row_min++;
|
||||
col_min = ux0 / g_GridRoutingSize;
|
||||
if( ux0 > col_min * g_GridRoutingSize )
|
||||
col_min = ux0 / Board.m_GridRouting;
|
||||
if( ux0 > col_min * Board.m_GridRouting )
|
||||
col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
|
@ -826,7 +824,7 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide )
|
|||
return error;
|
||||
}
|
||||
|
||||
marge = ( g_GridRoutingSize * Module->m_PadNum ) / GAIN;
|
||||
marge = ( Board.m_GridRouting * Module->m_PadNum ) / GAIN;
|
||||
|
||||
Penalite = CalculePenaliteRectangle( Pcb, ox - marge, oy - marge,
|
||||
fx + marge, fy + marge, side );
|
||||
|
@ -941,15 +939,17 @@ static void TracePenaliteRectangle( BOARD* Pcb,
|
|||
ux0 -= marge; ux1 += marge;
|
||||
uy0 -= marge; uy1 += marge;
|
||||
|
||||
pmarge = marge / g_GridRoutingSize; if( pmarge < 1 )
|
||||
pmarge = marge / Board.m_GridRouting; if( pmarge < 1 )
|
||||
pmarge = 1;
|
||||
|
||||
/* Calculate the coordinate limits of the rectangle. */
|
||||
row_max = uy1 / g_GridRoutingSize;
|
||||
col_max = ux1 / g_GridRoutingSize;
|
||||
row_min = uy0 / g_GridRoutingSize; if( uy0 > row_min * g_GridRoutingSize )
|
||||
row_max = uy1 / Board.m_GridRouting;
|
||||
col_max = ux1 / Board.m_GridRouting;
|
||||
row_min = uy0 / Board.m_GridRouting;
|
||||
if( uy0 > row_min * Board.m_GridRouting )
|
||||
row_min++;
|
||||
col_min = ux0 / g_GridRoutingSize; if( ux0 > col_min * g_GridRoutingSize )
|
||||
col_min = ux0 / Board.m_GridRouting;
|
||||
if( ux0 > col_min * Board.m_GridRouting )
|
||||
col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
|
|
|
@ -131,14 +131,14 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
|
|||
start = time( NULL );
|
||||
|
||||
/* Calculation of no fixed routing to 5 mils and more. */
|
||||
g_GridRoutingSize = (int)GetScreen()->GetGridSize().x;
|
||||
if( g_GridRoutingSize < 50 )
|
||||
g_GridRoutingSize = 50;
|
||||
E_scale = g_GridRoutingSize / 50; if( E_scale < 1 )
|
||||
Board.m_GridRouting = (int)GetScreen()->GetGridSize().x;
|
||||
if( Board.m_GridRouting < 50 )
|
||||
Board.m_GridRouting = 50;
|
||||
E_scale = Board.m_GridRouting / 50; if( E_scale < 1 )
|
||||
E_scale = 1;
|
||||
|
||||
/* Calculated ncol and nrow, matrix size for routing. */
|
||||
ComputeMatriceSize( GetBoard(), g_GridRoutingSize );
|
||||
Board.ComputeMatrixSize( GetBoard() );
|
||||
|
||||
MsgPanel->EraseMsgBox();
|
||||
|
||||
|
|
|
@ -48,11 +48,8 @@ extern int ClosNodes; /* total number of nodes closed */
|
|||
extern int MoveNodes; /* total number of nodes moved */
|
||||
extern int MaxNodes; /* maximum number of nodes opened at one time */
|
||||
|
||||
/* Grid size for automatic routing */
|
||||
extern int g_GridRoutingSize;
|
||||
|
||||
/* Structures useful to the generation of board as bitmap. */
|
||||
|
||||
typedef char MATRIX_CELL;
|
||||
typedef int DIST_CELL;
|
||||
typedef char DIR_CELL;
|
||||
|
@ -68,12 +65,14 @@ public:
|
|||
bool m_InitBoardDone;
|
||||
int m_Layers;
|
||||
int m_GridRouting; // Size of grid for autoplace/autoroute
|
||||
EDA_Rect m_BrdBox; // Actual board bouding box
|
||||
int m_Nrows, m_Ncols;
|
||||
int m_MemSize;
|
||||
|
||||
public:
|
||||
MATRIX_ROUTING_HEAD();
|
||||
~MATRIX_ROUTING_HEAD();
|
||||
bool ComputeMatrixSize( BOARD* aPcb );
|
||||
int InitBoard();
|
||||
void UnInitBoard();
|
||||
};
|
||||
|
|
|
@ -94,7 +94,6 @@ static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title
|
|||
parent->GetScreen()->SetCrossHairPosition( oldpos );
|
||||
parent->DrawPanel->MoveCursorToCrossHair();
|
||||
parent->DrawPanel->m_IgnoreMouseEvents = false;
|
||||
parent->DrawPanel->SetCursor( parent->DrawPanel->GetDefaultCursor() );
|
||||
|
||||
return nocmd ? false : true;
|
||||
}
|
||||
|
@ -253,7 +252,7 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
|||
}
|
||||
|
||||
DisplayToolMsg( wxEmptyString );
|
||||
DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() );
|
||||
DrawPanel->SetCursor( DrawPanel->GetCurrentCursor() );
|
||||
}
|
||||
|
||||
|
||||
|
|
208
pcbnew/board.cpp
208
pcbnew/board.cpp
|
@ -11,38 +11,41 @@
|
|||
* Calculates nrows and ncols, dimensions of the matrix representation of BOARD
|
||||
* for routing and automatic calculation of area.
|
||||
*/
|
||||
bool ComputeMatriceSize( BOARD * aPcb, int aGridRouting )
|
||||
bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb )
|
||||
{
|
||||
aPcb->ComputeBoundingBox();
|
||||
|
||||
/* The boundary box must have its start point on routing grid: */
|
||||
aPcb->m_BoundaryBox.m_Pos.x -= aPcb->m_BoundaryBox.m_Pos.x % aGridRouting;
|
||||
aPcb->m_BoundaryBox.m_Pos.y -= aPcb->m_BoundaryBox.m_Pos.y % aGridRouting;
|
||||
aPcb->m_BoundaryBox.m_Pos.x -= aPcb->m_BoundaryBox.m_Pos.x % m_GridRouting;
|
||||
aPcb->m_BoundaryBox.m_Pos.y -= aPcb->m_BoundaryBox.m_Pos.y % m_GridRouting;
|
||||
m_BrdBox = aPcb->m_BoundaryBox;
|
||||
/* The boundary box must have its end point on routing grid: */
|
||||
wxPoint end = aPcb->m_BoundaryBox.GetEnd();
|
||||
end.x -= end.x % aGridRouting;
|
||||
end.x += aGridRouting;
|
||||
end.y -= end.y % aGridRouting;
|
||||
end.y += aGridRouting;
|
||||
wxPoint end = m_BrdBox.GetEnd();
|
||||
end.x -= end.x % m_GridRouting;
|
||||
end.x += m_GridRouting;
|
||||
end.y -= end.y % m_GridRouting;
|
||||
end.y += m_GridRouting;
|
||||
aPcb->m_BoundaryBox.SetEnd( end );
|
||||
m_BrdBox.SetEnd(end);
|
||||
|
||||
m_Nrows = Nrows = m_BrdBox.m_Size.y / m_GridRouting;
|
||||
m_Ncols = Ncols = m_BrdBox.m_Size.x / m_GridRouting;
|
||||
|
||||
Nrows = aPcb->m_BoundaryBox.m_Size.y / aGridRouting;
|
||||
Ncols = aPcb->m_BoundaryBox.m_Size.x / aGridRouting;
|
||||
/* get a small margin for memory allocation: */
|
||||
Ncols += 2; Nrows += 2;
|
||||
Ncols += 1; Nrows += 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* class MATRIX_ROUTING_HEAD
|
||||
*/
|
||||
*/
|
||||
MATRIX_ROUTING_HEAD::MATRIX_ROUTING_HEAD()
|
||||
{
|
||||
m_BoardSide[0] = m_BoardSide[1] = NULL;
|
||||
m_DistSide[0] = m_DistSide[1] = NULL;
|
||||
m_DirSide[0] = m_DirSide[1] = NULL;
|
||||
m_InitBoardDone = FALSE;
|
||||
m_InitBoardDone = false;
|
||||
m_Layers = MAX_SIDES_COUNT;
|
||||
m_Nrows = m_Ncols = 0;
|
||||
m_MemSize = 0;
|
||||
|
@ -102,23 +105,23 @@ void MATRIX_ROUTING_HEAD::UnInitBoard()
|
|||
{
|
||||
int ii;
|
||||
|
||||
m_InitBoardDone = FALSE;
|
||||
m_InitBoardDone = false;
|
||||
|
||||
for( ii = 0; ii < 2; ii++ )
|
||||
for( ii = 0; ii < MAX_SIDES_COUNT; ii++ )
|
||||
{
|
||||
/***** de-allocate Dir (chars) *****/
|
||||
/***** de-allocate Dir matrix *****/
|
||||
if( m_DirSide[ii] )
|
||||
{
|
||||
MyFree( m_DirSide[ii] ); m_DirSide[ii] = NULL;
|
||||
}
|
||||
|
||||
/***** de-allocate Distances *****/
|
||||
/***** de-allocate Distances matrix *****/
|
||||
if( m_DistSide[ii] )
|
||||
{
|
||||
MyFree( m_DistSide[ii] ); m_DistSide[ii] = NULL;
|
||||
}
|
||||
|
||||
/**** de-allocate Board *****/
|
||||
/**** de-allocate cells matrix *****/
|
||||
if( m_BoardSide[ii] )
|
||||
{
|
||||
MyFree( m_BoardSide[ii] ); m_BoardSide[ii] = NULL;
|
||||
|
@ -141,27 +144,24 @@ void MATRIX_ROUTING_HEAD::UnInitBoard()
|
|||
*/
|
||||
void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
{
|
||||
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
|
||||
int marge, via_marge;
|
||||
int masque_layer;
|
||||
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
|
||||
int marge, via_marge;
|
||||
int masque_layer;
|
||||
|
||||
// use the default NETCLASS?
|
||||
NETCLASS* nc = aPcb->m_NetClasses.GetDefault();
|
||||
NETCLASS* nc = aPcb->m_NetClasses.GetDefault();
|
||||
|
||||
int trackWidth = nc->GetTrackWidth();
|
||||
int clearance = nc->GetClearance();
|
||||
int viaSize = nc->GetViaDiameter();
|
||||
int trackWidth = nc->GetTrackWidth();
|
||||
int clearance = nc->GetClearance();
|
||||
int viaSize = nc->GetViaDiameter();
|
||||
|
||||
marge = clearance + (trackWidth / 2);
|
||||
via_marge = clearance + (viaSize / 2);
|
||||
|
||||
//////////////////////////
|
||||
// Place PADS on board. //
|
||||
//////////////////////////
|
||||
|
||||
for( unsigned i=0; i < aPcb->GetPadsCount(); ++i )
|
||||
// Place PADS on matrix routing:
|
||||
for( unsigned i = 0; i < aPcb->GetPadsCount(); ++i )
|
||||
{
|
||||
D_PAD* pad = aPcb->m_NetInfo->GetPad(i);
|
||||
D_PAD* pad = aPcb->m_NetInfo->GetPad( i );
|
||||
|
||||
if( net_code != pad->GetNet() || (flag & FORCE_PADS) )
|
||||
{
|
||||
|
@ -170,38 +170,35 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
Place_1_Pad_Board( aPcb, pad, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
// Placing the elements of modules on PCB //
|
||||
////////////////////////////////////////////
|
||||
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
||||
// Place outlines of modules on matrix routing, if they are on a copper layer
|
||||
// or on the edge layer
|
||||
TRACK tmpSegm( NULL ); // A dummy track used to create segments.
|
||||
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
||||
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case TYPE_EDGE_MODULE:
|
||||
{
|
||||
EDGE_MODULE* edge = (EDGE_MODULE*) item;
|
||||
{
|
||||
EDGE_MODULE* edge = (EDGE_MODULE*) item;
|
||||
|
||||
TRACK* TmpSegm = new TRACK( NULL );
|
||||
tmpSegm.SetLayer( edge->GetLayer() );
|
||||
if( tmpSegm.GetLayer() == EDGE_N )
|
||||
tmpSegm.SetLayer( -1 );
|
||||
|
||||
TmpSegm->SetLayer( edge->GetLayer() );
|
||||
if( TmpSegm->GetLayer() == EDGE_N )
|
||||
TmpSegm->SetLayer( -1 );
|
||||
tmpSegm.m_Start = edge->m_Start;
|
||||
tmpSegm.m_End = edge->m_End;
|
||||
tmpSegm.m_Shape = edge->m_Shape;
|
||||
tmpSegm.m_Width = edge->m_Width;
|
||||
tmpSegm.m_Param = edge->m_Angle;
|
||||
tmpSegm.SetNet( -1 );
|
||||
|
||||
TmpSegm->m_Start = edge->m_Start;
|
||||
TmpSegm->m_End = edge->m_End;
|
||||
TmpSegm->m_Shape = edge->m_Shape;
|
||||
TmpSegm->m_Width = edge->m_Width;
|
||||
TmpSegm->m_Param = edge->m_Angle;
|
||||
TmpSegm->SetNet( -1 );
|
||||
|
||||
TraceSegmentPcb( aPcb, TmpSegm, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( aPcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,
|
||||
WRITE_OR_CELL );
|
||||
delete TmpSegm;
|
||||
}
|
||||
break;
|
||||
TraceSegmentPcb( aPcb, &tmpSegm, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( aPcb, &tmpSegm, VIA_IMPOSSIBLE, via_marge,
|
||||
WRITE_OR_CELL );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -209,53 +206,47 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
// Placement contours and segments on PCB //
|
||||
////////////////////////////////////////////
|
||||
// Place board outlines and texts on copper layers:
|
||||
for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case TYPE_DRAWSEGMENT:
|
||||
{
|
||||
DRAWSEGMENT* DrawSegm;
|
||||
|
||||
int type_cell = HOLE;
|
||||
DrawSegm = (DRAWSEGMENT*) item;
|
||||
tmpSegm.SetLayer( DrawSegm->GetLayer() );
|
||||
if( DrawSegm->GetLayer() == EDGE_N )
|
||||
{
|
||||
DRAWSEGMENT* DrawSegm;
|
||||
|
||||
int type_cell = HOLE;
|
||||
TRACK* TmpSegm = new TRACK( NULL );
|
||||
DrawSegm = (DRAWSEGMENT*) item;
|
||||
TmpSegm->SetLayer( DrawSegm->GetLayer() );
|
||||
if( DrawSegm->GetLayer() == EDGE_N )
|
||||
{
|
||||
TmpSegm->SetLayer( -1 );
|
||||
type_cell |= CELL_is_EDGE;
|
||||
}
|
||||
|
||||
TmpSegm->m_Start = DrawSegm->m_Start;
|
||||
TmpSegm->m_End = DrawSegm->m_End;
|
||||
TmpSegm->m_Shape = DrawSegm->m_Shape;
|
||||
TmpSegm->m_Width = DrawSegm->m_Width;
|
||||
TmpSegm->m_Param = DrawSegm->m_Angle;
|
||||
TmpSegm->SetNet( -1 );
|
||||
|
||||
TraceSegmentPcb( aPcb, TmpSegm, type_cell, marge, WRITE_CELL );
|
||||
|
||||
// TraceSegmentPcb(Pcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,WRITE_OR_CELL );
|
||||
delete TmpSegm;
|
||||
tmpSegm.SetLayer( -1 );
|
||||
type_cell |= CELL_is_EDGE;
|
||||
}
|
||||
break;
|
||||
|
||||
tmpSegm.m_Start = DrawSegm->m_Start;
|
||||
tmpSegm.m_End = DrawSegm->m_End;
|
||||
tmpSegm.m_Shape = DrawSegm->m_Shape;
|
||||
tmpSegm.m_Width = DrawSegm->m_Width;
|
||||
tmpSegm.m_Param = DrawSegm->m_Angle;
|
||||
tmpSegm.SetNet( -1 );
|
||||
|
||||
TraceSegmentPcb( aPcb, &tmpSegm, type_cell, marge, WRITE_CELL );
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE:
|
||||
{
|
||||
TEXTE_PCB* PtText;
|
||||
TEXTE_PCB* PtText;
|
||||
PtText = (TEXTE_PCB*) item;
|
||||
|
||||
if( PtText->GetLength() == 0 )
|
||||
break;
|
||||
|
||||
EDA_Rect textbox = PtText->GetTextBox(-1);
|
||||
EDA_Rect textbox = PtText->GetTextBox( -1 );
|
||||
ux0 = textbox.GetX(); uy0 = textbox.GetY();
|
||||
dx = textbox.GetWidth();
|
||||
dy = textbox.GetHeight();
|
||||
dx = textbox.GetWidth();
|
||||
dy = textbox.GetHeight();
|
||||
|
||||
/* Put bounding box (rectangle) on matrix */
|
||||
dx /= 2;
|
||||
|
@ -278,7 +269,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
(int) (PtText->m_Orient),
|
||||
masque_layer, VIA_IMPOSSIBLE, WRITE_OR_CELL );
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -286,7 +277,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
}
|
||||
|
||||
/* Put tracks and vias on matrix */
|
||||
for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
|
||||
for( TRACK* track = aPcb->m_Track; track; track = track->Next() )
|
||||
{
|
||||
if( net_code == track->GetNet() )
|
||||
continue;
|
||||
|
@ -294,37 +285,28 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
TraceSegmentPcb( aPcb, track, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( aPcb, track, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
}
|
||||
|
||||
// Put zone filling on matrix
|
||||
for( SEGZONE* zone = aPcb->m_Zone; zone; zone = zone->Next() )
|
||||
{
|
||||
if( net_code == zone->GetNet() )
|
||||
continue;
|
||||
|
||||
TraceSegmentPcb( aPcb, zone, HOLE, marge, WRITE_CELL );
|
||||
TraceSegmentPcb( aPcb, zone, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Build_Work( BOARD* Pcb )
|
||||
{
|
||||
RATSNEST_ITEM* pt_rats;
|
||||
D_PAD* pt_pad;
|
||||
int r1, r2, c1, c2, current_net_code;
|
||||
D_PAD* pt_pad;
|
||||
int r1, r2, c1, c2, current_net_code;
|
||||
RATSNEST_ITEM* pt_ch;
|
||||
int demi_pas = g_GridRoutingSize / 2;
|
||||
wxString msg;
|
||||
int demi_pas = Board.m_GridRouting / 2;
|
||||
wxString msg;
|
||||
|
||||
InitWork(); /* clear work list */
|
||||
Ntotal = 0;
|
||||
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
|
||||
{
|
||||
pt_rats = &Pcb->m_FullRatsnest[ii];
|
||||
|
||||
/* We consider her only ratsnets that are active ( obviously not yet routed)
|
||||
* and routables (that are not yet attempt to be routed and fail
|
||||
*/
|
||||
if( (pt_rats->m_Status & CH_ACTIF) == 0 )
|
||||
if( (pt_rats->m_Status & CH_ACTIF) == 0 )
|
||||
continue;
|
||||
if( pt_rats->m_Status & CH_UNROUTABLE )
|
||||
continue;
|
||||
|
@ -336,7 +318,7 @@ int Build_Work( BOARD* Pcb )
|
|||
pt_ch = pt_rats;
|
||||
|
||||
r1 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y
|
||||
+ demi_pas ) / g_GridRoutingSize;
|
||||
+ demi_pas ) / Board.m_GridRouting;
|
||||
if( r1 < 0 || r1 >= Nrows )
|
||||
{
|
||||
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1,
|
||||
|
@ -345,7 +327,7 @@ int Build_Work( BOARD* Pcb )
|
|||
return 0;
|
||||
}
|
||||
c1 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
|
||||
+ demi_pas ) / g_GridRoutingSize;
|
||||
+ demi_pas ) / Board.m_GridRouting;
|
||||
if( c1 < 0 || c1 >= Ncols )
|
||||
{
|
||||
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1,
|
||||
|
@ -357,7 +339,7 @@ int Build_Work( BOARD* Pcb )
|
|||
pt_pad = pt_rats->m_PadEnd;
|
||||
|
||||
r2 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y
|
||||
+ demi_pas ) / g_GridRoutingSize;
|
||||
+ demi_pas ) / Board.m_GridRouting;
|
||||
if( r2 < 0 || r2 >= Nrows )
|
||||
{
|
||||
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2,
|
||||
|
@ -366,7 +348,7 @@ int Build_Work( BOARD* Pcb )
|
|||
return 0;
|
||||
}
|
||||
c2 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
|
||||
+ demi_pas ) / g_GridRoutingSize;
|
||||
+ demi_pas ) / Board.m_GridRouting;
|
||||
if( c2 < 0 || c2 >= Ncols )
|
||||
{
|
||||
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2,
|
||||
|
@ -385,7 +367,7 @@ int Build_Work( BOARD* Pcb )
|
|||
|
||||
|
||||
/* return the value stored in a cell
|
||||
*/
|
||||
*/
|
||||
MATRIX_CELL GetCell( int aRow, int aCol, int aSide )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
@ -396,7 +378,7 @@ MATRIX_CELL GetCell( int aRow, int aCol, int aSide )
|
|||
|
||||
|
||||
/* basic cell operation : WRITE operation
|
||||
*/
|
||||
*/
|
||||
void SetCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
@ -407,7 +389,7 @@ void SetCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
|||
|
||||
|
||||
/* basic cell operation : OR operation
|
||||
*/
|
||||
*/
|
||||
void OrCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
@ -418,7 +400,7 @@ void OrCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
|||
|
||||
|
||||
/* basic cell operation : XOR operation
|
||||
*/
|
||||
*/
|
||||
void XorCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
@ -429,7 +411,7 @@ void XorCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
|||
|
||||
|
||||
/* basic cell operation : AND operation
|
||||
*/
|
||||
*/
|
||||
void AndCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
@ -440,7 +422,7 @@ void AndCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
|||
|
||||
|
||||
/* basic cell operation : ADD operation
|
||||
*/
|
||||
*/
|
||||
void AddCell( int aRow, int aCol, int aSide, MATRIX_CELL x )
|
||||
{
|
||||
MATRIX_CELL* p;
|
||||
|
|
|
@ -75,7 +75,7 @@ static void TraceCercle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
|||
*/
|
||||
int ToMatrixCoordinate( int aPhysicalCoordinate )
|
||||
{
|
||||
return aPhysicalCoordinate / g_GridRoutingSize;
|
||||
return aPhysicalCoordinate / Board.m_GridRouting;
|
||||
}
|
||||
|
||||
|
||||
|
@ -215,11 +215,11 @@ void TraceFilledCercle( BOARD* Pcb,
|
|||
uy1 = cy + radius;
|
||||
|
||||
/* Calculate limit coordinates of cells belonging to the rectangle. */
|
||||
row_max = uy1 / g_GridRoutingSize;
|
||||
col_max = ux1 / g_GridRoutingSize;
|
||||
row_min = uy0 / g_GridRoutingSize; // if (uy0 > row_min*g_GridRoutingSize
|
||||
row_max = uy1 / Board.m_GridRouting;
|
||||
col_max = ux1 / Board.m_GridRouting;
|
||||
row_min = uy0 / Board.m_GridRouting; // if (uy0 > row_min*Board.m_GridRouting
|
||||
// ) row_min++;
|
||||
col_min = ux0 / g_GridRoutingSize; // if (ux0 > col_min*g_GridRoutingSize
|
||||
col_min = ux0 / Board.m_GridRouting; // if (ux0 > col_min*Board.m_GridRouting
|
||||
// ) col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
|
@ -241,11 +241,11 @@ void TraceFilledCercle( BOARD* Pcb,
|
|||
|
||||
for( row = row_min; row <= row_max; row++ )
|
||||
{
|
||||
fdisty = (float) ( cy - ( row * g_GridRoutingSize ) );
|
||||
fdisty = (float) ( cy - ( row * Board.m_GridRouting ) );
|
||||
fdisty *= fdisty;
|
||||
for( col = col_min; col <= col_max; col++ )
|
||||
{
|
||||
fdistx = (float) ( cx - ( col * g_GridRoutingSize ) );
|
||||
fdistx = (float) ( cx - ( col * Board.m_GridRouting ) );
|
||||
fdistx *= fdistx;
|
||||
|
||||
if( fdistmin <= ( fdistx + fdisty ) )
|
||||
|
@ -265,17 +265,17 @@ void TraceFilledCercle( BOARD* Pcb,
|
|||
/* If no cell has been written, it affects the 4 neighboring diagonal
|
||||
* (Adverse event: pad off grid in the center of the 4 neighboring
|
||||
* diagonal) */
|
||||
distmin = g_GridRoutingSize / 2 + 1;
|
||||
distmin = Board.m_GridRouting / 2 + 1;
|
||||
fdistmin = ( (float) distmin * distmin ) * 2; /* Distance to center point
|
||||
* diagonally */
|
||||
|
||||
for( row = row_min; row <= row_max; row++ )
|
||||
{
|
||||
fdisty = (float) ( cy - ( row * g_GridRoutingSize ) );
|
||||
fdisty = (float) ( cy - ( row * Board.m_GridRouting ) );
|
||||
fdisty *= fdisty;
|
||||
for( col = col_min; col <= col_max; col++ )
|
||||
{
|
||||
fdistx = (float) ( cx - ( col * g_GridRoutingSize ) );
|
||||
fdistx = (float) ( cx - ( col * Board.m_GridRouting ) );
|
||||
fdistx *= fdistx;
|
||||
|
||||
if( fdistmin <= ( fdistx + fdisty ) )
|
||||
|
@ -302,7 +302,7 @@ void TraceSegmentPcb( BOARD* Pcb,
|
|||
int ux0, uy0, ux1, uy1;
|
||||
|
||||
|
||||
demi_pas = g_GridRoutingSize / 2;
|
||||
demi_pas = Board.m_GridRouting / 2;
|
||||
demi_largeur = ( pt_segm->m_Width / 2 ) + marge;
|
||||
/* Calculate the bounding rectangle of the segment (if H, V or Via) */
|
||||
ux0 = pt_segm->m_Start.x - Pcb->m_BoundaryBox.m_Pos.x;
|
||||
|
@ -407,9 +407,9 @@ void TraceLignePcb( int x0,
|
|||
{
|
||||
if( y1 < y0 )
|
||||
EXCHG( y0, y1 );
|
||||
dy = y0 / g_GridRoutingSize;
|
||||
lim = y1 / g_GridRoutingSize;
|
||||
dx = x0 / g_GridRoutingSize;
|
||||
dy = y0 / Board.m_GridRouting;
|
||||
lim = y1 / Board.m_GridRouting;
|
||||
dx = x0 / Board.m_GridRouting;
|
||||
/* Clipping limits of board. */
|
||||
if( ( dx < 0 ) || ( dx >= Ncols ) )
|
||||
return;
|
||||
|
@ -429,9 +429,9 @@ void TraceLignePcb( int x0,
|
|||
{
|
||||
if( x1 < x0 )
|
||||
EXCHG( x0, x1 );
|
||||
dx = x0 / g_GridRoutingSize;
|
||||
lim = x1 / g_GridRoutingSize;
|
||||
dy = y0 / g_GridRoutingSize;
|
||||
dx = x0 / Board.m_GridRouting;
|
||||
lim = x1 / Board.m_GridRouting;
|
||||
dy = y0 / Board.m_GridRouting;
|
||||
/* Clipping limits of board. */
|
||||
if( ( dy < 0 ) || ( dy >= Nrows ) )
|
||||
return;
|
||||
|
@ -455,13 +455,13 @@ void TraceLignePcb( int x0,
|
|||
EXCHG( x1, x0 ); EXCHG( y1, y0 );
|
||||
}
|
||||
|
||||
dx = x0 / g_GridRoutingSize;
|
||||
lim = x1 / g_GridRoutingSize;
|
||||
dy = y0 / g_GridRoutingSize;
|
||||
dx = x0 / Board.m_GridRouting;
|
||||
lim = x1 / Board.m_GridRouting;
|
||||
dy = y0 / Board.m_GridRouting;
|
||||
inc = 1; if( y1 < y0 )
|
||||
inc = -1;
|
||||
il = lim - dx; cumul = il / 2;
|
||||
delta = abs( y1 - y0 ) / g_GridRoutingSize;
|
||||
delta = abs( y1 - y0 ) / Board.m_GridRouting;
|
||||
|
||||
for( ; dx <= lim; )
|
||||
{
|
||||
|
@ -489,15 +489,15 @@ void TraceLignePcb( int x0,
|
|||
EXCHG( y1, y0 );
|
||||
}
|
||||
|
||||
dy = y0 / g_GridRoutingSize;
|
||||
lim = y1 / g_GridRoutingSize;
|
||||
dx = x0 / g_GridRoutingSize;
|
||||
dy = y0 / Board.m_GridRouting;
|
||||
lim = y1 / Board.m_GridRouting;
|
||||
dx = x0 / Board.m_GridRouting;
|
||||
inc = 1;
|
||||
if( x1 < x0 )
|
||||
inc = -1;
|
||||
|
||||
il = lim - dy; cumul = il / 2;
|
||||
delta = abs( x1 - x0 ) / g_GridRoutingSize;
|
||||
delta = abs( x1 - x0 ) / Board.m_GridRouting;
|
||||
|
||||
for( ; dy <= lim; )
|
||||
{
|
||||
|
@ -576,13 +576,13 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
|||
uy1 -= Pcb->m_BoundaryBox.m_Pos.y;
|
||||
|
||||
/* Calculating limits coord cells belonging to the rectangle. */
|
||||
row_max = uy1 / g_GridRoutingSize;
|
||||
col_max = ux1 / g_GridRoutingSize;
|
||||
row_min = uy0 / g_GridRoutingSize;
|
||||
if( uy0 > row_min * g_GridRoutingSize )
|
||||
row_max = uy1 / Board.m_GridRouting;
|
||||
col_max = ux1 / Board.m_GridRouting;
|
||||
row_min = uy0 / Board.m_GridRouting;
|
||||
if( uy0 > row_min * Board.m_GridRouting )
|
||||
row_min++;
|
||||
col_min = ux0 / g_GridRoutingSize;
|
||||
if( ux0 > col_min * g_GridRoutingSize )
|
||||
col_min = ux0 / Board.m_GridRouting;
|
||||
if( ux0 > col_min * Board.m_GridRouting )
|
||||
col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
|
@ -673,13 +673,13 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
|||
+ (double) ( cy - uy0 ) * ( cy - uy0 ) );
|
||||
|
||||
/* Calculating coordinate limits belonging to the rectangle. */
|
||||
row_max = ( cy + radius ) / g_GridRoutingSize;
|
||||
col_max = ( cx + radius ) / g_GridRoutingSize;
|
||||
row_min = ( cy - radius ) / g_GridRoutingSize;
|
||||
if( uy0 > row_min * g_GridRoutingSize )
|
||||
row_max = ( cy + radius ) / Board.m_GridRouting;
|
||||
col_max = ( cx + radius ) / Board.m_GridRouting;
|
||||
row_min = ( cy - radius ) / Board.m_GridRouting;
|
||||
if( uy0 > row_min * Board.m_GridRouting )
|
||||
row_min++;
|
||||
col_min = ( cx - radius ) / g_GridRoutingSize;
|
||||
if( ux0 > col_min * g_GridRoutingSize )
|
||||
col_min = ( cx - radius ) / Board.m_GridRouting;
|
||||
if( ux0 > col_min * Board.m_GridRouting )
|
||||
col_min++;
|
||||
|
||||
if( row_min < 0 )
|
||||
|
@ -695,8 +695,8 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
|||
{
|
||||
for( col = col_min; col <= col_max; col++ )
|
||||
{
|
||||
rotrow = row * g_GridRoutingSize;
|
||||
rotcol = col * g_GridRoutingSize;
|
||||
rotrow = row * Board.m_GridRouting;
|
||||
rotcol = col * Board.m_GridRouting;
|
||||
RotatePoint( &rotcol, &rotrow, cx, cy, -angle );
|
||||
if( rotrow <= uy0 )
|
||||
continue;
|
||||
|
@ -715,10 +715,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
|
|||
}
|
||||
|
||||
|
||||
/* Fills all cells BOARD contained in the segment
|
||||
* half-width lg, org ux, ux end y0, y1 is set to color.
|
||||
* coordinates in PCB units (0.1 million) relating to the origin
|
||||
* pt_pcb-> m_PcbBox.m_Xmin, Y's board.
|
||||
/* Fills all cells inside a segment
|
||||
* half-width lg, org ux, ux end y0, y1
|
||||
* is set to color.
|
||||
* coordinates are in PCB units (0.1 mil) are relative to the Board
|
||||
*/
|
||||
void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
||||
int color, int op_logique )
|
||||
|
@ -768,24 +768,24 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
|||
if( uy1 < uy0 )
|
||||
inc = -1;
|
||||
|
||||
demi_pas = g_GridRoutingSize / 2;
|
||||
demi_pas = Board.m_GridRouting / 2;
|
||||
|
||||
col_min = ( ux0 - lg ) / g_GridRoutingSize;
|
||||
col_min = ( ux0 - lg ) / Board.m_GridRouting;
|
||||
if( col_min < 0 )
|
||||
col_min = 0;
|
||||
col_max = ( ux1 + lg + demi_pas ) / g_GridRoutingSize;
|
||||
col_max = ( ux1 + lg + demi_pas ) / Board.m_GridRouting;
|
||||
if( col_max > ( Ncols - 1 ) )
|
||||
col_max = Ncols - 1;
|
||||
|
||||
if( inc > 0 )
|
||||
{
|
||||
row_min = ( uy0 - lg ) / g_GridRoutingSize;
|
||||
row_max = ( uy1 + lg + demi_pas ) / g_GridRoutingSize;
|
||||
row_min = ( uy0 - lg ) / Board.m_GridRouting;
|
||||
row_max = ( uy1 + lg + demi_pas ) / Board.m_GridRouting;
|
||||
}
|
||||
else
|
||||
{
|
||||
row_min = ( uy1 - lg ) / g_GridRoutingSize;
|
||||
row_max = ( uy0 + lg + demi_pas ) / g_GridRoutingSize;
|
||||
row_min = ( uy1 - lg ) / Board.m_GridRouting;
|
||||
row_max = ( uy0 + lg + demi_pas ) / Board.m_GridRouting;
|
||||
}
|
||||
|
||||
if( row_min < 0 )
|
||||
|
@ -813,10 +813,10 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
|
|||
for( col = col_min; col <= col_max; col++ )
|
||||
{
|
||||
int cxr;
|
||||
cxr = ( col * g_GridRoutingSize ) - ux0;
|
||||
cxr = ( col * Board.m_GridRouting ) - ux0;
|
||||
for( row = row_min; row <= row_max; row++ )
|
||||
{
|
||||
cy = (row * g_GridRoutingSize) - uy0;
|
||||
cy = (row * Board.m_GridRouting) - uy0;
|
||||
cx = cxr;
|
||||
RotatePoint( &cx, &cy, angle );
|
||||
if( abs( cy ) > lg )
|
||||
|
|
|
@ -649,8 +649,6 @@ static int WriteSetup( FILE* aFile, PCB_BASE_FRAME* aFrame, BOARD* aBoard )
|
|||
sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
|
||||
fprintf( aFile, "%s", text );
|
||||
|
||||
fprintf( aFile, "ZoneGridSize %d\n", g_GridRoutingSize );
|
||||
|
||||
fprintf( aFile, "Layers %d\n", aBoard->GetCopperLayerCount() );
|
||||
|
||||
unsigned layerMask =
|
||||
|
|
|
@ -280,13 +280,13 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
|
|||
|
||||
pt_cur_ch = pt_cur_ch;
|
||||
segm_oX = GetBoard()->m_BoundaryBox.m_Pos.x +
|
||||
(g_GridRoutingSize * col_source);
|
||||
(Board.m_GridRouting * col_source);
|
||||
segm_oY = GetBoard()->m_BoundaryBox.m_Pos.y +
|
||||
(g_GridRoutingSize * row_source);
|
||||
(Board.m_GridRouting * row_source);
|
||||
segm_fX = GetBoard()->m_BoundaryBox.m_Pos.x +
|
||||
(g_GridRoutingSize * col_target);
|
||||
(Board.m_GridRouting * col_target);
|
||||
segm_fY = GetBoard()->m_BoundaryBox.m_Pos.y +
|
||||
(g_GridRoutingSize * row_target);
|
||||
(Board.m_GridRouting * row_target);
|
||||
|
||||
/* Draw segment. */
|
||||
GRLine( &DrawPanel->m_ClipBox,
|
||||
|
@ -434,9 +434,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
* On the routing grid (1 grid point must be in the pad)
|
||||
*/
|
||||
{
|
||||
int cX = ( g_GridRoutingSize * col_source )
|
||||
int cX = ( Board.m_GridRouting * col_source )
|
||||
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x;
|
||||
int cY = ( g_GridRoutingSize * row_source )
|
||||
int cY = ( Board.m_GridRouting * row_source )
|
||||
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y;
|
||||
int dx = pt_cur_ch->m_PadStart->m_Size.x / 2;
|
||||
int dy = pt_cur_ch->m_PadStart->m_Size.y / 2;
|
||||
|
@ -448,9 +448,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )
|
||||
goto end_of_route;
|
||||
|
||||
cX = ( g_GridRoutingSize * col_target )
|
||||
cX = ( Board.m_GridRouting * col_target )
|
||||
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x;
|
||||
cY = ( g_GridRoutingSize * row_target )
|
||||
cY = ( Board.m_GridRouting * row_target )
|
||||
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y;
|
||||
dx = pt_cur_ch->m_PadEnd->m_Size.x / 2;
|
||||
dy = pt_cur_ch->m_PadEnd->m_Size.y / 2;
|
||||
|
@ -1118,11 +1118,11 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
|
|||
|
||||
g_CurrentTrackSegment->m_Start.x =
|
||||
g_CurrentTrackSegment->m_End.x = pcb->m_BoundaryBox.m_Pos.x +
|
||||
( g_GridRoutingSize * row );
|
||||
( Board.m_GridRouting * row );
|
||||
|
||||
g_CurrentTrackSegment->m_Start.y =
|
||||
g_CurrentTrackSegment->m_End.y = pcb->m_BoundaryBox.m_Pos.y +
|
||||
( g_GridRoutingSize * col );
|
||||
( Board.m_GridRouting * col );
|
||||
|
||||
g_CurrentTrackSegment->m_Width = pcb->GetCurrentViaSize();
|
||||
g_CurrentTrackSegment->m_Shape = pcb->GetBoardDesignSettings()->m_CurrentViaType;
|
||||
|
@ -1141,9 +1141,9 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
|
|||
|
||||
g_CurrentTrackSegment->SetState( TRACK_AR, ON );
|
||||
g_CurrentTrackSegment->m_End.x = pcb->m_BoundaryBox.m_Pos.x +
|
||||
( g_GridRoutingSize * row );
|
||||
( Board.m_GridRouting * row );
|
||||
g_CurrentTrackSegment->m_End.y = pcb->m_BoundaryBox.m_Pos.y +
|
||||
( g_GridRoutingSize * col );
|
||||
( Board.m_GridRouting * col );
|
||||
g_CurrentTrackSegment->SetNet( current_net_code );
|
||||
|
||||
if( g_CurrentTrackSegment->Back() == NULL ) /* Start trace. */
|
||||
|
|
Loading…
Reference in New Issue