Global variable removal and coordinate fixes.
* ActiveScreen global variable is gone, yeah! * Use drawing coordinates instead of screen coordinates when calling GeneralControle().
This commit is contained in:
parent
6f9fc8d210
commit
85ae0373e3
|
@ -13,8 +13,6 @@
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|
||||||
|
|
||||||
BASE_SCREEN* ActiveScreen = NULL;
|
|
||||||
|
|
||||||
#define CURSOR_SIZE 12 /* size of the cross cursor. */
|
#define CURSOR_SIZE 12 /* size of the cross cursor. */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -285,22 +285,19 @@ wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition()
|
||||||
*/
|
*/
|
||||||
void EDA_DRAW_PANEL::MouseToCursorSchema()
|
void EDA_DRAW_PANEL::MouseToCursorSchema()
|
||||||
{
|
{
|
||||||
wxPoint Mouse = CursorScreenPosition();
|
MoveCursor( GetScreen()->m_Curseur );
|
||||||
|
|
||||||
MouseTo( Mouse );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Move the mouse cursor to the position "Mouse"
|
void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition )
|
||||||
* @param Mouse = mouse cursor position, in pixels units
|
|
||||||
*/
|
|
||||||
void EDA_DRAW_PANEL::MouseTo( const wxPoint& Mouse )
|
|
||||||
{
|
{
|
||||||
int x, y, xPpu, yPpu;
|
int x, y, xPpu, yPpu;
|
||||||
wxPoint screenPos, drawingPos;
|
wxPoint screenPos, drawingPos;
|
||||||
wxRect clientRect( wxPoint( 0, 0 ), GetClientSize() );
|
wxRect clientRect( wxPoint( 0, 0 ), GetClientSize() );
|
||||||
|
|
||||||
CalcScrolledPosition( Mouse.x, Mouse.y, &screenPos.x, &screenPos.y );
|
INSTALL_UNBUFFERED_DC( dc, this );
|
||||||
|
screenPos.x = dc.LogicalToDeviceX( aPosition.x );
|
||||||
|
screenPos.y = dc.LogicalToDeviceY( aPosition.y );
|
||||||
|
|
||||||
// Scroll if the requested mouse position cursor is outside the drawing area.
|
// Scroll if the requested mouse position cursor is outside the drawing area.
|
||||||
if( !clientRect.Contains( screenPos ) )
|
if( !clientRect.Contains( screenPos ) )
|
||||||
|
@ -309,7 +306,7 @@ void EDA_DRAW_PANEL::MouseTo( const wxPoint& Mouse )
|
||||||
GetScrollPixelsPerUnit( &xPpu, &yPpu );
|
GetScrollPixelsPerUnit( &xPpu, &yPpu );
|
||||||
CalcUnscrolledPosition( screenPos.x, screenPos.y, &drawingPos.x, &drawingPos.y );
|
CalcUnscrolledPosition( screenPos.x, screenPos.y, &drawingPos.x, &drawingPos.y );
|
||||||
|
|
||||||
wxLogDebug( wxT( "MouseTo() initial screen position(%d, %d) " ) \
|
wxLogDebug( wxT( "MoveCursor() initial screen position(%d, %d) " ) \
|
||||||
wxT( "rectangle(%d, %d, %d, %d) view(%d, %d)" ),
|
wxT( "rectangle(%d, %d, %d, %d) view(%d, %d)" ),
|
||||||
screenPos.x, screenPos.y, clientRect.x, clientRect.y,
|
screenPos.x, screenPos.y, clientRect.x, clientRect.y,
|
||||||
clientRect.width, clientRect.height, x, y );
|
clientRect.width, clientRect.height, x, y );
|
||||||
|
@ -326,7 +323,7 @@ void EDA_DRAW_PANEL::MouseTo( const wxPoint& Mouse )
|
||||||
Scroll( x, y );
|
Scroll( x, y );
|
||||||
CalcScrolledPosition( drawingPos.x, drawingPos.y, &screenPos.x, &screenPos.y );
|
CalcScrolledPosition( drawingPos.x, drawingPos.y, &screenPos.x, &screenPos.y );
|
||||||
|
|
||||||
wxLogDebug( wxT( "MouseTo() scrolled screen position(%d, %d) view(%d, %d)" ),
|
wxLogDebug( wxT( "MoveCursor() scrolled screen position(%d, %d) view(%d, %d)" ),
|
||||||
screenPos.x, screenPos.y, x, y );
|
screenPos.x, screenPos.y, x, y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,7 +1004,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calling the general function on mouse changes (and pseudo key commands) */
|
/* Calling the general function on mouse changes (and pseudo key commands) */
|
||||||
m_Parent->GeneralControle( &DC, pos );
|
m_Parent->GeneralControle( &DC, event.GetLogicalPosition( DC ) );
|
||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
/* Control of block commands : */
|
/* Control of block commands : */
|
||||||
|
@ -1221,10 +1218,11 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Some key commands use the current mouse position: refresh it */
|
/* Some key commands use the current mouse position: refresh it */
|
||||||
pos = CalcUnscrolledPosition( wxGetMousePosition() - GetScreenPosition() );
|
pos = wxGetMousePosition() - GetScreenPosition();
|
||||||
|
|
||||||
// Compute the cursor position in drawing units. Also known as logical units to wxDC.
|
// Compute the cursor position in drawing units. Also known as logical units to wxDC.
|
||||||
Screen->m_MousePosition = CursorRealPosition( pos );
|
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
|
||||||
|
Screen->m_MousePosition = pos;
|
||||||
|
|
||||||
m_Parent->GeneralControle( &DC, pos );
|
m_Parent->GeneralControle( &DC, pos );
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,6 @@ static void GRSRect( EDA_Rect* aClipBox, wxDC* aDC, int x1, int y1,
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
extern BASE_SCREEN* ActiveScreen;
|
|
||||||
|
|
||||||
static int GRLastMoveToX, GRLastMoveToY;
|
static int GRLastMoveToX, GRLastMoveToY;
|
||||||
static bool s_ForceBlackPen; /* if true: draws in black instead of
|
static bool s_ForceBlackPen; /* if true: draws in black instead of
|
||||||
* color for printing. */
|
* color for printing. */
|
||||||
|
|
|
@ -52,6 +52,7 @@ void EDA_DRAW_FRAME::RedrawScreen( bool aWarpPointer )
|
||||||
void EDA_DRAW_FRAME::PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize )
|
void EDA_DRAW_FRAME::PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize )
|
||||||
{
|
{
|
||||||
wxRealPoint grid_size;
|
wxRealPoint grid_size;
|
||||||
|
|
||||||
if( aGridSize )
|
if( aGridSize )
|
||||||
grid_size = *aGridSize;
|
grid_size = *aGridSize;
|
||||||
else
|
else
|
||||||
|
|
|
@ -390,27 +390,19 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
SetToolbars();
|
SetToolbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* DC, wxPoint Mouse )
|
void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
|
||||||
{
|
{
|
||||||
wxRealPoint delta;
|
wxRealPoint gridSize;
|
||||||
int flagcurseur = 0;
|
int flagcurseur = 0;
|
||||||
wxPoint curpos, oldpos;
|
wxPoint oldpos;
|
||||||
double scalar = GetScreen()->GetScalingFactor();
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
|
||||||
curpos = DrawPanel->CursorRealPosition( Mouse );
|
PutOnGrid( &pos );
|
||||||
oldpos = GetScreen()->m_Curseur;
|
oldpos = GetScreen()->m_Curseur;
|
||||||
|
gridSize = GetScreen()->GetGridSize();
|
||||||
delta = GetScreen()->GetGridSize();
|
|
||||||
|
|
||||||
delta.x *= scalar;
|
|
||||||
delta.y *= scalar;
|
|
||||||
|
|
||||||
if( delta.x <= 0 )
|
|
||||||
delta.x = 1;
|
|
||||||
if( delta.y <= 0 )
|
|
||||||
delta.y = 1;
|
|
||||||
|
|
||||||
switch( g_KeyPressed )
|
switch( g_KeyPressed )
|
||||||
{
|
{
|
||||||
|
@ -418,14 +410,14 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
cmd.SetId( ID_POPUP_ZOOM_IN );
|
cmd.SetId( ID_POPUP_ZOOM_IN );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
flagcurseur = 2;
|
flagcurseur = 2;
|
||||||
curpos = GetScreen()->m_Curseur;
|
pos = GetScreen()->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_F2:
|
case WXK_F2:
|
||||||
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
flagcurseur = 2;
|
flagcurseur = 2;
|
||||||
curpos = GetScreen()->m_Curseur;
|
pos = GetScreen()->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_F3:
|
case WXK_F3:
|
||||||
|
@ -438,14 +430,14 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
cmd.SetId( ID_POPUP_ZOOM_CENTER );
|
cmd.SetId( ID_POPUP_ZOOM_CENTER );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
flagcurseur = 2;
|
flagcurseur = 2;
|
||||||
curpos = GetScreen()->m_Curseur;
|
pos = GetScreen()->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_HOME:
|
case WXK_HOME:
|
||||||
cmd.SetId( ID_ZOOM_PAGE );
|
cmd.SetId( ID_ZOOM_PAGE );
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
flagcurseur = 2;
|
flagcurseur = 2;
|
||||||
curpos = GetScreen()->m_Curseur;
|
pos = GetScreen()->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ' ':
|
case ' ':
|
||||||
|
@ -454,32 +446,30 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
|
|
||||||
case WXK_NUMPAD8: /* cursor moved up */
|
case WXK_NUMPAD8: /* cursor moved up */
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
Mouse.y -= wxRound(delta.y);
|
pos.y -= wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2: /* cursor moved down */
|
case WXK_NUMPAD2: /* cursor moved down */
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
Mouse.y += wxRound(delta.y);
|
pos.y += wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4: /* cursor moved left */
|
case WXK_NUMPAD4: /* cursor moved left */
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
Mouse.x -= wxRound(delta.x);
|
pos.x -= wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6: /* cursor moved right */
|
case WXK_NUMPAD6: /* cursor moved right */
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
Mouse.x += wxRound(delta.x);
|
pos.x += wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->m_Curseur = curpos;
|
GetScreen()->m_Curseur = pos;
|
||||||
/* Put cursor on grid */
|
|
||||||
PutOnGrid( &GetScreen()->m_Curseur );
|
|
||||||
|
|
||||||
if( GetScreen()->IsRefreshReq() )
|
if( GetScreen()->IsRefreshReq() )
|
||||||
{
|
{
|
||||||
|
@ -491,17 +481,16 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
{
|
{
|
||||||
if( flagcurseur != 2 )
|
if( flagcurseur != 2 )
|
||||||
{
|
{
|
||||||
curpos = GetScreen()->m_Curseur;
|
pos = GetScreen()->m_Curseur;
|
||||||
GetScreen()->m_Curseur = oldpos;
|
GetScreen()->m_Curseur = oldpos;
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( aDC );
|
||||||
|
GetScreen()->m_Curseur = pos;
|
||||||
GetScreen()->m_Curseur = curpos;
|
DrawPanel->CursorOn( aDC );
|
||||||
DrawPanel->CursorOn( DC );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
{
|
{
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, 0 );
|
DrawPanel->ManageCurseur( DrawPanel, aDC, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,12 +91,11 @@ void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
if( !GetBoard() )
|
if( !GetBoard() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ActiveScreen = (PCB_SCREEN*) GetScreen();
|
|
||||||
|
|
||||||
DrawPanel->DrawBackGround( DC );
|
DrawPanel->DrawBackGround( DC );
|
||||||
GetBoard()->Draw( DrawPanel, DC, GR_COPY );
|
GetBoard()->Draw( DrawPanel, DC, GR_COPY );
|
||||||
|
|
||||||
MODULE* Module = GetBoard()->m_Modules;
|
MODULE* Module = GetBoard()->m_Modules;
|
||||||
|
|
||||||
if ( Module )
|
if ( Module )
|
||||||
Module->DisplayInfo( this );
|
Module->DisplayInfo( this );
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,12 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( bool IncludePin )
|
||||||
SCH_COMPONENT* LibItem = NULL;
|
SCH_COMPONENT* LibItem = NULL;
|
||||||
|
|
||||||
DrawStruct = SchematicGeneralLocateAndDisplay( mouse_position, IncludePin );
|
DrawStruct = SchematicGeneralLocateAndDisplay( mouse_position, IncludePin );
|
||||||
|
|
||||||
if( !DrawStruct && ( mouse_position != GetScreen()->m_Curseur) )
|
if( !DrawStruct && ( mouse_position != GetScreen()->m_Curseur) )
|
||||||
{
|
{
|
||||||
DrawStruct = SchematicGeneralLocateAndDisplay( GetScreen()->m_Curseur,
|
DrawStruct = SchematicGeneralLocateAndDisplay( GetScreen()->m_Curseur, IncludePin );
|
||||||
IncludePin );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !DrawStruct )
|
if( !DrawStruct )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -235,26 +236,17 @@ SCH_ITEM* SCH_EDIT_FRAME::SchematicGeneralLocateAndDisplay( const wxPoint& refpo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
|
||||||
{
|
{
|
||||||
wxRealPoint delta;
|
wxRealPoint gridSize;
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
wxPoint curpos, oldpos;
|
wxPoint oldpos;
|
||||||
int hotkey = 0;
|
int hotkey = 0;
|
||||||
double scalar = screen->GetScalingFactor();
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
curpos = screen->m_MousePosition;
|
PutOnGrid( &pos );
|
||||||
oldpos = screen->m_Curseur;
|
oldpos = screen->m_Curseur;
|
||||||
|
gridSize = screen->GetGridSize();
|
||||||
delta = screen->GetGridSize();
|
|
||||||
|
|
||||||
delta.x *= scalar;
|
|
||||||
delta.y *= scalar;
|
|
||||||
|
|
||||||
if( delta.x <= 0 )
|
|
||||||
delta.x = 1;
|
|
||||||
if( delta.y <= 0 )
|
|
||||||
delta.y = 1;
|
|
||||||
|
|
||||||
switch( g_KeyPressed )
|
switch( g_KeyPressed )
|
||||||
{
|
{
|
||||||
|
@ -263,26 +255,26 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
|
|
||||||
case WXK_NUMPAD8:
|
case WXK_NUMPAD8:
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
MousePositionInPixels.y -= wxRound( delta.y );
|
pos.y -= wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2:
|
case WXK_NUMPAD2:
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
MousePositionInPixels.y += wxRound( delta.y );
|
pos.y += wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4:
|
case WXK_NUMPAD4:
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
MousePositionInPixels.x -= wxRound( delta.x );
|
pos.x -= wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6:
|
case WXK_NUMPAD6:
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
MousePositionInPixels.x += wxRound( delta.x );
|
pos.x += wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -290,11 +282,8 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update cursor position. */
|
// Update cursor position.
|
||||||
screen->m_Curseur = curpos;
|
screen->m_Curseur = pos;
|
||||||
|
|
||||||
/* Snap cursor to grid. */
|
|
||||||
PutOnGrid( &(screen->m_Curseur) );
|
|
||||||
|
|
||||||
if( screen->IsRefreshReq() )
|
if( screen->IsRefreshReq() )
|
||||||
{
|
{
|
||||||
|
@ -304,24 +293,24 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
|
|
||||||
if( oldpos != screen->m_Curseur )
|
if( oldpos != screen->m_Curseur )
|
||||||
{
|
{
|
||||||
curpos = screen->m_Curseur;
|
pos = screen->m_Curseur;
|
||||||
screen->m_Curseur = oldpos;
|
screen->m_Curseur = oldpos;
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( aDC );
|
||||||
screen->m_Curseur = curpos;
|
screen->m_Curseur = pos;
|
||||||
DrawPanel->CursorOn( DC );
|
DrawPanel->CursorOn( aDC );
|
||||||
|
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
{
|
{
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
|
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( hotkey )
|
if( hotkey )
|
||||||
{
|
{
|
||||||
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
|
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
|
||||||
OnHotKey( DC, hotkey, screen->GetCurItem() );
|
OnHotKey( aDC, hotkey, screen->GetCurItem() );
|
||||||
else
|
else
|
||||||
OnHotKey( DC, hotkey, NULL );
|
OnHotKey( aDC, hotkey, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatusBar(); /* Display cursor coordinates info */
|
UpdateStatusBar(); /* Display cursor coordinates info */
|
||||||
|
@ -329,26 +318,17 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
|
||||||
{
|
{
|
||||||
wxRealPoint delta;
|
wxRealPoint gridSize;
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
wxPoint curpos, oldpos;
|
wxPoint oldpos;
|
||||||
int hotkey = 0;
|
int hotkey = 0;
|
||||||
double scalar = screen->GetScalingFactor();
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
curpos = screen->m_MousePosition;
|
PutOnGrid( &pos );
|
||||||
oldpos = screen->m_Curseur;
|
oldpos = screen->m_Curseur;
|
||||||
|
gridSize = screen->GetGridSize();
|
||||||
delta = screen->GetGridSize();
|
|
||||||
|
|
||||||
delta.x *= scalar;
|
|
||||||
delta.y *= scalar;
|
|
||||||
|
|
||||||
if( delta.x <= 0 )
|
|
||||||
delta.x = 1;
|
|
||||||
if( delta.y <= 0 )
|
|
||||||
delta.y = 1;
|
|
||||||
|
|
||||||
switch( g_KeyPressed )
|
switch( g_KeyPressed )
|
||||||
{
|
{
|
||||||
|
@ -357,26 +337,26 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
|
|
||||||
case WXK_NUMPAD8:
|
case WXK_NUMPAD8:
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
MousePositionInPixels.y -= wxRound( delta.y );
|
pos.y -= wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2:
|
case WXK_NUMPAD2:
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
MousePositionInPixels.y += wxRound( delta.y );
|
pos.y += wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4:
|
case WXK_NUMPAD4:
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
MousePositionInPixels.x -= wxRound( delta.x );
|
pos.x -= wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6:
|
case WXK_NUMPAD6:
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
MousePositionInPixels.x += wxRound( delta.x );
|
pos.x += wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -384,11 +364,8 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the cursor position. */
|
// Update the cursor position.
|
||||||
screen->m_Curseur = curpos;
|
screen->m_Curseur = pos;
|
||||||
|
|
||||||
/* Snap cursor to grid. */
|
|
||||||
PutOnGrid( &(screen->m_Curseur) );
|
|
||||||
|
|
||||||
if( screen->IsRefreshReq() )
|
if( screen->IsRefreshReq() )
|
||||||
{
|
{
|
||||||
|
@ -398,50 +375,41 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
|
|
||||||
if( oldpos != screen->m_Curseur )
|
if( oldpos != screen->m_Curseur )
|
||||||
{
|
{
|
||||||
curpos = screen->m_Curseur;
|
pos = screen->m_Curseur;
|
||||||
screen->m_Curseur = oldpos;
|
screen->m_Curseur = oldpos;
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( aDC );
|
||||||
screen->m_Curseur = curpos;
|
screen->m_Curseur = pos;
|
||||||
DrawPanel->CursorOn( DC );
|
DrawPanel->CursorOn( aDC );
|
||||||
|
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
{
|
{
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
|
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( hotkey )
|
if( hotkey )
|
||||||
{
|
{
|
||||||
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
|
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
|
||||||
OnHotKey( DC, hotkey, screen->GetCurItem() );
|
OnHotKey( aDC, hotkey, screen->GetCurItem() );
|
||||||
else
|
else
|
||||||
OnHotKey( DC, hotkey, NULL );
|
OnHotKey( aDC, hotkey, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_VIEW_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
|
||||||
{
|
{
|
||||||
wxRealPoint delta;
|
wxRealPoint gridSize;
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
wxPoint curpos, oldpos;
|
wxPoint oldpos;
|
||||||
int hotkey = 0;
|
int hotkey = 0;
|
||||||
double scalar = screen->GetScalingFactor();
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
curpos = screen->m_MousePosition;
|
PutOnGrid( &pos );
|
||||||
oldpos = screen->m_Curseur;
|
oldpos = screen->m_Curseur;
|
||||||
|
gridSize = screen->GetGridSize();
|
||||||
delta = screen->GetGridSize();
|
|
||||||
|
|
||||||
delta.x *= scalar;
|
|
||||||
delta.y *= scalar;
|
|
||||||
|
|
||||||
if( delta.x <= 0 )
|
|
||||||
delta.x = 1;
|
|
||||||
if( delta.y <= 0 )
|
|
||||||
delta.y = 1;
|
|
||||||
|
|
||||||
switch( g_KeyPressed )
|
switch( g_KeyPressed )
|
||||||
{
|
{
|
||||||
|
@ -450,26 +418,26 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
|
|
||||||
case WXK_NUMPAD8:
|
case WXK_NUMPAD8:
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
MousePositionInPixels.y -= wxRound( delta.y );
|
pos.y -= wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2:
|
case WXK_NUMPAD2:
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
MousePositionInPixels.y += wxRound( delta.y );
|
pos.y += wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4:
|
case WXK_NUMPAD4:
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
MousePositionInPixels.x -= wxRound( delta.x );
|
pos.x -= wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6:
|
case WXK_NUMPAD6:
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
MousePositionInPixels.x += wxRound( delta.x );
|
pos.x += wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -477,11 +445,8 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update cursor position. */
|
// Update cursor position.
|
||||||
screen->m_Curseur = curpos;
|
screen->m_Curseur = pos;
|
||||||
|
|
||||||
/* Snap cursor to grid. */
|
|
||||||
PutOnGrid( &screen->m_Curseur );
|
|
||||||
|
|
||||||
if( screen->IsRefreshReq() )
|
if( screen->IsRefreshReq() )
|
||||||
{
|
{
|
||||||
|
@ -491,24 +456,24 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
|
|
||||||
if( oldpos != screen->m_Curseur )
|
if( oldpos != screen->m_Curseur )
|
||||||
{
|
{
|
||||||
curpos = screen->m_Curseur;
|
pos = screen->m_Curseur;
|
||||||
screen->m_Curseur = oldpos;
|
screen->m_Curseur = oldpos;
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( aDC );
|
||||||
screen->m_Curseur = curpos;
|
screen->m_Curseur = pos;
|
||||||
DrawPanel->CursorOn( DC );
|
DrawPanel->CursorOn( aDC );
|
||||||
|
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
{
|
{
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
|
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( hotkey )
|
if( hotkey )
|
||||||
{
|
{
|
||||||
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
|
if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
|
||||||
OnHotKey( DC, hotkey, screen->GetCurItem() );
|
OnHotKey( aDC, hotkey, screen->GetCurItem() );
|
||||||
else
|
else
|
||||||
OnHotKey( DC, hotkey, NULL );
|
OnHotKey( aDC, hotkey, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
|
|
|
@ -222,7 +222,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
|
||||||
DrawPanel->CursorOff( &dc );
|
DrawPanel->CursorOff( &dc );
|
||||||
|
|
||||||
if( mouseWarp )
|
if( mouseWarp )
|
||||||
DrawPanel->MouseTo( curpos );
|
DrawPanel->MoveCursor( curpos );
|
||||||
|
|
||||||
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
||||||
|
|
||||||
|
|
|
@ -13,11 +13,14 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
|
||||||
{
|
{
|
||||||
wxRealPoint delta;
|
wxRealPoint gridSize;
|
||||||
wxPoint curpos, oldpos;
|
wxPoint oldpos;
|
||||||
int hotkey = 0;
|
int hotkey = 0;
|
||||||
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
|
PutOnGrid( &pos );
|
||||||
|
|
||||||
if( GetScreen()->IsRefreshReq() )
|
if( GetScreen()->IsRefreshReq() )
|
||||||
{
|
{
|
||||||
|
@ -34,45 +37,33 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double scalar = GetScreen()->GetScalingFactor();
|
|
||||||
|
|
||||||
curpos = DrawPanel->CursorRealPosition( Mouse );
|
|
||||||
oldpos = GetScreen()->m_Curseur;
|
oldpos = GetScreen()->m_Curseur;
|
||||||
|
gridSize = GetScreen()->GetGridSize();
|
||||||
delta = GetScreen()->GetGridSize();
|
|
||||||
|
|
||||||
delta.x *= scalar;
|
|
||||||
delta.y *= scalar;
|
|
||||||
|
|
||||||
if( delta.x == 0 )
|
|
||||||
delta.x = 1;
|
|
||||||
if( delta.y == 0 )
|
|
||||||
delta.y = 1;
|
|
||||||
|
|
||||||
switch( g_KeyPressed )
|
switch( g_KeyPressed )
|
||||||
{
|
{
|
||||||
case WXK_NUMPAD8:
|
case WXK_NUMPAD8:
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
Mouse.y -= wxRound(delta.y);
|
pos.y -= wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2:
|
case WXK_NUMPAD2:
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
Mouse.y += wxRound(delta.y);
|
pos.y += wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4:
|
case WXK_NUMPAD4:
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
Mouse.x -= wxRound(delta.x);
|
pos.x -= wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6:
|
case WXK_NUMPAD6:
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
Mouse.x += wxRound(delta.x);
|
pos.x += wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -80,28 +71,25 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->m_Curseur = curpos;
|
GetScreen()->m_Curseur = pos;
|
||||||
|
|
||||||
PutOnGrid( &GetScreen()->m_Curseur );
|
|
||||||
|
|
||||||
if( oldpos != GetScreen()->m_Curseur )
|
if( oldpos != GetScreen()->m_Curseur )
|
||||||
{
|
{
|
||||||
curpos = GetScreen()->m_Curseur;
|
pos = GetScreen()->m_Curseur;
|
||||||
GetScreen()->m_Curseur = oldpos;
|
GetScreen()->m_Curseur = oldpos;
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( aDC );
|
||||||
|
GetScreen()->m_Curseur = pos;
|
||||||
GetScreen()->m_Curseur = curpos;
|
DrawPanel->CursorOn( aDC );
|
||||||
DrawPanel->CursorOn( DC );
|
|
||||||
|
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
{
|
{
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
|
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( hotkey )
|
if( hotkey )
|
||||||
{
|
{
|
||||||
OnHotKey( DC, hotkey, NULL );
|
OnHotKey( aDC, hotkey, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( GetScreen()->IsRefreshReq() )
|
if( GetScreen()->IsRefreshReq() )
|
||||||
|
|
|
@ -229,7 +229,13 @@ public:
|
||||||
wxPoint GetScreenCenterLogicalPosition();
|
wxPoint GetScreenCenterLogicalPosition();
|
||||||
|
|
||||||
void MouseToCursorSchema();
|
void MouseToCursorSchema();
|
||||||
void MouseTo( const wxPoint& Mouse );
|
|
||||||
|
/**
|
||||||
|
* Function MoveCursor
|
||||||
|
* moves the mouse pointer to \a aPosition in logical (drawing) units.
|
||||||
|
* @param aPosition The position in logical units to move the cursor.
|
||||||
|
*/
|
||||||
|
void MoveCursor( const wxPoint& aPosition );
|
||||||
|
|
||||||
/* Cursor functions */
|
/* Cursor functions */
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -190,9 +190,6 @@ extern UserUnitType g_UserUnit; ///< display units
|
||||||
/* Draw color for moving objects: */
|
/* Draw color for moving objects: */
|
||||||
extern int g_GhostColor;
|
extern int g_GhostColor;
|
||||||
|
|
||||||
/* Current used screen: (not used in eeshema)*/
|
|
||||||
extern BASE_SCREEN* ActiveScreen;
|
|
||||||
|
|
||||||
|
|
||||||
/* COMMON.CPP */
|
/* COMMON.CPP */
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Function PrintPage , virtual
|
* Function PrintPage , virtual
|
||||||
* used to print a page
|
* used to print a page
|
||||||
* Print the page pointed by ActiveScreen, set by the calling print function
|
* Print the page pointed by the current screen, set by the calling print function
|
||||||
* @param aDC = wxDC given by the calling print function
|
* @param aDC = wxDC given by the calling print function
|
||||||
* @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed
|
* @param aPrintMaskLayer = a 32 bits mask: bit n = 1 -> layer n is printed
|
||||||
* @param aPrintMirrorMode = true to plot mirrored
|
* @param aPrintMirrorMode = true to plot mirrored
|
||||||
|
|
|
@ -365,7 +365,18 @@ public:
|
||||||
virtual void OnSelectGrid( wxCommandEvent& event );
|
virtual void OnSelectGrid( wxCommandEvent& event );
|
||||||
virtual void OnSelectZoom( wxCommandEvent& event );
|
virtual void OnSelectZoom( wxCommandEvent& event );
|
||||||
|
|
||||||
virtual void GeneralControle( wxDC* DC, wxPoint Mouse ) { /* dummy */ }
|
/**
|
||||||
|
* Function GeneralControle
|
||||||
|
* performs application specific control using \a aDC at \a aPosition in logical units.
|
||||||
|
* <p>
|
||||||
|
* Override this function for application specific control. This function gets
|
||||||
|
* called on every mouse and key event.
|
||||||
|
*</p>
|
||||||
|
* @param aDC A device context.
|
||||||
|
* @param aPosition The cursor position in logical (drawing) units.
|
||||||
|
*/
|
||||||
|
virtual void GeneralControle( wxDC* aDC, wxPoint aPosition ) { /* dummy */ }
|
||||||
|
|
||||||
virtual void OnSize( wxSizeEvent& event );
|
virtual void OnSize( wxSizeEvent& event );
|
||||||
void OnEraseBackground( wxEraseEvent& SizeEvent );
|
void OnEraseBackground( wxEraseEvent& SizeEvent );
|
||||||
|
|
||||||
|
@ -515,7 +526,7 @@ public:
|
||||||
|
|
||||||
/** Virtual function PrintPage
|
/** Virtual function PrintPage
|
||||||
* used to print a page
|
* used to print a page
|
||||||
* Print the page pointed by ActiveScreen, set by the calling print function
|
* Print the page pointed by current screen, set by the calling print function
|
||||||
* @param aDC = wxDC given by the calling print function
|
* @param aDC = wxDC given by the calling print function
|
||||||
* @param aPrintMask = not used here
|
* @param aPrintMask = not used here
|
||||||
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
|
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
|
||||||
|
|
|
@ -18,15 +18,14 @@
|
||||||
extern bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
|
extern bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
|
||||||
int aCurrentTool, wxSize grid, wxPoint on_grid, wxPoint* curpos );
|
int aCurrentTool, wxSize grid, wxPoint on_grid, wxPoint* curpos );
|
||||||
|
|
||||||
/*************************************************************************************/
|
|
||||||
static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aCollector )
|
|
||||||
/*************************************************************************************/
|
|
||||||
/**
|
/**
|
||||||
* Function AllAreModulesAndReturnSmallestIfSo
|
* Function AllAreModulesAndReturnSmallestIfSo
|
||||||
* tests that all items in the collection are MODULEs and if so, returns the
|
* tests that all items in the collection are MODULEs and if so, returns the
|
||||||
* smallest MODULE.
|
* smallest MODULE.
|
||||||
* @return BOARD_ITEM* - The smallest or NULL.
|
* @return BOARD_ITEM* - The smallest or NULL.
|
||||||
*/
|
*/
|
||||||
|
static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aCollector )
|
||||||
{
|
{
|
||||||
int count = aCollector->GetCount();
|
int count = aCollector->GetCount();
|
||||||
|
|
||||||
|
@ -61,9 +60,7 @@ static BOARD_ITEM* AllAreModulesAndReturnSmallestIfSo( GENERAL_COLLECTOR* aColle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
/****************************************************************************/
|
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item;
|
BOARD_ITEM* item;
|
||||||
|
|
||||||
|
@ -133,6 +130,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
item = (*m_Collector)[ii];
|
item = (*m_Collector)[ii];
|
||||||
|
|
||||||
if( item->Type() != TYPE_ZONE )
|
if( item->Type() != TYPE_ZONE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -151,7 +149,9 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
item = (*m_Collector)[0];
|
item = (*m_Collector)[0];
|
||||||
SetCurItem( item );
|
SetCurItem( item );
|
||||||
}
|
}
|
||||||
// If the count is 2, and first item is a pad or moduletext, and the 2nd item is its parent module:
|
|
||||||
|
// If the count is 2, and first item is a pad or moduletext, and the 2nd item is its
|
||||||
|
// parent module:
|
||||||
else if( m_Collector->GetCount() == 2
|
else if( m_Collector->GetCount() == 2
|
||||||
&& ( (*m_Collector)[0]->Type() == TYPE_PAD || (*m_Collector)[0]->Type() ==
|
&& ( (*m_Collector)[0]->Type() == TYPE_PAD || (*m_Collector)[0]->Type() ==
|
||||||
TYPE_TEXTE_MODULE )
|
TYPE_TEXTE_MODULE )
|
||||||
|
@ -173,12 +173,14 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
|
|
||||||
/* Give a title to the selection menu. This is also a cancel menu item */
|
/* Give a title to the selection menu. This is also a cancel menu item */
|
||||||
wxMenuItem * item_title = new wxMenuItem(&itemMenu, -1, _( "Selection Clarification" ) );
|
wxMenuItem * item_title = new wxMenuItem(&itemMenu, -1, _( "Selection Clarification" ) );
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
wxFont bold_font(*wxNORMAL_FONT);
|
wxFont bold_font(*wxNORMAL_FONT);
|
||||||
bold_font.SetWeight(wxFONTWEIGHT_BOLD);
|
bold_font.SetWeight(wxFONTWEIGHT_BOLD);
|
||||||
bold_font.SetStyle( wxFONTSTYLE_ITALIC);
|
bold_font.SetStyle( wxFONTSTYLE_ITALIC);
|
||||||
item_title->SetFont(bold_font);
|
item_title->SetFont(bold_font);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
itemMenu.Append(item_title);
|
itemMenu.Append(item_title);
|
||||||
itemMenu.AppendSeparator();
|
itemMenu.AppendSeparator();
|
||||||
|
|
||||||
|
@ -197,9 +199,11 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm );
|
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @todo: rather than assignment to TRUE, these should be increment and decrement operators throughout _everywhere_.
|
/* @todo: rather than assignment to TRUE, these should be increment and decrement
|
||||||
|
* operators throughout _everywhere_.
|
||||||
* That way we can handle nesting.
|
* That way we can handle nesting.
|
||||||
* But I tried that and found there cases where the assignment to TRUE (converted to a m_IgnoreMouseEvents++ )
|
* But I tried that and found there cases where the assignment to TRUE (converted to
|
||||||
|
* a m_IgnoreMouseEvents++ )
|
||||||
* was not balanced with the -- (now m_IgnoreMouseEvents=FALSE), so I had to revert.
|
* was not balanced with the -- (now m_IgnoreMouseEvents=FALSE), so I had to revert.
|
||||||
* Somebody should track down these and make them balanced.
|
* Somebody should track down these and make them balanced.
|
||||||
* DrawPanel->m_IgnoreMouseEvents = TRUE;
|
* DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||||
|
@ -222,15 +226,14 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
|
||||||
void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|
||||||
/*****************************************************************/
|
|
||||||
{
|
{
|
||||||
wxRealPoint delta;
|
wxRealPoint gridSize;
|
||||||
wxPoint curpos, oldpos;
|
wxPoint oldpos;
|
||||||
int hotkey = 0;
|
int hotkey = 0;
|
||||||
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
ActiveScreen = GetScreen();
|
PutOnGrid( &pos );
|
||||||
|
|
||||||
// Save the board after the time out :
|
// Save the board after the time out :
|
||||||
int CurrentTime = time( NULL );
|
int CurrentTime = time( NULL );
|
||||||
|
@ -254,50 +257,39 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
OnModify();
|
OnModify();
|
||||||
GetScreen()->SetSave(); // Set the flags m_FlagSave cleared by SetModify()
|
GetScreen()->SetSave(); // Set the flags m_FlagSave cleared by SetModify()
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->SetFileName( tmpFileName );
|
GetScreen()->SetFileName( tmpFileName );
|
||||||
SetTitle( GetScreen()->GetFileName() );
|
SetTitle( GetScreen()->GetFileName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
double scalar = GetScreen()->GetScalingFactor();
|
|
||||||
|
|
||||||
curpos = DrawPanel->CursorRealPosition( Mouse );
|
|
||||||
oldpos = GetScreen()->m_Curseur;
|
oldpos = GetScreen()->m_Curseur;
|
||||||
|
|
||||||
delta = GetScreen()->GetGridSize();
|
gridSize = GetScreen()->GetGridSize();
|
||||||
|
|
||||||
delta.x *= scalar;
|
|
||||||
delta.y *= scalar;
|
|
||||||
|
|
||||||
if( delta.x <= 0 )
|
|
||||||
delta.x = 1;
|
|
||||||
|
|
||||||
if( delta.y <= 0 )
|
|
||||||
delta.y = 1;
|
|
||||||
|
|
||||||
switch( g_KeyPressed )
|
switch( g_KeyPressed )
|
||||||
{
|
{
|
||||||
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
Mouse.y -= wxRound(delta.y);
|
pos.y -= wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
Mouse.y += wxRound(delta.y);
|
pos.y += wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
Mouse.x -= wxRound(delta.x);
|
pos.x -= wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
Mouse.x += wxRound(delta.x);
|
pos.x += wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -305,14 +297,14 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put cursor in new position, according to the zoom keys (if any) */
|
// Put cursor in new position, according to the zoom keys (if any).
|
||||||
GetScreen()->m_Curseur = curpos;
|
GetScreen()->m_Curseur = pos;
|
||||||
|
|
||||||
/* Put cursor on grid or a pad centre if requested
|
/* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the
|
||||||
* But if the tool DELETE is active the cursor is left off grid
|
* cursor is left off grid this is better to reach items to delete off grid,
|
||||||
* this is better to reach items to delete off grid
|
|
||||||
*/
|
*/
|
||||||
bool keep_on_grid = TRUE;
|
bool keep_on_grid = TRUE;
|
||||||
|
|
||||||
if( m_ID_current_state == ID_PCB_DELETE_ITEM_BUTT )
|
if( m_ID_current_state == ID_PCB_DELETE_ITEM_BUTT )
|
||||||
keep_on_grid = FALSE;
|
keep_on_grid = FALSE;
|
||||||
|
|
||||||
|
@ -327,16 +319,16 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
|
|
||||||
if( keep_on_grid )
|
if( keep_on_grid )
|
||||||
{
|
{
|
||||||
wxPoint on_grid = curpos;
|
wxPoint on_grid = pos;
|
||||||
|
|
||||||
PutOnGrid( &on_grid );
|
PutOnGrid( &on_grid );
|
||||||
wxSize grid;
|
wxSize grid;
|
||||||
grid.x = (int) GetScreen()->GetGridSize().x;
|
grid.x = (int) GetScreen()->GetGridSize().x;
|
||||||
grid.y = (int) GetScreen()->GetGridSize().y;
|
grid.y = (int) GetScreen()->GetGridSize().y;
|
||||||
if( Magnetize(m_Pcb, (WinEDA_PcbFrame *) this, m_ID_current_state,
|
|
||||||
grid, on_grid, &curpos) )
|
if( Magnetize( m_Pcb, this, m_ID_current_state, grid, on_grid, &pos ) )
|
||||||
{
|
{
|
||||||
GetScreen()->m_Curseur = curpos;
|
GetScreen()->m_Curseur = pos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -354,21 +346,20 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
|
|
||||||
if( oldpos != GetScreen()->m_Curseur )
|
if( oldpos != GetScreen()->m_Curseur )
|
||||||
{
|
{
|
||||||
curpos = GetScreen()->m_Curseur;
|
pos = GetScreen()->m_Curseur;
|
||||||
GetScreen()->m_Curseur = oldpos;
|
GetScreen()->m_Curseur = oldpos;
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( aDC );
|
||||||
|
GetScreen()->m_Curseur = pos;
|
||||||
GetScreen()->m_Curseur = curpos;
|
DrawPanel->CursorOn( aDC );
|
||||||
DrawPanel->CursorOn( DC );
|
|
||||||
|
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
{
|
{
|
||||||
#ifdef USE_WX_OVERLAY
|
#ifdef USE_WX_OVERLAY
|
||||||
wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)DC );
|
wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC );
|
||||||
oDC.Clear();
|
oDC.Clear();
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, aDC, FALSE );
|
||||||
#else
|
#else
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
|
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef USE_WX_OVERLAY
|
#ifdef USE_WX_OVERLAY
|
||||||
|
@ -379,7 +370,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
|
|
||||||
if( hotkey )
|
if( hotkey )
|
||||||
{
|
{
|
||||||
OnHotKey( DC, hotkey, NULL );
|
OnHotKey( aDC, hotkey, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( GetScreen()->IsRefreshReq() )
|
if( GetScreen()->IsRefreshReq() )
|
||||||
|
|
|
@ -271,9 +271,10 @@ void WinEDA_PcbFrame::Affiche_Status_Net( wxDC* DC )
|
||||||
{
|
{
|
||||||
TRACK* pt_segm;
|
TRACK* pt_segm;
|
||||||
int masquelayer = (1 << getActiveLayer());
|
int masquelayer = (1 << getActiveLayer());
|
||||||
|
wxPoint pos = GetScreen()->RefPos( true );
|
||||||
|
|
||||||
|
pt_segm = Locate_Pistes( GetBoard(), GetBoard()->m_Track, pos, masquelayer );
|
||||||
|
|
||||||
pt_segm = Locate_Pistes( GetBoard(), GetBoard()->m_Track, masquelayer,
|
|
||||||
CURSEUR_OFF_GRILLE );
|
|
||||||
if( pt_segm == NULL )
|
if( pt_segm == NULL )
|
||||||
GetBoard()->DisplayInfo( this );
|
GetBoard()->DisplayInfo( this );
|
||||||
else
|
else
|
||||||
|
|
|
@ -139,8 +139,6 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& aFileName, bool aAppend,
|
||||||
FILE* source;
|
FILE* source;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
ActiveScreen = GetScreen();
|
|
||||||
|
|
||||||
if( GetScreen()->IsModify() && !aAppend )
|
if( GetScreen()->IsModify() && !aAppend )
|
||||||
{
|
{
|
||||||
if( !IsOK( this, _( "The current board has been modified. Do you wish to discard \
|
if( !IsOK( this, _( "The current board has been modified. Do you wish to discard \
|
||||||
|
|
|
@ -32,10 +32,11 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_ITEM* aItem )
|
||||||
if( aHotkeyCode == 0 )
|
if( aHotkeyCode == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
wxPoint pos;
|
||||||
bool itemCurrentlyEdited = (GetCurItem() && GetCurItem()->m_Flags);
|
bool itemCurrentlyEdited = (GetCurItem() && GetCurItem()->m_Flags);
|
||||||
|
|
||||||
MODULE* module = NULL;
|
MODULE* module = NULL;
|
||||||
int evt_type = 0; //Used to post a wxCommandEvent on demand
|
int evt_type = 0; //Used to post a wxCommandEvent on demand
|
||||||
|
PCB_SCREEN* screen = GetScreen();
|
||||||
|
|
||||||
/* Convert lower to upper case
|
/* Convert lower to upper case
|
||||||
* (the usual toupper function has problem with non ascii codes like function keys
|
* (the usual toupper function has problem with non ascii codes like function keys
|
||||||
|
@ -156,8 +157,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_ITEM* aItem )
|
||||||
case HK_REDO:
|
case HK_REDO:
|
||||||
if( !itemCurrentlyEdited )
|
if( !itemCurrentlyEdited )
|
||||||
{
|
{
|
||||||
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED,
|
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
|
||||||
HK_Descr->m_IdMenuEvent );
|
|
||||||
wxPostEvent( this, event );
|
wxPostEvent( this, event );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -318,10 +318,15 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, EDA_ITEM* aItem )
|
||||||
case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status:
|
case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status:
|
||||||
// get any module, locked or not locked and toggle its locked status
|
// get any module, locked or not locked and toggle its locked status
|
||||||
if( !itemCurrentlyEdited )
|
if( !itemCurrentlyEdited )
|
||||||
module = Locate_Prefered_Module( GetBoard(), CURSEUR_OFF_GRILLE
|
{
|
||||||
| VISIBLE_ONLY );
|
pos = screen->RefPos( true );
|
||||||
|
module = Locate_Prefered_Module( GetBoard(), pos, screen->m_Active_Layer, true );
|
||||||
|
}
|
||||||
else if( GetCurItem()->Type() == TYPE_MODULE )
|
else if( GetCurItem()->Type() == TYPE_MODULE )
|
||||||
|
{
|
||||||
module = (MODULE*) GetCurItem();
|
module = (MODULE*) GetCurItem();
|
||||||
|
}
|
||||||
|
|
||||||
if( module )
|
if( module )
|
||||||
{
|
{
|
||||||
SetCurItem( module );
|
SetCurItem( module );
|
||||||
|
@ -400,11 +405,15 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* aDC )
|
||||||
case ID_COMPONENT_BUTT:
|
case ID_COMPONENT_BUTT:
|
||||||
if( ItemFree )
|
if( ItemFree )
|
||||||
{
|
{
|
||||||
MODULE* module = Locate_Prefered_Module( GetBoard(), CURSEUR_ON_GRILLE );
|
wxPoint pos = GetScreen()->RefPos( false );
|
||||||
|
MODULE* module = Locate_Prefered_Module( GetBoard(), pos, ALL_LAYERS, false );
|
||||||
|
|
||||||
if( module == NULL )
|
if( module == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !IsOK( this, _( "Delete module?" ) ) )
|
if( !IsOK( this, _( "Delete module?" ) ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
RemoveStruct( module, aDC );
|
RemoveStruct( module, aDC );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -13,21 +13,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function RefPos
|
|
||||||
* returns the reference position, coming from either the mouse position or the
|
|
||||||
* the cursor position, based on whether the typeloc has the CURSEUR_OFF_GRILLE
|
|
||||||
* flag ORed in or not.
|
|
||||||
* @param typeloc int with possible CURSEUR_OFF_GRILLE bit on.
|
|
||||||
* @return wxPoint - The reference point, either the mouse position or
|
|
||||||
* the cursor position.
|
|
||||||
*/
|
|
||||||
wxPoint inline RefPos( int typeloc )
|
|
||||||
{
|
|
||||||
return ActiveScreen->RefPos( (typeloc & CURSEUR_OFF_GRILLE) != 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Locates a via point pX, pY
|
/* Locates a via point pX, pY
|
||||||
* If layer < 0 will be located via whatever layer
|
* If layer < 0 will be located via whatever layer
|
||||||
* If layer = 0 .. 15 Via will be located according to its type:
|
* If layer = 0 .. 15 Via will be located according to its type:
|
||||||
|
@ -46,12 +31,16 @@ TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer )
|
||||||
{
|
{
|
||||||
if( track->Type() != TYPE_VIA )
|
if( track->Type() != TYPE_VIA )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( track->m_Start != pos )
|
if( track->m_Start != pos )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( track->GetState( BUSY | DELETED ) )
|
if( track->GetState( BUSY | DELETED ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( layer < 0 )
|
if( layer < 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( track->IsOnLayer( layer ) )
|
if( track->IsOnLayer( layer ) )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -68,12 +57,16 @@ TRACK* Locate_Via_Area( TRACK* aStart, const wxPoint& pos, int layer )
|
||||||
{
|
{
|
||||||
if( track->Type() != TYPE_VIA )
|
if( track->Type() != TYPE_VIA )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( !track->HitTest(pos) )
|
if( !track->HitTest(pos) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( track->GetState( BUSY | DELETED ) )
|
if( track->GetState( BUSY | DELETED ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( layer < 0 )
|
if( layer < 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( track->IsOnLayer( layer ) )
|
if( track->IsOnLayer( layer ) )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -109,6 +102,7 @@ D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_piste, int extr )
|
||||||
for( MODULE* module = Pcb->m_Modules; module; module = module->Next() )
|
for( MODULE* module = Pcb->m_Modules; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
ptr_pad = Locate_Pads( module, ref_pos, masque_layer );
|
ptr_pad = Locate_Pads( module, ref_pos, masque_layer );
|
||||||
|
|
||||||
if( ptr_pad != NULL )
|
if( ptr_pad != NULL )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -129,36 +123,19 @@ D_PAD* Locate_Pad_Connecte( BOARD* Pcb, TRACK* ptr_piste, int extr )
|
||||||
*
|
*
|
||||||
* Priority is the active layer
|
* Priority is the active layer
|
||||||
*/
|
*/
|
||||||
D_PAD* Locate_Any_Pad( BOARD* Pcb, int typeloc, bool OnlyCurrentLayer )
|
D_PAD* Locate_Any_Pad( BOARD* Pcb, const wxPoint& ref_pos, int aLayerMask )
|
||||||
{
|
{
|
||||||
wxPoint ref_pos = RefPos( typeloc );
|
D_PAD* pad = NULL;
|
||||||
return Locate_Any_Pad( Pcb, ref_pos, OnlyCurrentLayer );
|
|
||||||
|
for( MODULE* module=Pcb->m_Modules; module && ( pad == NULL ); module = module->Next() )
|
||||||
|
{
|
||||||
|
if( aLayerMask )
|
||||||
|
pad = Locate_Pads( module, ref_pos, aLayerMask );
|
||||||
|
else
|
||||||
|
pad = Locate_Pads( module, ref_pos, ALL_LAYERS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return pad;
|
||||||
D_PAD* Locate_Any_Pad( BOARD* Pcb, const wxPoint& ref_pos,
|
|
||||||
bool OnlyCurrentLayer )
|
|
||||||
{
|
|
||||||
int layer_mask =
|
|
||||||
g_TabOneLayerMask[ ( (PCB_SCREEN*) ActiveScreen )->m_Active_Layer];
|
|
||||||
|
|
||||||
for( MODULE* module=Pcb->m_Modules; module; module = module->Next() )
|
|
||||||
{
|
|
||||||
D_PAD* pt_pad;
|
|
||||||
|
|
||||||
/* First: Search a pad on the active layer: */
|
|
||||||
if( ( pt_pad = Locate_Pads( module, ref_pos, layer_mask ) ) != NULL )
|
|
||||||
return pt_pad;
|
|
||||||
|
|
||||||
/* If not found, search on other layers: */
|
|
||||||
if( !OnlyCurrentLayer )
|
|
||||||
{
|
|
||||||
if( ( pt_pad = Locate_Pads( module, ref_pos, ALL_LAYERS ) ) != NULL )
|
|
||||||
return pt_pad;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,13 +148,6 @@ D_PAD* Locate_Any_Pad( BOARD* Pcb, const wxPoint& ref_pos,
|
||||||
* A pointer to the pad if found
|
* A pointer to the pad if found
|
||||||
* NULL pointer if pad NOT FOUND
|
* NULL pointer if pad NOT FOUND
|
||||||
*/
|
*/
|
||||||
D_PAD* Locate_Pads( MODULE* module, int masque_layer, int typeloc )
|
|
||||||
{
|
|
||||||
wxPoint ref_pos = RefPos( typeloc );
|
|
||||||
return Locate_Pads( module, ref_pos, masque_layer );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int masque_layer )
|
D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int masque_layer )
|
||||||
{
|
{
|
||||||
for( D_PAD* pt_pad = module->m_Pads; pt_pad; pt_pad = pt_pad->Next() )
|
for( D_PAD* pt_pad = module->m_Pads; pt_pad; pt_pad = pt_pad->Next() )
|
||||||
|
@ -204,11 +174,14 @@ D_PAD* Locate_Pads( MODULE* module, const wxPoint& ref_pos, int masque_layer )
|
||||||
* distance is calculated via manhattan distance from the center of the
|
* distance is calculated via manhattan distance from the center of the
|
||||||
* bounding rectangle to the cursor position.
|
* bounding rectangle to the cursor position.
|
||||||
*
|
*
|
||||||
* @param Pcb The BOARD to search within.
|
* @param aPcb The BOARD to search within.
|
||||||
* @param typeloc Flag bits, tuning the search, see pcbnew.h
|
* @param aPosition Flag bits, tuning the search, see pcbnew.h
|
||||||
* @return MODULE* - the best module or NULL if none.
|
* @param aActiveLayer Layer to test.
|
||||||
|
* @param aVisibleOnly Search only the visible layers if true.
|
||||||
|
* @return MODULE* The best module or NULL if none.
|
||||||
*/
|
*/
|
||||||
MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
|
MODULE* Locate_Prefered_Module( BOARD* aPcb, const wxPoint& aPosition, int aActiveLayer,
|
||||||
|
bool aVisibleOnly, bool aIgnoreLocked )
|
||||||
{
|
{
|
||||||
MODULE* pt_module;
|
MODULE* pt_module;
|
||||||
int lx, ly;
|
int lx, ly;
|
||||||
|
@ -217,20 +190,17 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
|
||||||
int min_dim = 0x7FFFFFFF;
|
int min_dim = 0x7FFFFFFF;
|
||||||
int alt_min_dim = 0x7FFFFFFF;
|
int alt_min_dim = 0x7FFFFFFF;
|
||||||
int layer;
|
int layer;
|
||||||
wxPoint ref_pos;
|
|
||||||
|
|
||||||
ref_pos = RefPos( typeloc );
|
pt_module = aPcb->m_Modules;
|
||||||
|
|
||||||
pt_module = Pcb->m_Modules;
|
|
||||||
for( ; pt_module; pt_module = (MODULE*) pt_module->Next() )
|
for( ; pt_module; pt_module = (MODULE*) pt_module->Next() )
|
||||||
{
|
{
|
||||||
// is the ref point within the module's bounds?
|
// is the ref point within the module's bounds?
|
||||||
if( !pt_module->HitTest( ref_pos ) )
|
if( !pt_module->HitTest( aPosition ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if caller wants to ignore locked modules, and this one is locked,
|
// if caller wants to ignore locked modules, and this one is locked, skip it.
|
||||||
// skip it.
|
if( aIgnoreLocked && pt_module->IsLocked() )
|
||||||
if( (typeloc & IGNORE_LOCKED) && pt_module->IsLocked() )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Calculate priority: the priority is given to the layer of the
|
/* Calculate priority: the priority is given to the layer of the
|
||||||
|
@ -242,7 +212,6 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
|
||||||
|
|
||||||
if( layer==ADHESIVE_N_BACK || layer==SILKSCREEN_N_BACK )
|
if( layer==ADHESIVE_N_BACK || layer==SILKSCREEN_N_BACK )
|
||||||
layer = LAYER_N_BACK;
|
layer = LAYER_N_BACK;
|
||||||
|
|
||||||
else if( layer==ADHESIVE_N_FRONT || layer==SILKSCREEN_N_FRONT )
|
else if( layer==ADHESIVE_N_FRONT || layer==SILKSCREEN_N_FRONT )
|
||||||
layer = LAYER_N_FRONT;
|
layer = LAYER_N_FRONT;
|
||||||
|
|
||||||
|
@ -251,17 +220,20 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
|
||||||
int offx = pt_module->m_BoundaryBox.m_Size.x / 2 +
|
int offx = pt_module->m_BoundaryBox.m_Size.x / 2 +
|
||||||
pt_module->m_BoundaryBox.m_Pos.x +
|
pt_module->m_BoundaryBox.m_Pos.x +
|
||||||
pt_module->m_Pos.x;
|
pt_module->m_Pos.x;
|
||||||
|
|
||||||
int offy = pt_module->m_BoundaryBox.m_Size.y / 2
|
int offy = pt_module->m_BoundaryBox.m_Size.y / 2
|
||||||
+ pt_module->m_BoundaryBox.m_Pos.y
|
+ pt_module->m_BoundaryBox.m_Pos.y
|
||||||
+ pt_module->m_Pos.y;
|
+ pt_module->m_Pos.y;
|
||||||
|
|
||||||
//off x & offy point to the middle of the box.
|
//off x & offy point to the middle of the box.
|
||||||
int dist = abs( ref_pos.x - offx ) + abs( ref_pos.y - offy );
|
int dist = abs( aPosition.x - offx ) + abs( aPosition.y - offy );
|
||||||
lx = pt_module->m_BoundaryBox.GetWidth();
|
lx = pt_module->m_BoundaryBox.GetWidth();
|
||||||
ly = pt_module->m_BoundaryBox.GetHeight();
|
ly = pt_module->m_BoundaryBox.GetHeight();
|
||||||
|
|
||||||
//int dist = MIN(lx, ly); // to pick the smallest module (kinda
|
//int dist = MIN(lx, ly); // to pick the smallest module (kinda
|
||||||
// screwy with same-sized modules -- this is bad!)
|
// screwy with same-sized modules -- this is bad!)
|
||||||
|
|
||||||
if( ( (PCB_SCREEN*) ActiveScreen )->m_Active_Layer == layer )
|
if( aActiveLayer == layer )
|
||||||
{
|
{
|
||||||
if( dist <= min_dim )
|
if( dist <= min_dim )
|
||||||
{
|
{
|
||||||
|
@ -270,9 +242,7 @@ MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc )
|
||||||
min_dim = dist;
|
min_dim = dist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !( typeloc & MATCH_LAYER )
|
else if( aVisibleOnly && aPcb->IsModuleLayerVisible( layer ) )
|
||||||
&& ( !( typeloc & VISIBLE_ONLY )
|
|
||||||
|| Pcb->IsModuleLayerVisible( layer ) ) )
|
|
||||||
{
|
{
|
||||||
if( dist <= alt_min_dim )
|
if( dist <= alt_min_dim )
|
||||||
{
|
{
|
||||||
|
@ -338,8 +308,7 @@ int dist;
|
||||||
* @param pt_lim = upper limit for search (can be NULL)
|
* @param pt_lim = upper limit for search (can be NULL)
|
||||||
* @param extr = START or END = end of ref track segment to use in tests
|
* @param extr = START or END = end of ref track segment to use in tests
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
|
TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base, TRACK* pt_lim, int extr )
|
||||||
TRACK* pt_lim, int extr )
|
|
||||||
{
|
{
|
||||||
const int NEIGHTBOUR_COUNT_MAX = 50;
|
const int NEIGHTBOUR_COUNT_MAX = 50;
|
||||||
|
|
||||||
|
@ -367,6 +336,7 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
|
||||||
{
|
{
|
||||||
if( PtSegmN->GetState( BUSY | DELETED ) )
|
if( PtSegmN->GetState( BUSY | DELETED ) )
|
||||||
goto suite;
|
goto suite;
|
||||||
|
|
||||||
if( PtSegmN == PtRefSegm )
|
if( PtSegmN == PtRefSegm )
|
||||||
goto suite;
|
goto suite;
|
||||||
|
|
||||||
|
@ -396,6 +366,7 @@ suite:
|
||||||
{
|
{
|
||||||
if( PtSegmB->GetState( BUSY | DELETED ) )
|
if( PtSegmB->GetState( BUSY | DELETED ) )
|
||||||
goto suite1;
|
goto suite1;
|
||||||
|
|
||||||
if( PtSegmB == PtRefSegm )
|
if( PtSegmB == PtRefSegm )
|
||||||
goto suite1;
|
goto suite1;
|
||||||
|
|
||||||
|
@ -429,12 +400,14 @@ suite1:
|
||||||
{
|
{
|
||||||
if( PtSegmN == pt_lim )
|
if( PtSegmN == pt_lim )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if( PtSegmN == PtRefSegm )
|
if( PtSegmN == PtRefSegm )
|
||||||
{
|
{
|
||||||
if( PtSegmN == pt_lim )
|
if( PtSegmN == pt_lim )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,16 +439,7 @@ suite1:
|
||||||
*
|
*
|
||||||
* The search begins to address start_adresse
|
* The search begins to address start_adresse
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Pistes(BOARD* aPcb, TRACK* start_adresse, int MasqueLayer, int typeloc )
|
TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLayer )
|
||||||
{
|
|
||||||
wxPoint ref_pos = RefPos( typeloc );
|
|
||||||
|
|
||||||
return Locate_Pistes( aPcb, start_adresse, ref_pos, MasqueLayer );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TRACK* Locate_Pistes(BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos,
|
|
||||||
int MasqueLayer )
|
|
||||||
{
|
{
|
||||||
for( TRACK* track = start_adresse; track; track = track->Next() )
|
for( TRACK* track = start_adresse; track; track = track->Next() )
|
||||||
{
|
{
|
||||||
|
@ -510,6 +474,7 @@ TRACK* Locate_Pistes(BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1 - Locate zone area by the mouse.
|
* 1 - Locate zone area by the mouse.
|
||||||
* 2 - Locate zone area by point
|
* 2 - Locate zone area by point
|
||||||
|
@ -519,14 +484,6 @@ TRACK* Locate_Pistes(BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos,
|
||||||
*
|
*
|
||||||
* The search begins to address start_adresse
|
* The search begins to address start_adresse
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Zone( TRACK* start_adresse, int layer, int typeloc )
|
|
||||||
{
|
|
||||||
wxPoint ref_pos = RefPos( typeloc );
|
|
||||||
|
|
||||||
return Locate_Zone( start_adresse, ref_pos, layer );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer )
|
TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer )
|
||||||
{
|
{
|
||||||
for( TRACK* Zone = start_adresse; Zone; Zone = Zone->Next() )
|
for( TRACK* Zone = start_adresse; Zone; Zone = Zone->Next() )
|
||||||
|
@ -552,8 +509,7 @@ TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer )
|
||||||
* Pointer to the structure corresponding descr_pad if pad found
|
* Pointer to the structure corresponding descr_pad if pad found
|
||||||
* (Good position and good layer).
|
* (Good position and good layer).
|
||||||
*/
|
*/
|
||||||
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos,
|
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int masque_layer )
|
||||||
int masque_layer )
|
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<Pcb->GetPadsCount(); ++i )
|
for( unsigned i=0; i<Pcb->GetPadsCount(); ++i )
|
||||||
{
|
{
|
||||||
|
@ -578,8 +534,7 @@ D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos,
|
||||||
* The segments of track marks with the flag are not DELETED or taken
|
* The segments of track marks with the flag are not DELETED or taken
|
||||||
* into account
|
* into account
|
||||||
*/
|
*/
|
||||||
TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr,
|
TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr, const wxPoint& ref_pos, int MaskLayer )
|
||||||
const wxPoint& ref_pos, int MaskLayer )
|
|
||||||
{
|
{
|
||||||
TRACK* PtSegm;
|
TRACK* PtSegm;
|
||||||
|
|
||||||
|
@ -602,6 +557,7 @@ TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr,
|
||||||
return PtSegm;
|
return PtSegm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( PtSegm == end_adr )
|
if( PtSegm == end_adr )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -615,8 +571,7 @@ TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr,
|
||||||
* If end_adr = NULL, end search list
|
* If end_adr = NULL, end search list
|
||||||
* Vias whose parameter has the State or DELETED bit BUSY = 1 are ignored
|
* Vias whose parameter has the State or DELETED bit BUSY = 1 are ignored
|
||||||
*/
|
*/
|
||||||
TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr,
|
TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, const wxPoint& pos, int MaskLayer )
|
||||||
const wxPoint& pos, int MaskLayer )
|
|
||||||
{
|
{
|
||||||
TRACK* PtSegm;
|
TRACK* PtSegm;
|
||||||
|
|
||||||
|
@ -633,6 +588,7 @@ TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( PtSegm == end_adr )
|
if( PtSegm == end_adr )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,8 +100,8 @@ bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track )
|
||||||
* @param curpos The initial position, and what to adjust if a change is needed.
|
* @param curpos The initial position, and what to adjust if a change is needed.
|
||||||
* @return bool - true if the position was adjusted magnetically, else false.
|
* @return bool - true if the position was adjusted magnetically, else false.
|
||||||
*/
|
*/
|
||||||
bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
|
bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame, int aCurrentTool, wxSize grid,
|
||||||
int aCurrentTool, wxSize grid, wxPoint on_grid, wxPoint* curpos )
|
wxPoint on_grid, wxPoint* curpos )
|
||||||
{
|
{
|
||||||
bool doCheckNet = g_MagneticPadOption != capture_always && Drc_On;
|
bool doCheckNet = g_MagneticPadOption != capture_always && Drc_On;
|
||||||
bool doTrack = false;
|
bool doTrack = false;
|
||||||
|
@ -110,6 +110,8 @@ bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
|
||||||
|
|
||||||
TRACK* currTrack = g_CurrentTrackSegment;
|
TRACK* currTrack = g_CurrentTrackSegment;
|
||||||
BOARD_ITEM* currItem = frame->GetCurItem();
|
BOARD_ITEM* currItem = frame->GetCurItem();
|
||||||
|
PCB_SCREEN* screen = frame->GetScreen();
|
||||||
|
wxPoint pos = screen->RefPos( true );
|
||||||
|
|
||||||
// D( printf( "currTrack=%p currItem=%p currTrack->Type()=%d currItem->Type()=%d\n", currTrack, currItem, currTrack ? currTrack->Type() : 0, currItem ? currItem->Type() : 0 ); )
|
// D( printf( "currTrack=%p currItem=%p currTrack->Type()=%d currItem->Type()=%d\n", currTrack, currItem, currTrack ? currTrack->Type() : 0, currItem ? currItem->Type() : 0 ); )
|
||||||
|
|
||||||
|
@ -150,7 +152,8 @@ bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
|
||||||
|
|
||||||
if( doPad )
|
if( doPad )
|
||||||
{
|
{
|
||||||
D_PAD* pad = Locate_Any_Pad( m_Pcb, CURSEUR_OFF_GRILLE, TRUE );
|
D_PAD* pad = Locate_Any_Pad( m_Pcb, pos, screen->m_Active_Layer );
|
||||||
|
|
||||||
if( pad )
|
if( pad )
|
||||||
{
|
{
|
||||||
if( doCheckNet && currTrack && currTrack->GetNet() != pad->GetNet() )
|
if( doCheckNet && currTrack && currTrack->GetNet() != pad->GetNet() )
|
||||||
|
@ -164,7 +167,7 @@ bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
|
||||||
// after pads, only track & via tests remain, skip them if not desired
|
// after pads, only track & via tests remain, skip them if not desired
|
||||||
if( doTrack )
|
if( doTrack )
|
||||||
{
|
{
|
||||||
int layer = ( (PCB_SCREEN*) ActiveScreen )->m_Active_Layer;
|
int layer = screen->m_Active_Layer;
|
||||||
|
|
||||||
for( TRACK* via = m_Pcb->m_Track;
|
for( TRACK* via = m_Pcb->m_Track;
|
||||||
via && (via = Locate_Via_Area( via, *curpos, layer )) != NULL;
|
via && (via = Locate_Via_Area( via, *curpos, layer )) != NULL;
|
||||||
|
@ -189,7 +192,8 @@ bool Magnetize( BOARD* m_Pcb, WinEDA_PcbFrame* frame,
|
||||||
{
|
{
|
||||||
int layer_mask = g_TabOneLayerMask[layer];
|
int layer_mask = g_TabOneLayerMask[layer];
|
||||||
|
|
||||||
TRACK* track = Locate_Pistes( m_Pcb, m_Pcb->m_Track, layer_mask, CURSEUR_OFF_GRILLE );
|
TRACK* track = Locate_Pistes( m_Pcb, m_Pcb->m_Track, pos, layer_mask );
|
||||||
|
|
||||||
if( !track || track->Type() != TYPE_TRACK )
|
if( !track || track->Type() != TYPE_TRACK )
|
||||||
{
|
{
|
||||||
// D(printf("!currTrack and track=%p not found, layer_mask=0x%X\n", track, layer_mask );)
|
// D(printf("!currTrack and track=%p not found, layer_mask=0x%X\n", track, layer_mask );)
|
||||||
|
|
|
@ -176,7 +176,6 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
|
||||||
if( s_screenModule == NULL )
|
if( s_screenModule == NULL )
|
||||||
s_screenModule = new PCB_SCREEN();
|
s_screenModule = new PCB_SCREEN();
|
||||||
SetBaseScreen( s_screenModule );
|
SetBaseScreen( s_screenModule );
|
||||||
ActiveScreen = GetScreen();
|
|
||||||
GetBoard()->SetBoardDesignSettings( &s_ModuleEditorDesignSetting );
|
GetBoard()->SetBoardDesignSettings( &s_ModuleEditorDesignSetting );
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
@ -249,7 +248,6 @@ WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
|
||||||
|
|
||||||
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) GetParent();
|
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) GetParent();
|
||||||
frame->m_ModuleEditFrame = NULL;
|
frame->m_ModuleEditFrame = NULL;
|
||||||
ActiveScreen = frame->GetScreen();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -457,11 +455,12 @@ void WinEDA_ModuleEditFrame::Show3D_Frame( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, wxPoint aPosition )
|
||||||
{
|
{
|
||||||
wxRealPoint delta;
|
wxRealPoint gridSize;
|
||||||
wxPoint curpos, oldpos;
|
wxPoint oldpos;
|
||||||
int hotkey = 0;
|
int hotkey = 0;
|
||||||
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
if( GetScreen()->IsRefreshReq() )
|
if( GetScreen()->IsRefreshReq() )
|
||||||
{
|
{
|
||||||
|
@ -477,45 +476,34 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double scalar = GetScreen()->GetScalingFactor();
|
PutOnGrid( &pos );
|
||||||
|
|
||||||
curpos = DrawPanel->CursorRealPosition( Mouse );
|
|
||||||
oldpos = GetScreen()->m_Curseur;
|
oldpos = GetScreen()->m_Curseur;
|
||||||
|
gridSize = GetScreen()->GetGridSize();
|
||||||
delta = GetScreen()->GetGridSize();
|
|
||||||
|
|
||||||
delta.x *= scalar;
|
|
||||||
delta.y *= scalar;
|
|
||||||
|
|
||||||
if( delta.x == 0 )
|
|
||||||
delta.x = 1;
|
|
||||||
if( delta.y == 0 )
|
|
||||||
delta.y = 1;
|
|
||||||
|
|
||||||
switch( g_KeyPressed )
|
switch( g_KeyPressed )
|
||||||
{
|
{
|
||||||
case WXK_NUMPAD8:
|
case WXK_NUMPAD8:
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
Mouse.y -= wxRound( delta.y );
|
pos.y -= wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2:
|
case WXK_NUMPAD2:
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
Mouse.y += wxRound( delta.y );
|
pos.y += wxRound( gridSize.y );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4:
|
case WXK_NUMPAD4:
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
Mouse.x -= wxRound( delta.x );
|
pos.x -= wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6:
|
case WXK_NUMPAD6:
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
Mouse.x += wxRound( delta.x );
|
pos.x += wxRound( gridSize.x );
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -523,27 +511,25 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->m_Curseur = curpos;
|
GetScreen()->m_Curseur = pos;
|
||||||
PutOnGrid( &GetScreen()->m_Curseur );
|
|
||||||
|
|
||||||
if( oldpos != GetScreen()->m_Curseur )
|
if( oldpos != GetScreen()->m_Curseur )
|
||||||
{
|
{
|
||||||
curpos = GetScreen()->m_Curseur;
|
pos = GetScreen()->m_Curseur;
|
||||||
GetScreen()->m_Curseur = oldpos;
|
GetScreen()->m_Curseur = oldpos;
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( aDC );
|
||||||
|
GetScreen()->m_Curseur = pos;
|
||||||
GetScreen()->m_Curseur = curpos;
|
DrawPanel->CursorOn( aDC );
|
||||||
DrawPanel->CursorOn( DC );
|
|
||||||
|
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
{
|
{
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, true );
|
DrawPanel->ManageCurseur( DrawPanel, aDC, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( hotkey )
|
if( hotkey )
|
||||||
{
|
{
|
||||||
OnHotKey( DC, hotkey, NULL );
|
OnHotKey( aDC, hotkey, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( GetScreen()->IsRefreshReq() )
|
if( GetScreen()->IsRefreshReq() )
|
||||||
|
@ -551,6 +537,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
wxSafeYield();
|
wxSafeYield();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetToolbars();
|
SetToolbars();
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1039,12 +1039,14 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
|
||||||
for( MODULE* module = Pcb->m_Modules; module; module = module->Next() )
|
for( MODULE* module = Pcb->m_Modules; module; module = module->Next() )
|
||||||
{
|
{
|
||||||
D_PAD* pad = Locate_Pads( module, pos, LayerMask );
|
D_PAD* pad = Locate_Pads( module, pos, LayerMask );
|
||||||
|
|
||||||
if( pad )
|
if( pad )
|
||||||
return pad;
|
return pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No pad has been located so check for a segment of the trace. */
|
/* No pad has been located so check for a segment of the trace. */
|
||||||
TRACK* ptsegm = Fast_Locate_Piste( Pcb->m_Track, NULL, pos, LayerMask );
|
TRACK* ptsegm = Fast_Locate_Piste( Pcb->m_Track, NULL, pos, LayerMask );
|
||||||
|
|
||||||
if( ptsegm == NULL )
|
if( ptsegm == NULL )
|
||||||
ptsegm = Locate_Pistes( Pcb, Pcb->m_Track, pos, LayerMask );
|
ptsegm = Locate_Pistes( Pcb, Pcb->m_Track, pos, LayerMask );
|
||||||
|
|
||||||
|
|
|
@ -465,7 +465,6 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
// do not show the window because ScreenPcb will be deleted and we do not
|
// do not show the window because ScreenPcb will be deleted and we do not
|
||||||
// want any paint event
|
// want any paint event
|
||||||
Show( false );
|
Show( false );
|
||||||
ActiveScreen = ScreenPcb;
|
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,6 @@ bool WinEDA_App::OnInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenPcb = new PCB_SCREEN();
|
ScreenPcb = new PCB_SCREEN();
|
||||||
ActiveScreen = ScreenPcb;
|
|
||||||
|
|
||||||
// read current setup and reopen last directory if no filename to open in command line
|
// read current setup and reopen last directory if no filename to open in command line
|
||||||
bool reopenLastUsedDirectory = argc == 1;
|
bool reopenLastUsedDirectory = argc == 1;
|
||||||
|
|
|
@ -106,13 +106,10 @@ void BOARD_PRINTOUT_CONTROLER::GetPageInfo( int* minPage, int* maxPage,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************/
|
|
||||||
void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
|
||||||
/****************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the real print function: print the active screen
|
* This is the real print function: print the active screen
|
||||||
*/
|
*/
|
||||||
|
void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
||||||
{
|
{
|
||||||
int tmpzoom;
|
int tmpzoom;
|
||||||
wxPoint tmp_startvisu;
|
wxPoint tmp_startvisu;
|
||||||
|
@ -122,21 +119,21 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
||||||
double userscale;
|
double userscale;
|
||||||
double DrawZoom = 1;
|
double DrawZoom = 1;
|
||||||
wxDC* dc = GetDC();
|
wxDC* dc = GetDC();
|
||||||
|
BASE_SCREEN* screen = m_Parent->GetBaseScreen();
|
||||||
bool printMirror = m_PrintParams.m_PrintMirror;
|
bool printMirror = m_PrintParams.m_PrintMirror;
|
||||||
|
|
||||||
wxBusyCursor dummy;
|
wxBusyCursor dummy;
|
||||||
|
|
||||||
/* Save old draw scale and draw offset */
|
/* Save old draw scale and draw offset */
|
||||||
tmp_startvisu = ActiveScreen->m_StartVisu;
|
tmp_startvisu = screen->m_StartVisu;
|
||||||
tmpzoom = ActiveScreen->GetZoom();
|
tmpzoom = screen->GetZoom();
|
||||||
old_org = ActiveScreen->m_DrawOrg;
|
old_org = screen->m_DrawOrg;
|
||||||
/* Change draw scale and offset to draw the whole page */
|
/* Change draw scale and offset to draw the whole page */
|
||||||
ActiveScreen->SetScalingFactor( DrawZoom );
|
screen->SetScalingFactor( DrawZoom );
|
||||||
ActiveScreen->m_DrawOrg.x = ActiveScreen->m_DrawOrg.y = 0;
|
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
|
||||||
ActiveScreen->m_StartVisu.x = ActiveScreen->m_StartVisu.y = 0;
|
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
|
||||||
|
|
||||||
SheetSize = ActiveScreen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
|
SheetSize = screen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
|
||||||
SheetSize.x *= m_Parent->m_InternalUnits / 1000;
|
SheetSize.x *= m_Parent->m_InternalUnits / 1000;
|
||||||
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in internal units
|
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in internal units
|
||||||
|
|
||||||
|
@ -153,8 +150,10 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
||||||
mv_offset.y = SheetSize.y / 2;
|
mv_offset.y = SheetSize.y / 2;
|
||||||
brd_BBox.Move( mv_offset );
|
brd_BBox.Move( mv_offset );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute the PCB size in internal units*/
|
/* Compute the PCB size in internal units*/
|
||||||
userscale = m_PrintParams.m_PrintScale;
|
userscale = m_PrintParams.m_PrintScale;
|
||||||
|
|
||||||
if( userscale == 0 ) // fit in page
|
if( userscale == 0 ) // fit in page
|
||||||
{
|
{
|
||||||
int extra_margin = 4000*2; // Margin = 4000 units pcb = 0.4 inch
|
int extra_margin = 4000*2; // Margin = 4000 units pcb = 0.4 inch
|
||||||
|
@ -228,7 +227,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
||||||
DrawOffset.y -= PlotAreaSizeInUserUnits.y / 2;
|
DrawOffset.y -= PlotAreaSizeInUserUnits.y / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveScreen->m_DrawOrg = DrawOffset;
|
screen->m_DrawOrg = DrawOffset;
|
||||||
|
|
||||||
GRResetPenAndBrush( dc );
|
GRResetPenAndBrush( dc );
|
||||||
if( m_PrintParams.m_Print_Black_and_White )
|
if( m_PrintParams.m_Print_Black_and_White )
|
||||||
|
@ -248,7 +247,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
||||||
int bg_color = g_DrawBgColor;
|
int bg_color = g_DrawBgColor;
|
||||||
|
|
||||||
if( m_PrintParams.m_Print_Sheet_Ref )
|
if( m_PrintParams.m_Print_Sheet_Ref )
|
||||||
m_Parent->TraceWorkSheet( dc, ActiveScreen, m_PrintParams.m_PenDefaultSize );
|
m_Parent->TraceWorkSheet( dc, screen, m_PrintParams.m_PenDefaultSize );
|
||||||
|
|
||||||
if( printMirror )
|
if( printMirror )
|
||||||
{
|
{
|
||||||
|
@ -279,7 +278,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
||||||
if( userscale <= 1.0 )
|
if( userscale <= 1.0 )
|
||||||
DrawOffset.y += pcb_centre.y - (ysize / 2);
|
DrawOffset.y += pcb_centre.y - (ysize / 2);
|
||||||
|
|
||||||
dc->SetLogicalOrigin( ActiveScreen->m_DrawOrg.x, ActiveScreen->m_DrawOrg.y );
|
dc->SetLogicalOrigin( screen->m_DrawOrg.x, screen->m_DrawOrg.y );
|
||||||
panel->m_ClipBox.SetOrigin( wxPoint( -MAX_VALUE/2, -MAX_VALUE/2 ) );
|
panel->m_ClipBox.SetOrigin( wxPoint( -MAX_VALUE/2, -MAX_VALUE/2 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +305,7 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
|
||||||
|
|
||||||
GRForceBlackPen( false );
|
GRForceBlackPen( false );
|
||||||
|
|
||||||
ActiveScreen->m_StartVisu = tmp_startvisu;
|
screen->m_StartVisu = tmp_startvisu;
|
||||||
ActiveScreen->m_DrawOrg = old_org;
|
screen->m_DrawOrg = old_org;
|
||||||
ActiveScreen->SetZoom( tmpzoom );
|
screen->SetZoom( tmpzoom );
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,16 +77,13 @@ TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer = -1 );
|
||||||
* @param aLayer The layer to match, pass -1 for a don't care.
|
* @param aLayer The layer to match, pass -1 for a don't care.
|
||||||
* @return TRACK* - actually a SEGVIA* if found, else NULL.
|
* @return TRACK* - actually a SEGVIA* if found, else NULL.
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Via_Area( TRACK* aStart,
|
TRACK* Locate_Via_Area( TRACK* aStart, const wxPoint& aPos, int aLayer = ALL_LAYERS );
|
||||||
const wxPoint& aPos,
|
|
||||||
int aLayer = -1 );
|
|
||||||
|
|
||||||
/* Locates the center through the point x, y, on layer data
|
/* Locates the center through the point x, y, on layer data
|
||||||
* by masquelayer.
|
* by masquelayer.
|
||||||
* Search is done to address start_adr has end_adr (not included)
|
* Search is done to address start_adr has end_adr (not included)
|
||||||
*/
|
*/
|
||||||
TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr,
|
TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, const wxPoint& pos, int masquelayer );
|
||||||
const wxPoint& pos, int masquelayer );
|
|
||||||
|
|
||||||
/* Locates the center through the point x, y, on layer data
|
/* Locates the center through the point x, y, on layer data
|
||||||
* by masquelayer.
|
* by masquelayer.
|
||||||
|
@ -102,8 +99,7 @@ TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr,
|
||||||
* The search is done only on the ends of segments
|
* The search is done only on the ends of segments
|
||||||
* The search is limited to the area [... pt_base] pt_lim.
|
* The search is limited to the area [... pt_base] pt_lim.
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Piste_Connectee( TRACK* ptr_piste, TRACK* pt_base,
|
TRACK* Locate_Piste_Connectee( TRACK* ptr_piste, TRACK* pt_base, TRACK* pt_lim, int extr );
|
||||||
TRACK* pt_lim, int extr );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1 - Locate segment of track leading from the mouse.
|
* 1 - Locate segment of track leading from the mouse.
|
||||||
|
@ -114,9 +110,7 @@ TRACK* Locate_Piste_Connectee( TRACK* ptr_piste, TRACK* pt_base,
|
||||||
*
|
*
|
||||||
* The search begins to address start_adresse
|
* The search begins to address start_adresse
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse, int layer, int typeloc );
|
TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos, int layer );
|
||||||
TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse,
|
|
||||||
const wxPoint& ref_pos, int layer );
|
|
||||||
|
|
||||||
/* Locate pad connected to the beginning or end of a segment
|
/* Locate pad connected to the beginning or end of a segment
|
||||||
* Input: pointer to the segment, and flag = START or END
|
* Input: pointer to the segment, and flag = START or END
|
||||||
|
@ -126,7 +120,6 @@ TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse,
|
||||||
*/
|
*/
|
||||||
D_PAD* Locate_Pad_Connecte( BOARD* aPcb, TRACK* ptr_segment, int extr );
|
D_PAD* Locate_Pad_Connecte( BOARD* aPcb, TRACK* ptr_segment, int extr );
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Locate pad pointed to by the coordinate ref_pX,, ref_pY or the current
|
* Locate pad pointed to by the coordinate ref_pX,, ref_pY or the current
|
||||||
* cursor position, search done on all tracks.
|
* cursor position, search done on all tracks.
|
||||||
|
@ -137,12 +130,7 @@ D_PAD* Locate_Pad_Connecte( BOARD* aPcb, TRACK* ptr_segment, int extr );
|
||||||
* Pointer to the pad if found
|
* Pointer to the pad if found
|
||||||
* NULL pointer if pad not found
|
* NULL pointer if pad not found
|
||||||
*/
|
*/
|
||||||
D_PAD* Locate_Any_Pad( BOARD* aPcb,
|
D_PAD* Locate_Any_Pad( BOARD* aPcb, const wxPoint& aPosition, int aLayerMask = ALL_LAYERS );
|
||||||
int typeloc,
|
|
||||||
bool OnlyCurrentLayer = FALSE );
|
|
||||||
D_PAD* Locate_Any_Pad( BOARD* aPcb,
|
|
||||||
const wxPoint& ref_pos,
|
|
||||||
bool OnlyCurrentLayer = FALSE );
|
|
||||||
|
|
||||||
/* Locate pad pointed to by the coordinate ref_pX,, ref_pY or the cursor
|
/* Locate pad pointed to by the coordinate ref_pX,, ref_pY or the cursor
|
||||||
* position of the current footprint.
|
* position of the current footprint.
|
||||||
|
@ -152,11 +140,11 @@ D_PAD* Locate_Any_Pad( BOARD* aPcb,
|
||||||
* Returns:
|
* Returns:
|
||||||
* A pointer to the pad if found otherwise NULL.
|
* A pointer to the pad if found otherwise NULL.
|
||||||
*/
|
*/
|
||||||
D_PAD* Locate_Pads( MODULE* Module, int layer, int typeloc );
|
|
||||||
D_PAD* Locate_Pads( MODULE* Module, const wxPoint& ref_pos, int layer );
|
D_PAD* Locate_Pads( MODULE* Module, const wxPoint& ref_pos, int layer );
|
||||||
|
|
||||||
/* Locate a footprint by its bounding rectangle. */
|
/* Locate a footprint by its bounding rectangle. */
|
||||||
MODULE* Locate_Prefered_Module( BOARD* Pcb, int typeloc );
|
MODULE* Locate_Prefered_Module( BOARD* aPcb, const wxPoint& aPosition, int aActiveLayer,
|
||||||
|
bool aVisibleOnly, bool aIgnoreLocked = false );
|
||||||
|
|
||||||
/* Locate a pad pointed to by the cursor on the footprint.
|
/* Locate a pad pointed to by the cursor on the footprint.
|
||||||
* Module.
|
* Module.
|
||||||
|
@ -181,9 +169,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc );
|
||||||
* Returns:
|
* Returns:
|
||||||
* Pointer to the pad if found, otherwise NULL.
|
* Pointer to the pad if found, otherwise NULL.
|
||||||
*/
|
*/
|
||||||
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb,
|
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int layer );
|
||||||
const wxPoint& ref_pos,
|
|
||||||
int layer );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1 - Locate trace segment at the current cursor position.
|
* 1 - Locate trace segment at the current cursor position.
|
||||||
|
@ -193,10 +179,7 @@ D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb,
|
||||||
*
|
*
|
||||||
* The search begins to address start_adresse
|
* The search begins to address start_adresse
|
||||||
*/
|
*/
|
||||||
TRACK* Locate_Zone( TRACK* start_adresse, int layer, int typeloc );
|
TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer );
|
||||||
TRACK* Locate_Zone( TRACK* start_adresse,
|
|
||||||
const wxPoint& ref_pos,
|
|
||||||
int layer );
|
|
||||||
|
|
||||||
|
|
||||||
/*************/
|
/*************/
|
||||||
|
|
|
@ -1230,19 +1230,17 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
|
||||||
int dx0, dy0, dx1, dy1;
|
int dx0, dy0, dx1, dy1;
|
||||||
int marge, via_marge;
|
int marge, via_marge;
|
||||||
EDA_DRAW_PANEL* panel = pcbframe->DrawPanel;
|
EDA_DRAW_PANEL* panel = pcbframe->DrawPanel;
|
||||||
|
PCB_SCREEN* screen = pcbframe->GetScreen();
|
||||||
|
|
||||||
marge = s_Clearance +
|
marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 );
|
||||||
( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 );
|
|
||||||
via_marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentViaSize() / 2 );
|
via_marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentViaSize() / 2 );
|
||||||
|
|
||||||
dx1 = g_CurrentTrackSegment->m_End.x - g_CurrentTrackSegment->m_Start.x;
|
dx1 = g_CurrentTrackSegment->m_End.x - g_CurrentTrackSegment->m_Start.x;
|
||||||
dy1 = g_CurrentTrackSegment->m_End.y - g_CurrentTrackSegment->m_Start.y;
|
dy1 = g_CurrentTrackSegment->m_End.y - g_CurrentTrackSegment->m_Start.y;
|
||||||
|
|
||||||
/* Place on center of pad if off grid. */
|
/* Place on center of pad if off grid. */
|
||||||
dx0 = pt_cur_ch->m_PadStart->GetPosition().x -
|
dx0 = pt_cur_ch->m_PadStart->GetPosition().x - g_CurrentTrackSegment->m_Start.x;
|
||||||
g_CurrentTrackSegment->m_Start.x;
|
dy0 = pt_cur_ch->m_PadStart->GetPosition().y - g_CurrentTrackSegment->m_Start.y;
|
||||||
dy0 = pt_cur_ch->m_PadStart->GetPosition().y -
|
|
||||||
g_CurrentTrackSegment->m_Start.y;
|
|
||||||
|
|
||||||
/* If aligned, change the origin point. */
|
/* If aligned, change the origin point. */
|
||||||
if( abs( dx0 * dy1 ) == abs( dx1 * dy0 ) )
|
if( abs( dx0 * dy1 ) == abs( dx1 * dy0 ) )
|
||||||
|
@ -1259,13 +1257,15 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
|
||||||
g_CurrentTrackList.PushBack( newTrack );
|
g_CurrentTrackList.PushBack( newTrack );
|
||||||
}
|
}
|
||||||
|
|
||||||
g_FirstTrackSegment->start = Locate_Pad_Connecte(
|
g_FirstTrackSegment->start = Locate_Pad_Connecte( pcbframe->GetBoard(),
|
||||||
pcbframe->GetBoard(), g_FirstTrackSegment, START );
|
g_FirstTrackSegment, START );
|
||||||
|
|
||||||
if( g_FirstTrackSegment->start )
|
if( g_FirstTrackSegment->start )
|
||||||
g_FirstTrackSegment->SetState( BEGIN_ONPAD, ON );
|
g_FirstTrackSegment->SetState( BEGIN_ONPAD, ON );
|
||||||
|
|
||||||
g_CurrentTrackSegment->end = Locate_Pad_Connecte(
|
g_CurrentTrackSegment->end = Locate_Pad_Connecte( pcbframe->GetBoard(),
|
||||||
pcbframe->GetBoard(), g_CurrentTrackSegment, END );
|
g_CurrentTrackSegment, END );
|
||||||
|
|
||||||
if( g_CurrentTrackSegment->end )
|
if( g_CurrentTrackSegment->end )
|
||||||
g_CurrentTrackSegment->SetState( END_ONPAD, ON );
|
g_CurrentTrackSegment->SetState( END_ONPAD, ON );
|
||||||
|
|
||||||
|
@ -1284,8 +1284,7 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
|
||||||
|
|
||||||
// Put entire new current segment list in BOARD
|
// Put entire new current segment list in BOARD
|
||||||
TRACK* track;
|
TRACK* track;
|
||||||
TRACK* insertBeforeMe =
|
TRACK* insertBeforeMe = g_CurrentTrackSegment->GetBestInsertPoint( pcbframe->GetBoard() );
|
||||||
g_CurrentTrackSegment->GetBestInsertPoint( pcbframe->GetBoard() );
|
|
||||||
|
|
||||||
while( ( track = g_CurrentTrackList.PopFront() ) != NULL )
|
while( ( track = g_CurrentTrackList.PopFront() ) != NULL )
|
||||||
{
|
{
|
||||||
|
@ -1296,5 +1295,5 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
|
||||||
|
|
||||||
pcbframe->test_1_net_connexion( DC, netcode );
|
pcbframe->test_1_net_connexion( DC, netcode );
|
||||||
|
|
||||||
ActiveScreen->SetModify();
|
screen->SetModify();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
if( !GetBoard() || !screen )
|
if( !GetBoard() || !screen )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ActiveScreen = screen;
|
|
||||||
GRSetDrawMode( DC, GR_COPY );
|
GRSetDrawMode( DC, GR_COPY );
|
||||||
|
|
||||||
DrawPanel->DrawBackGround( DC );
|
DrawPanel->DrawBackGround( DC );
|
||||||
|
@ -82,7 +81,6 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
if( !GetBoard() || !screen )
|
if( !GetBoard() || !screen )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ActiveScreen = screen;
|
|
||||||
GRSetDrawMode( DC, GR_COPY );
|
GRSetDrawMode( DC, GR_COPY );
|
||||||
|
|
||||||
DrawPanel->DrawBackGround( DC );
|
DrawPanel->DrawBackGround( DC );
|
||||||
|
|
Loading…
Reference in New Issue