Commit 155a9dbe authored by jean-pierre charras's avatar jean-pierre charras

All: fix a minor bur annoying issue: incorrect cursor shape after a block...

All: fix a minor bur annoying issue: incorrect cursor shape after a block command (mainly when a tool is selected)
parent dc24d6fc
...@@ -305,5 +305,5 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -305,5 +305,5 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
screen->m_BlockLocate.m_Command = BLOCK_IDLE; screen->m_BlockLocate.m_Command = BLOCK_IDLE;
Panel->GetParent()->DisplayToolMsg( wxEmptyString ); 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 ) ...@@ -440,7 +440,7 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
// Change DrawPanel cursor if requested. // Change DrawPanel cursor if requested.
if( DrawPanel && aCursor >= 0 ) if( DrawPanel && aCursor >= 0 )
DrawPanel->SetCursor( aCursor ); DrawPanel->SetCurrentCursor( aCursor );
DisplayToolMsg( aToolMsg ); DisplayToolMsg( aToolMsg );
......
/*****************/ /**
/* drawpanel.cpp */ * @file drawpanel.cpp
/*****************/ */
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
...@@ -84,10 +84,10 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, ...@@ -84,10 +84,10 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_Block_Enable = false; m_Block_Enable = false;
#ifdef __WXMAC__ #ifdef __WXMAC__
m_defaultCursor = m_cursor = wxCURSOR_CROSS; m_defaultCursor = m_currentCursor = wxCURSOR_CROSS;
m_showCrossHair = false; m_showCrossHair = false;
#else #else
m_defaultCursor = m_cursor = wxCURSOR_ARROW; m_defaultCursor = m_currentCursor = wxCURSOR_ARROW;
m_showCrossHair = true; m_showCrossHair = true;
#endif #endif
...@@ -1017,7 +1017,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1017,7 +1017,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
else else
{ {
m_AutoPAN_Request = true; m_AutoPAN_Request = true;
SetCursor( m_cursor = wxCURSOR_SIZING ); SetCursor( wxCURSOR_SIZING );
} }
} }
} }
...@@ -1045,20 +1045,19 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1045,20 +1045,19 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
} }
SetCursor( m_cursor = m_defaultCursor ); SetCursor( m_currentCursor );
} }
else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END ) else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END )
{ {
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
GetParent()->HandleBlockEnd( &DC ); GetParent()->HandleBlockEnd( &DC );
SetCursor( m_cursor = m_defaultCursor ); SetCursor( m_currentCursor );
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE ) if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE )
{ {
m_AutoPAN_Request = true; m_AutoPAN_Request = true;
SetCursor( wxCURSOR_HAND ); SetCursor( wxCURSOR_HAND );
} }
} }
} }
} }
...@@ -1106,9 +1105,9 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event ) ...@@ -1106,9 +1105,9 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
m_AbortRequest = true; m_AbortRequest = true;
if( IsMouseCaptured() ) if( IsMouseCaptured() )
EndMouseCapture( -1, m_defaultCursor ); EndMouseCapture( );
else else
EndMouseCapture( ID_NO_TOOL_SELECTED, m_cursor, wxEmptyString ); EndMouseCapture( ID_NO_TOOL_SELECTED, m_defaultCursor, wxEmptyString );
break; break;
} }
......
...@@ -183,7 +183,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -183,7 +183,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
} }
DrawPanel->SetMouseCapture( NULL, NULL ); DrawPanel->SetMouseCapture( NULL, NULL );
SetToolID( GetToolId(), DrawPanel->GetDefaultCursor(), wxEmptyString ); SetToolID( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString );
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
...@@ -317,7 +317,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -317,7 +317,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
block->m_Command = BLOCK_IDLE; block->m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
DrawPanel->SetMouseCapture( NULL, NULL ); DrawPanel->SetMouseCapture( NULL, NULL );
SetToolID( GetToolId(), DrawPanel->GetDefaultCursor(), wxEmptyString ); SetToolID( GetToolId(), DrawPanel->GetCurrentCursor(), wxEmptyString );
} }
if( zoom_command ) if( zoom_command )
......
...@@ -136,7 +136,8 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC ) ...@@ -136,7 +136,8 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
break; break;
} }
DrawPanel->SetMouseCapture( NULL, NULL ); DrawPanel->EndMouseCapture( );
DrawPanel->SetCursor( DrawPanel->GetCurrentCursor() );
GetScreen()->SetModify(); GetScreen()->SetModify();
GetScreen()->ClearBlockCommand(); GetScreen()->ClearBlockCommand();
...@@ -211,7 +212,8 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC ) ...@@ -211,7 +212,8 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
if( ! nextcmd ) if( ! nextcmd )
{ {
GetScreen()->ClearBlockCommand(); GetScreen()->ClearBlockCommand();
DrawPanel->SetMouseCapture( NULL, NULL ); DrawPanel->EndMouseCapture( );
DrawPanel->SetCursor( DrawPanel->GetCurrentCursor() );
DisplayToolMsg( wxEmptyString ); DisplayToolMsg( wxEmptyString );
} }
......
...@@ -30,7 +30,7 @@ typedef void ( *END_MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC ...@@ -30,7 +30,7 @@ typedef void ( *END_MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC
class EDA_DRAW_PANEL : public wxScrolledWindow class EDA_DRAW_PANEL : public wxScrolledWindow
{ {
private: 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. int m_defaultCursor; ///< The default mouse cursor shape id.
bool m_showCrossHair; ///< Indicate if cross hair is to be shown. bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
int m_cursorLevel; ///< Index for cursor redraw in XOR mode. int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
...@@ -82,6 +82,7 @@ public: ...@@ -82,6 +82,7 @@ public:
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
/** /**
* Function DrawBackGround * Function DrawBackGround
* @param DC = current Device Context * @param DC = current Device Context
...@@ -300,8 +301,28 @@ public: ...@@ -300,8 +301,28 @@ public:
inline bool IsMouseCaptured() const { return m_mouseCaptureCallback != NULL; } 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; } 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() DECLARE_EVENT_TABLE()
}; };
......
...@@ -59,7 +59,6 @@ int GetApxDist( int, int, int, int ); ...@@ -59,7 +59,6 @@ int GetApxDist( int, int, int, int );
int CalcDist( int, int, int ,int ); int CalcDist( int, int, int ,int );
/* BOARD.CPP */ /* BOARD.CPP */
bool ComputeMatriceSize( BOARD * aPcb, int aGridRouting );
int Build_Work( BOARD * Pcb ); int Build_Work( BOARD * Pcb );
void PlaceCells( BOARD * Pcb, int net_code, int flag = 0 ); void PlaceCells( BOARD * Pcb, int net_code, int flag = 0 );
......
This diff is collapsed.
...@@ -131,14 +131,14 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) ...@@ -131,14 +131,14 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode )
start = time( NULL ); start = time( NULL );
/* Calculation of no fixed routing to 5 mils and more. */ /* Calculation of no fixed routing to 5 mils and more. */
g_GridRoutingSize = (int)GetScreen()->GetGridSize().x; Board.m_GridRouting = (int)GetScreen()->GetGridSize().x;
if( g_GridRoutingSize < 50 ) if( Board.m_GridRouting < 50 )
g_GridRoutingSize = 50; Board.m_GridRouting = 50;
E_scale = g_GridRoutingSize / 50; if( E_scale < 1 ) E_scale = Board.m_GridRouting / 50; if( E_scale < 1 )
E_scale = 1; E_scale = 1;
/* Calculated ncol and nrow, matrix size for routing. */ /* Calculated ncol and nrow, matrix size for routing. */
ComputeMatriceSize( GetBoard(), g_GridRoutingSize ); Board.ComputeMatrixSize( GetBoard() );
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
......
...@@ -48,11 +48,8 @@ extern int ClosNodes; /* total number of nodes closed */ ...@@ -48,11 +48,8 @@ extern int ClosNodes; /* total number of nodes closed */
extern int MoveNodes; /* total number of nodes moved */ extern int MoveNodes; /* total number of nodes moved */
extern int MaxNodes; /* maximum number of nodes opened at one time */ 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. */ /* Structures useful to the generation of board as bitmap. */
typedef char MATRIX_CELL; typedef char MATRIX_CELL;
typedef int DIST_CELL; typedef int DIST_CELL;
typedef char DIR_CELL; typedef char DIR_CELL;
...@@ -68,12 +65,14 @@ public: ...@@ -68,12 +65,14 @@ public:
bool m_InitBoardDone; bool m_InitBoardDone;
int m_Layers; int m_Layers;
int m_GridRouting; // Size of grid for autoplace/autoroute int m_GridRouting; // Size of grid for autoplace/autoroute
EDA_Rect m_BrdBox; // Actual board bouding box
int m_Nrows, m_Ncols; int m_Nrows, m_Ncols;
int m_MemSize; int m_MemSize;
public: public:
MATRIX_ROUTING_HEAD(); MATRIX_ROUTING_HEAD();
~MATRIX_ROUTING_HEAD(); ~MATRIX_ROUTING_HEAD();
bool ComputeMatrixSize( BOARD* aPcb );
int InitBoard(); int InitBoard();
void UnInitBoard(); void UnInitBoard();
}; };
......
...@@ -94,7 +94,6 @@ static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title ...@@ -94,7 +94,6 @@ static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title
parent->GetScreen()->SetCrossHairPosition( oldpos ); parent->GetScreen()->SetCrossHairPosition( oldpos );
parent->DrawPanel->MoveCursorToCrossHair(); parent->DrawPanel->MoveCursorToCrossHair();
parent->DrawPanel->m_IgnoreMouseEvents = false; parent->DrawPanel->m_IgnoreMouseEvents = false;
parent->DrawPanel->SetCursor( parent->DrawPanel->GetDefaultCursor() );
return nocmd ? false : true; return nocmd ? false : true;
} }
...@@ -253,7 +252,7 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -253,7 +252,7 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
} }
DisplayToolMsg( wxEmptyString ); DisplayToolMsg( wxEmptyString );
DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() ); DrawPanel->SetCursor( DrawPanel->GetCurrentCursor() );
} }
......
This diff is collapsed.
...@@ -75,7 +75,7 @@ static void TraceCercle( int ux0, int uy0, int ux1, int uy1, int lg, int layer, ...@@ -75,7 +75,7 @@ static void TraceCercle( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
*/ */
int ToMatrixCoordinate( int aPhysicalCoordinate ) int ToMatrixCoordinate( int aPhysicalCoordinate )
{ {
return aPhysicalCoordinate / g_GridRoutingSize; return aPhysicalCoordinate / Board.m_GridRouting;
} }
...@@ -215,11 +215,11 @@ void TraceFilledCercle( BOARD* Pcb, ...@@ -215,11 +215,11 @@ void TraceFilledCercle( BOARD* Pcb,
uy1 = cy + radius; uy1 = cy + radius;
/* Calculate limit coordinates of cells belonging to the rectangle. */ /* Calculate limit coordinates of cells belonging to the rectangle. */
row_max = uy1 / g_GridRoutingSize; row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / g_GridRoutingSize; col_max = ux1 / Board.m_GridRouting;
row_min = uy0 / g_GridRoutingSize; // if (uy0 > row_min*g_GridRoutingSize row_min = uy0 / Board.m_GridRouting; // if (uy0 > row_min*Board.m_GridRouting
// ) row_min++; // ) 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++; // ) col_min++;
if( row_min < 0 ) if( row_min < 0 )
...@@ -241,11 +241,11 @@ void TraceFilledCercle( BOARD* Pcb, ...@@ -241,11 +241,11 @@ void TraceFilledCercle( BOARD* Pcb,
for( row = row_min; row <= row_max; row++ ) for( row = row_min; row <= row_max; row++ )
{ {
fdisty = (float) ( cy - ( row * g_GridRoutingSize ) ); fdisty = (float) ( cy - ( row * Board.m_GridRouting ) );
fdisty *= fdisty; fdisty *= fdisty;
for( col = col_min; col <= col_max; col++ ) for( col = col_min; col <= col_max; col++ )
{ {
fdistx = (float) ( cx - ( col * g_GridRoutingSize ) ); fdistx = (float) ( cx - ( col * Board.m_GridRouting ) );
fdistx *= fdistx; fdistx *= fdistx;
if( fdistmin <= ( fdistx + fdisty ) ) if( fdistmin <= ( fdistx + fdisty ) )
...@@ -265,17 +265,17 @@ void TraceFilledCercle( BOARD* Pcb, ...@@ -265,17 +265,17 @@ void TraceFilledCercle( BOARD* Pcb,
/* If no cell has been written, it affects the 4 neighboring diagonal /* If no cell has been written, it affects the 4 neighboring diagonal
* (Adverse event: pad off grid in the center of the 4 neighboring * (Adverse event: pad off grid in the center of the 4 neighboring
* diagonal) */ * diagonal) */
distmin = g_GridRoutingSize / 2 + 1; distmin = Board.m_GridRouting / 2 + 1;
fdistmin = ( (float) distmin * distmin ) * 2; /* Distance to center point fdistmin = ( (float) distmin * distmin ) * 2; /* Distance to center point
* diagonally */ * diagonally */
for( row = row_min; row <= row_max; row++ ) for( row = row_min; row <= row_max; row++ )
{ {
fdisty = (float) ( cy - ( row * g_GridRoutingSize ) ); fdisty = (float) ( cy - ( row * Board.m_GridRouting ) );
fdisty *= fdisty; fdisty *= fdisty;
for( col = col_min; col <= col_max; col++ ) for( col = col_min; col <= col_max; col++ )
{ {
fdistx = (float) ( cx - ( col * g_GridRoutingSize ) ); fdistx = (float) ( cx - ( col * Board.m_GridRouting ) );
fdistx *= fdistx; fdistx *= fdistx;
if( fdistmin <= ( fdistx + fdisty ) ) if( fdistmin <= ( fdistx + fdisty ) )
...@@ -302,7 +302,7 @@ void TraceSegmentPcb( BOARD* Pcb, ...@@ -302,7 +302,7 @@ void TraceSegmentPcb( BOARD* Pcb,
int ux0, uy0, ux1, uy1; int ux0, uy0, ux1, uy1;
demi_pas = g_GridRoutingSize / 2; demi_pas = Board.m_GridRouting / 2;
demi_largeur = ( pt_segm->m_Width / 2 ) + marge; demi_largeur = ( pt_segm->m_Width / 2 ) + marge;
/* Calculate the bounding rectangle of the segment (if H, V or Via) */ /* Calculate the bounding rectangle of the segment (if H, V or Via) */
ux0 = pt_segm->m_Start.x - Pcb->m_BoundaryBox.m_Pos.x; ux0 = pt_segm->m_Start.x - Pcb->m_BoundaryBox.m_Pos.x;
...@@ -407,9 +407,9 @@ void TraceLignePcb( int x0, ...@@ -407,9 +407,9 @@ void TraceLignePcb( int x0,
{ {
if( y1 < y0 ) if( y1 < y0 )
EXCHG( y0, y1 ); EXCHG( y0, y1 );
dy = y0 / g_GridRoutingSize; dy = y0 / Board.m_GridRouting;
lim = y1 / g_GridRoutingSize; lim = y1 / Board.m_GridRouting;
dx = x0 / g_GridRoutingSize; dx = x0 / Board.m_GridRouting;
/* Clipping limits of board. */ /* Clipping limits of board. */
if( ( dx < 0 ) || ( dx >= Ncols ) ) if( ( dx < 0 ) || ( dx >= Ncols ) )
return; return;
...@@ -429,9 +429,9 @@ void TraceLignePcb( int x0, ...@@ -429,9 +429,9 @@ void TraceLignePcb( int x0,
{ {
if( x1 < x0 ) if( x1 < x0 )
EXCHG( x0, x1 ); EXCHG( x0, x1 );
dx = x0 / g_GridRoutingSize; dx = x0 / Board.m_GridRouting;
lim = x1 / g_GridRoutingSize; lim = x1 / Board.m_GridRouting;
dy = y0 / g_GridRoutingSize; dy = y0 / Board.m_GridRouting;
/* Clipping limits of board. */ /* Clipping limits of board. */
if( ( dy < 0 ) || ( dy >= Nrows ) ) if( ( dy < 0 ) || ( dy >= Nrows ) )
return; return;
...@@ -455,13 +455,13 @@ void TraceLignePcb( int x0, ...@@ -455,13 +455,13 @@ void TraceLignePcb( int x0,
EXCHG( x1, x0 ); EXCHG( y1, y0 ); EXCHG( x1, x0 ); EXCHG( y1, y0 );
} }
dx = x0 / g_GridRoutingSize; dx = x0 / Board.m_GridRouting;
lim = x1 / g_GridRoutingSize; lim = x1 / Board.m_GridRouting;
dy = y0 / g_GridRoutingSize; dy = y0 / Board.m_GridRouting;
inc = 1; if( y1 < y0 ) inc = 1; if( y1 < y0 )
inc = -1; inc = -1;
il = lim - dx; cumul = il / 2; il = lim - dx; cumul = il / 2;
delta = abs( y1 - y0 ) / g_GridRoutingSize; delta = abs( y1 - y0 ) / Board.m_GridRouting;
for( ; dx <= lim; ) for( ; dx <= lim; )
{ {
...@@ -489,15 +489,15 @@ void TraceLignePcb( int x0, ...@@ -489,15 +489,15 @@ void TraceLignePcb( int x0,
EXCHG( y1, y0 ); EXCHG( y1, y0 );
} }
dy = y0 / g_GridRoutingSize; dy = y0 / Board.m_GridRouting;
lim = y1 / g_GridRoutingSize; lim = y1 / Board.m_GridRouting;
dx = x0 / g_GridRoutingSize; dx = x0 / Board.m_GridRouting;
inc = 1; inc = 1;
if( x1 < x0 ) if( x1 < x0 )
inc = -1; inc = -1;
il = lim - dy; cumul = il / 2; il = lim - dy; cumul = il / 2;
delta = abs( x1 - x0 ) / g_GridRoutingSize; delta = abs( x1 - x0 ) / Board.m_GridRouting;
for( ; dy <= lim; ) for( ; dy <= lim; )
{ {
...@@ -576,13 +576,13 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, ...@@ -576,13 +576,13 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
uy1 -= Pcb->m_BoundaryBox.m_Pos.y; uy1 -= Pcb->m_BoundaryBox.m_Pos.y;
/* Calculating limits coord cells belonging to the rectangle. */ /* Calculating limits coord cells belonging to the rectangle. */
row_max = uy1 / g_GridRoutingSize; row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / g_GridRoutingSize; col_max = ux1 / Board.m_GridRouting;
row_min = uy0 / g_GridRoutingSize; row_min = uy0 / Board.m_GridRouting;
if( uy0 > row_min * g_GridRoutingSize ) if( uy0 > row_min * Board.m_GridRouting )
row_min++; row_min++;
col_min = ux0 / g_GridRoutingSize; col_min = ux0 / Board.m_GridRouting;
if( ux0 > col_min * g_GridRoutingSize ) if( ux0 > col_min * Board.m_GridRouting )
col_min++; col_min++;
if( row_min < 0 ) if( row_min < 0 )
...@@ -673,13 +673,13 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, ...@@ -673,13 +673,13 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
+ (double) ( cy - uy0 ) * ( cy - uy0 ) ); + (double) ( cy - uy0 ) * ( cy - uy0 ) );
/* Calculating coordinate limits belonging to the rectangle. */ /* Calculating coordinate limits belonging to the rectangle. */
row_max = ( cy + radius ) / g_GridRoutingSize; row_max = ( cy + radius ) / Board.m_GridRouting;
col_max = ( cx + radius ) / g_GridRoutingSize; col_max = ( cx + radius ) / Board.m_GridRouting;
row_min = ( cy - radius ) / g_GridRoutingSize; row_min = ( cy - radius ) / Board.m_GridRouting;
if( uy0 > row_min * g_GridRoutingSize ) if( uy0 > row_min * Board.m_GridRouting )
row_min++; row_min++;
col_min = ( cx - radius ) / g_GridRoutingSize; col_min = ( cx - radius ) / Board.m_GridRouting;
if( ux0 > col_min * g_GridRoutingSize ) if( ux0 > col_min * Board.m_GridRouting )
col_min++; col_min++;
if( row_min < 0 ) if( row_min < 0 )
...@@ -695,8 +695,8 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, ...@@ -695,8 +695,8 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
{ {
for( col = col_min; col <= col_max; col++ ) for( col = col_min; col <= col_max; col++ )
{ {
rotrow = row * g_GridRoutingSize; rotrow = row * Board.m_GridRouting;
rotcol = col * g_GridRoutingSize; rotcol = col * Board.m_GridRouting;
RotatePoint( &rotcol, &rotrow, cx, cy, -angle ); RotatePoint( &rotcol, &rotrow, cx, cy, -angle );
if( rotrow <= uy0 ) if( rotrow <= uy0 )
continue; continue;
...@@ -715,10 +715,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, ...@@ -715,10 +715,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
} }
/* Fills all cells BOARD contained in the segment /* Fills all cells inside a segment
* half-width lg, org ux, ux end y0, y1 is set to color. * half-width lg, org ux, ux end y0, y1
* coordinates in PCB units (0.1 million) relating to the origin * is set to color.
* pt_pcb-> m_PcbBox.m_Xmin, Y's board. * 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, void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
int color, int op_logique ) int color, int op_logique )
...@@ -768,24 +768,24 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer, ...@@ -768,24 +768,24 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer,
if( uy1 < uy0 ) if( uy1 < uy0 )
inc = -1; 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 ) if( col_min < 0 )
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 ) ) if( col_max > ( Ncols - 1 ) )
col_max = Ncols - 1; col_max = Ncols - 1;
if( inc > 0 ) if( inc > 0 )
{ {
row_min = ( uy0 - lg ) / g_GridRoutingSize; row_min = ( uy0 - lg ) / Board.m_GridRouting;
row_max = ( uy1 + lg + demi_pas ) / g_GridRoutingSize; row_max = ( uy1 + lg + demi_pas ) / Board.m_GridRouting;
} }
else else
{ {
row_min = ( uy1 - lg ) / g_GridRoutingSize; row_min = ( uy1 - lg ) / Board.m_GridRouting;
row_max = ( uy0 + lg + demi_pas ) / g_GridRoutingSize; row_max = ( uy0 + lg + demi_pas ) / Board.m_GridRouting;
} }
if( row_min < 0 ) if( row_min < 0 )
...@@ -813,10 +813,10 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer, ...@@ -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++ ) for( col = col_min; col <= col_max; col++ )
{ {
int cxr; int cxr;
cxr = ( col * g_GridRoutingSize ) - ux0; cxr = ( col * Board.m_GridRouting ) - ux0;
for( row = row_min; row <= row_max; row++ ) for( row = row_min; row <= row_max; row++ )
{ {
cy = (row * g_GridRoutingSize) - uy0; cy = (row * Board.m_GridRouting) - uy0;
cx = cxr; cx = cxr;
RotatePoint( &cx, &cy, angle ); RotatePoint( &cx, &cy, angle );
if( abs( cy ) > lg ) if( abs( cy ) > lg )
......
...@@ -649,8 +649,6 @@ static int WriteSetup( FILE* aFile, PCB_BASE_FRAME* aFrame, BOARD* aBoard ) ...@@ -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 ); sprintf( text, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf( aFile, "%s", text ); fprintf( aFile, "%s", text );
fprintf( aFile, "ZoneGridSize %d\n", g_GridRoutingSize );
fprintf( aFile, "Layers %d\n", aBoard->GetCopperLayerCount() ); fprintf( aFile, "Layers %d\n", aBoard->GetCopperLayerCount() );
unsigned layerMask = unsigned layerMask =
......
...@@ -280,13 +280,13 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides ) ...@@ -280,13 +280,13 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
pt_cur_ch = pt_cur_ch; pt_cur_ch = pt_cur_ch;
segm_oX = GetBoard()->m_BoundaryBox.m_Pos.x + 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 + 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 + 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 + segm_fY = GetBoard()->m_BoundaryBox.m_Pos.y +
(g_GridRoutingSize * row_target); (Board.m_GridRouting * row_target);
/* Draw segment. */ /* Draw segment. */
GRLine( &DrawPanel->m_ClipBox, GRLine( &DrawPanel->m_ClipBox,
...@@ -434,9 +434,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, ...@@ -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) * 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; + 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; + pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y;
int dx = pt_cur_ch->m_PadStart->m_Size.x / 2; int dx = pt_cur_ch->m_PadStart->m_Size.x / 2;
int dy = pt_cur_ch->m_PadStart->m_Size.y / 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, ...@@ -448,9 +448,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) ) if( ( abs( cX - px ) > dx ) || ( abs( cY - py ) > dy ) )
goto end_of_route; goto end_of_route;
cX = ( g_GridRoutingSize * col_target ) cX = ( Board.m_GridRouting * col_target )
+ pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x; + 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; + pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y;
dx = pt_cur_ch->m_PadEnd->m_Size.x / 2; dx = pt_cur_ch->m_PadEnd->m_Size.x / 2;
dy = pt_cur_ch->m_PadEnd->m_Size.y / 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, ...@@ -1118,11 +1118,11 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment->m_Start.x = g_CurrentTrackSegment->m_Start.x =
g_CurrentTrackSegment->m_End.x = pcb->m_BoundaryBox.m_Pos.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_Start.y =
g_CurrentTrackSegment->m_End.y = pcb->m_BoundaryBox.m_Pos.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_Width = pcb->GetCurrentViaSize();
g_CurrentTrackSegment->m_Shape = pcb->GetBoardDesignSettings()->m_CurrentViaType; g_CurrentTrackSegment->m_Shape = pcb->GetBoardDesignSettings()->m_CurrentViaType;
...@@ -1141,9 +1141,9 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, ...@@ -1141,9 +1141,9 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment->SetState( TRACK_AR, ON ); g_CurrentTrackSegment->SetState( TRACK_AR, ON );
g_CurrentTrackSegment->m_End.x = pcb->m_BoundaryBox.m_Pos.x + 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_CurrentTrackSegment->m_End.y = pcb->m_BoundaryBox.m_Pos.y +
( g_GridRoutingSize * col ); ( Board.m_GridRouting * col );
g_CurrentTrackSegment->SetNet( current_net_code ); g_CurrentTrackSegment->SetNet( current_net_code );
if( g_CurrentTrackSegment->Back() == NULL ) /* Start trace. */ if( g_CurrentTrackSegment->Back() == NULL ) /* Start trace. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment