Draw panel object refactoring and other minor code cleaning.

* Rename all member variables and methods that reference the cross hair
  code in draw panel object from cursor to cross hair to eliminate confusion
  between the two concepts.
* Rename cursor capture call backs in draw panel object to improve code
  readability.
* Create helper class for turning off the cross hair while drawing.
* Remove redundant block clear code.
* Remove redundant mouse capture call back reset code when end capture
  call back is called.
* Remove unused function definitions in base draw frame object.
* Lots of minor coding policy and doxygen comment fixes.
This commit is contained in:
Wayne Stambaugh 2011-02-11 15:48:13 -05:00
parent 25fe492022
commit 7b8b51b240
110 changed files with 1218 additions and 1307 deletions

View File

@ -47,15 +47,15 @@ void BASE_SCREEN::InitDatas()
{ {
if( m_Center ) if( m_Center )
{ {
m_Curseur.x = m_Curseur.y = 0; m_crossHairPosition.x = m_crossHairPosition.y = 0;
m_DrawOrg.x = -ReturnPageSize().x / 2; m_DrawOrg.x = -ReturnPageSize().x / 2;
m_DrawOrg.y = -ReturnPageSize().y / 2; m_DrawOrg.y = -ReturnPageSize().y / 2;
} }
else else
{ {
m_DrawOrg.x = m_DrawOrg.y = 0; m_DrawOrg.x = m_DrawOrg.y = 0;
m_Curseur.x = ReturnPageSize().x / 2; m_crossHairPosition.x = ReturnPageSize().x / 2;
m_Curseur.y = ReturnPageSize().y / 2; m_crossHairPosition.y = ReturnPageSize().y / 2;
} }
m_O_Curseur.x = m_O_Curseur.y = 0; m_O_Curseur.x = m_O_Curseur.y = 0;
@ -417,15 +417,15 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoi
wxPoint BASE_SCREEN::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize ) wxPoint BASE_SCREEN::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize )
{ {
if( aOnGrid ) if( aOnGrid )
return GetNearestGridPosition( m_Curseur, aGridSize ); return GetNearestGridPosition( m_crossHairPosition, aGridSize );
return m_Curseur; return m_crossHairPosition;
} }
wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const
{ {
wxPoint pos = m_Curseur - m_DrawOrg; wxPoint pos = m_crossHairPosition - m_DrawOrg;
double scalar = GetScalingFactor(); double scalar = GetScalingFactor();
pos.x = wxRound( (double) pos.x * scalar ); pos.x = wxRound( (double) pos.x * scalar );
@ -434,6 +434,14 @@ wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const
return pos; return pos;
} }
void BASE_SCREEN::SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid )
{
if( aSnapToGrid )
m_crossHairPosition = GetNearestGridPosition( aPosition );
else
m_crossHairPosition = aPosition;
}
/* free the undo and the redo lists /* free the undo and the redo lists
*/ */

View File

@ -124,8 +124,7 @@ void BLOCK_SELECTOR::InitData( EDA_DRAW_PANEL* aPanel, const wxPoint& startpos )
SetOrigin( startpos ); SetOrigin( startpos );
SetSize( wxSize( 0, 0 ) ); SetSize( wxSize( 0, 0 ) );
m_ItemsSelection.ClearItemsList(); m_ItemsSelection.ClearItemsList();
aPanel->ManageCurseur = DrawAndSizingBlockOutlines; aPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
aPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
} }
@ -164,6 +163,7 @@ void BLOCK_SELECTOR::Clear()
{ {
if( m_Command != BLOCK_IDLE ) if( m_Command != BLOCK_IDLE )
{ {
m_Flags = 0;
m_Command = BLOCK_IDLE; m_Command = BLOCK_IDLE;
m_State = STATE_NO_BLOCK; m_State = STATE_NO_BLOCK;
ClearItemsList(); ClearItemsList();
@ -216,20 +216,20 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
{ {
DisplayError( this, wxT( "No Block to paste" ), 20 ); DisplayError( this, wxT( "No Block to paste" ), 20 );
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL; DrawPanel->m_mouseCaptureCallback = NULL;
return true; return true;
} }
if( DrawPanel->ManageCurseur == NULL ) if( !DrawPanel->IsMouseCaptured() )
{ {
Block->m_ItemsSelection.ClearItemsList(); Block->m_ItemsSelection.ClearItemsList();
DisplayError( this, DisplayError( this,
wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: ManageCurseur NULL" ) ); wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
return true; return true;
} }
Block->m_State = STATE_BLOCK_MOVE; Block->m_State = STATE_BLOCK_MOVE;
DrawPanel->ManageCurseur( DrawPanel, DC, startpos, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, startpos, false );
break; break;
default: default:
@ -265,8 +265,8 @@ void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoin
if( aErase ) if( aErase )
PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color ); PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
PtBlock->m_BlockLastCursorPosition = aPanel->GetScreen()->m_Curseur; PtBlock->m_BlockLastCursorPosition = aPanel->GetScreen()->GetCrossHairPosition();
PtBlock->SetEnd( aPanel->GetScreen()->m_Curseur ); PtBlock->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() );
PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color ); PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
@ -286,12 +286,11 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
{ {
BASE_SCREEN* screen = Panel->GetScreen(); BASE_SCREEN* screen = Panel->GetScreen();
if( Panel->ManageCurseur ) /* Erase current drawing if( Panel->IsMouseCaptured() ) /* Erase current drawing on screen */
* on screen */
{ {
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, false ); /* Clear block outline. */ /* Clear block outline. */
Panel->ManageCurseur = NULL; Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false );
Panel->ForceCloseManageCurseur = NULL; Panel->SetMouseCapture( NULL, NULL );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
/* Delete the picked wrapper if this is a picked list. */ /* Delete the picked wrapper if this is a picked list. */
@ -301,7 +300,6 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
screen->m_BlockLocate.m_Flags = 0; screen->m_BlockLocate.m_Flags = 0;
screen->m_BlockLocate.m_State = STATE_NO_BLOCK; screen->m_BlockLocate.m_State = STATE_NO_BLOCK;
screen->m_BlockLocate.m_Command = BLOCK_ABORT; screen->m_BlockLocate.m_Command = BLOCK_ABORT;
Panel->GetParent()->HandleBlockEnd( DC ); Panel->GetParent()->HandleBlockEnd( DC );

View File

@ -33,7 +33,7 @@ void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event )
if( GetScreen()->IsBlockActive() ) if( GetScreen()->IsBlockActive() )
DrawPanel->SetCursor( wxCursor( DrawPanel->GetDefaultCursor() ) ); DrawPanel->SetCursor( wxCursor( DrawPanel->GetDefaultCursor() ) );
DrawPanel->UnManageCursor(); DrawPanel->EndMouseCapture();
} }
} }

View File

@ -127,15 +127,6 @@ EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
} }
/*
* Display the message in the first pane of the status bar.
*/
void EDA_DRAW_FRAME::Affiche_Message( const wxString& message )
{
SetStatusText( message, 0 );
}
void EDA_DRAW_FRAME::EraseMsgBox() void EDA_DRAW_FRAME::EraseMsgBox()
{ {
if( MsgPanel ) if( MsgPanel )
@ -193,10 +184,9 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
* because EDA_DRAW_FRAME does not know how to print a page * because EDA_DRAW_FRAME does not know how to print a page
* This is the reason it is a virtual function * This is the reason it is a virtual function
*/ */
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,int aPrintMask, void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,int aPrintMask, bool aPrintMirrorMode, void* aData )
bool aPrintMirrorMode, void* aData )
{ {
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error")); wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
} }
@ -256,7 +246,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
* index returned by GetSelection(). * index returned by GetSelection().
*/ */
m_LastGridSizeId = id - ID_POPUP_GRID_LEVEL_1000; m_LastGridSizeId = id - ID_POPUP_GRID_LEVEL_1000;
screen->m_Curseur = DrawPanel->GetScreenCenterLogicalPosition(); screen->SetCrossHairPosition( DrawPanel->GetScreenCenterLogicalPosition() );
screen->SetGrid( id ); screen->SetGrid( id );
Refresh(); Refresh();
} }
@ -292,15 +282,14 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
if( GetScreen()->GetZoom() == selectedZoom ) if( GetScreen()->GetZoom() == selectedZoom )
return; return;
GetScreen()->m_Curseur = DrawPanel->GetScreenCenterLogicalPosition();
GetScreen()->SetZoom( selectedZoom ); GetScreen()->SetZoom( selectedZoom );
RedrawScreen( false ); RedrawScreen( GetScreen()->GetScrollCenterPosition(), false );
} }
} }
/* Return the current zoom level */ /* Return the current zoom level */
int EDA_DRAW_FRAME::GetZoom(void) int EDA_DRAW_FRAME::GetZoom( void )
{ {
return GetScreen()->GetZoom(); return GetScreen()->GetZoom();
} }
@ -469,7 +458,7 @@ int EDA_DRAW_FRAME::ReturnBlockCommand( int key )
void EDA_DRAW_FRAME::InitBlockPasteInfos() void EDA_DRAW_FRAME::InitBlockPasteInfos()
{ {
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
DrawPanel->ManageCurseur = NULL; DrawPanel->m_mouseCaptureCallback = NULL;
} }
@ -484,7 +473,7 @@ bool EDA_DRAW_FRAME::HandleBlockEnd( wxDC* DC )
} }
void EDA_DRAW_FRAME::AdjustScrollBars() void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
{ {
int unitsX, unitsY, posX, posY; int unitsX, unitsY, posX, posY;
wxSize drawingSize, clientSize; wxSize drawingSize, clientSize;
@ -537,8 +526,9 @@ void EDA_DRAW_FRAME::AdjustScrollBars()
unitsY = wxRound( (double) drawingSize.y * scalar ); unitsY = wxRound( (double) drawingSize.y * scalar );
// Calculate the position, place the cursor at the center of screen. // Calculate the position, place the cursor at the center of screen.
posX = screen->m_Curseur.x - screen->m_DrawOrg.x; screen->SetScrollCenterPosition( aCenterPosition );
posY = screen->m_Curseur.y - screen->m_DrawOrg.y; posX = aCenterPosition.x - screen->m_DrawOrg.x;
posY = aCenterPosition.y - screen->m_DrawOrg.y;
posX -= wxRound( (double) clientSize.x / 2.0 ); posX -= wxRound( (double) clientSize.x / 2.0 );
posY -= wxRound( (double) clientSize.y / 2.0 ); posY -= wxRound( (double) clientSize.y / 2.0 );
@ -612,6 +602,7 @@ double RoundTo0( double x, double precision )
return (double) ix / precision; return (double) ix / precision;
} }
/** /**
* Function UpdateStatusBar * Function UpdateStatusBar
* Displays in the bottom of the main window a stust: * Displays in the bottom of the main window a stust:
@ -639,8 +630,8 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
SetStatusText( Line, 1 ); SetStatusText( Line, 1 );
/* Display absolute coordinates: */ /* Display absolute coordinates: */
double dXpos = To_User_Unit( g_UserUnit, screen->m_Curseur.x, m_InternalUnits ); double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x, m_InternalUnits );
double dYpos = To_User_Unit( g_UserUnit, screen->m_Curseur.y, m_InternalUnits ); double dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y, m_InternalUnits );
/* /*
* Converting from inches to mm can give some coordinates due to * Converting from inches to mm can give some coordinates due to
@ -694,8 +685,8 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
SetStatusText( Line, 2 ); SetStatusText( Line, 2 );
/* Display relative coordinates: */ /* Display relative coordinates: */
dx = screen->m_Curseur.x - screen->m_O_Curseur.x; dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->m_Curseur.y - screen->m_O_Curseur.y; dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx, m_InternalUnits ); dXpos = To_User_Unit( g_UserUnit, dx, m_InternalUnits );
dYpos = To_User_Unit( g_UserUnit, dy, m_InternalUnits ); dYpos = To_User_Unit( g_UserUnit, dy, m_InternalUnits );
@ -710,6 +701,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
SetStatusText( Line, 3 ); SetStatusText( Line, 3 );
} }
/** /**
* Load draw frame specific configuration settings. * Load draw frame specific configuration settings.
* *

View File

@ -32,14 +32,6 @@
#define KICAD_TRACE_COORDS wxT( "kicad_dump_coords" ) #define KICAD_TRACE_COORDS wxT( "kicad_dump_coords" )
/* Used to inhibit a response to a mouse left button release, after a
* double click (when releasing the left button at the end of the second
* click. Used in eeschema to inhibit a mouse left release command when
* switching between hierarchical sheets on a double click.
*/
static bool s_IgnoreNextLeftButtonRelease = false;
// Events used by EDA_DRAW_PANEL // Events used by EDA_DRAW_PANEL
BEGIN_EVENT_TABLE( EDA_DRAW_PANEL, wxScrolledWindow ) BEGIN_EVENT_TABLE( EDA_DRAW_PANEL, wxScrolledWindow )
EVT_LEAVE_WINDOW( EDA_DRAW_PANEL::OnMouseLeaving ) EVT_LEAVE_WINDOW( EDA_DRAW_PANEL::OnMouseLeaving )
@ -82,8 +74,8 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_AutoPAN_Enable = true; m_AutoPAN_Enable = true;
m_IgnoreMouseEvents = 0; m_IgnoreMouseEvents = 0;
ManageCurseur = NULL; m_mouseCaptureCallback = NULL;
ForceCloseManageCurseur = NULL; m_endMouseCaptureCallback = NULL;
if( wxGetApp().m_EDA_Config ) if( wxGetApp().m_EDA_Config )
wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable, true ); wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ), &m_AutoPAN_Enable, true );
@ -124,12 +116,12 @@ BASE_SCREEN* EDA_DRAW_PANEL::GetScreen()
} }
void EDA_DRAW_PANEL::DrawCursor( wxDC* aDC, int aColor ) void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, int aColor )
{ {
if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair ) if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair )
return; return;
wxPoint Cursor = GetScreen()->m_Curseur; wxPoint Cursor = GetScreen()->GetCrossHairPosition();
GRSetDrawMode( aDC, GR_XOR ); GRSetDrawMode( aDC, GR_XOR );
@ -155,17 +147,17 @@ void EDA_DRAW_PANEL::DrawCursor( wxDC* aDC, int aColor )
} }
void EDA_DRAW_PANEL::CursorOff( wxDC* DC ) void EDA_DRAW_PANEL::CrossHairOff( wxDC* DC )
{ {
DrawCursor( DC ); DrawCrossHair( DC );
--m_cursorLevel; --m_cursorLevel;
} }
void EDA_DRAW_PANEL::CursorOn( wxDC* DC ) void EDA_DRAW_PANEL::CrossHairOn( wxDC* DC )
{ {
++m_cursorLevel; ++m_cursorLevel;
DrawCursor( DC ); DrawCrossHair( DC );
if( m_cursorLevel > 0 ) // Shouldn't happen, but just in case .. if( m_cursorLevel > 0 ) // Shouldn't happen, but just in case ..
m_cursorLevel = 0; m_cursorLevel = 0;
@ -237,9 +229,9 @@ wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition()
} }
void EDA_DRAW_PANEL::MouseToCursorSchema() void EDA_DRAW_PANEL::MoveCursorToCrossHair()
{ {
MoveCursor( GetScreen()->m_Curseur ); MoveCursor( GetScreen()->GetCrossHairPosition() );
} }
@ -260,7 +252,8 @@ void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition )
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( "MoveCursor() initial screen position(%d, %d) " ) \ wxLogTrace( KICAD_TRACE_COORDS,
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 );
@ -277,7 +270,8 @@ void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition )
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( "MoveCursor() scrolled screen position(%d, %d) view(%d, %d)" ), wxLogTrace( KICAD_TRACE_COORDS,
wxT( "MoveCursor() scrolled screen position(%d, %d) view(%d, %d)" ),
screenPos.x, screenPos.y, x, y ); screenPos.x, screenPos.y, x, y );
} }
@ -567,7 +561,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE ) if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE )
return; return;
GetParent()->PutOnGrid( &org, &gridSize ); org = screen->GetNearestGridPosition( org, &gridSize );
// Setting the nearest grid position can select grid points outside the clip box. // Setting the nearest grid position can select grid points outside the clip box.
// Incrementing the start point by one grid step should prevent drawing grid points // Incrementing the start point by one grid step should prevent drawing grid points
@ -730,7 +724,7 @@ bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event )
pos = event.GetPosition(); pos = event.GetPosition();
m_IgnoreMouseEvents = true; m_IgnoreMouseEvents = true;
PopupMenu( &MasterMenu, pos ); PopupMenu( &MasterMenu, pos );
MouseToCursorSchema(); MoveCursorToCrossHair();
m_IgnoreMouseEvents = false; m_IgnoreMouseEvents = false;
return true; return true;
@ -739,7 +733,7 @@ bool EDA_DRAW_PANEL::OnRightClick( wxMouseEvent& event )
void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event ) void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
{ {
if( ManageCurseur == NULL ) // No command in progress. if( m_mouseCaptureCallback == NULL ) // No command in progress.
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents ) if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents )
@ -778,7 +772,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
} }
INSTALL_UNBUFFERED_DC( dc, this ); INSTALL_UNBUFFERED_DC( dc, this );
GetScreen()->m_Curseur = event.GetLogicalPosition( dc ); GetScreen()->SetCrossHairPosition( event.GetLogicalPosition( dc ) );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
@ -810,9 +804,16 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{ {
/* Used to inhibit a response to a mouse left button release, after a double click
* (when releasing the left button at the end of the second click. Used in eeschema
* to inhibit a mouse left release command when switching between hierarchical sheets
* on a double click.
*/
static bool ignoreNextLeftButtonRelease = false;
static EDA_DRAW_PANEL* LastPanel = NULL;
int localrealbutt = 0, localbutt = 0, localkey = 0; int localrealbutt = 0, localbutt = 0, localkey = 0;
BASE_SCREEN* screen = GetScreen(); BASE_SCREEN* screen = GetScreen();
static EDA_DRAW_PANEL* LastPanel;
if( !screen ) if( !screen )
return; return;
@ -835,7 +836,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
m_CanStartBlock = -1; m_CanStartBlock = -1;
} }
if( ManageCurseur == NULL ) // No command in progress if( !IsMouseCaptured() ) // No mouse capture in progress.
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
if( GetParent()->m_FrameIsActive ) if( GetParent()->m_FrameIsActive )
@ -906,16 +907,16 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// inhibit a response to the mouse left button release, // inhibit a response to the mouse left button release,
// because we have a double click, and we do not want a new // because we have a double click, and we do not want a new
// OnLeftClick command at end of this Double Click // OnLeftClick command at end of this Double Click
s_IgnoreNextLeftButtonRelease = true; ignoreNextLeftButtonRelease = true;
} }
else if( event.LeftUp() ) else if( event.LeftUp() )
{ {
// A block command is in progress: a left up is the end of block // A block command is in progress: a left up is the end of block
// or this is the end of a double click, already seen // or this is the end of a double click, already seen
if( screen->m_BlockLocate.m_State==STATE_NO_BLOCK && !s_IgnoreNextLeftButtonRelease ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK && !ignoreNextLeftButtonRelease )
GetParent()->OnLeftClick( &DC, screen->m_MousePosition ); GetParent()->OnLeftClick( &DC, screen->m_MousePosition );
s_IgnoreNextLeftButtonRelease = false; ignoreNextLeftButtonRelease = false;
} }
if( !event.LeftIsDown() ) if( !event.LeftIsDown() )
@ -925,7 +926,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
* double click opens a dialog box, and the release mouse button * double click opens a dialog box, and the release mouse button
* is made when the dialog box is open. * is made when the dialog box is open.
*/ */
s_IgnoreNextLeftButtonRelease = false; ignoreNextLeftButtonRelease = false;
} }
if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK) ) if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK) )
@ -969,7 +970,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
* (a filter creates a delay for the real block command start, and * (a filter creates a delay for the real block command start, and
* we must remember this point) * we must remember this point)
*/ */
m_CursorStartPos = screen->m_Curseur; m_CursorStartPos = screen->GetCrossHairPosition();
} }
if( m_Block_Enable && !(localbutt & GR_M_DCLICK) ) if( m_Block_Enable && !(localbutt & GR_M_DCLICK) )
@ -985,13 +986,12 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{ {
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
GetParent()->HandleBlockPlace( &DC ); GetParent()->HandleBlockPlace( &DC );
s_IgnoreNextLeftButtonRelease = true; ignoreNextLeftButtonRelease = true;
} }
} }
else if( ( m_CanStartBlock >= 0 ) else if( ( m_CanStartBlock >= 0 )
&& ( event.LeftIsDown() || event.MiddleIsDown() ) && ( event.LeftIsDown() || event.MiddleIsDown() )
&& ManageCurseur == NULL && !IsMouseCaptured() )
&& ForceCloseManageCurseur == NULL )
{ {
// Mouse is dragging: if no block in progress, start a block command. // Mouse is dragging: if no block in progress, start a block command.
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
@ -1041,9 +1041,9 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
if( (screen->m_BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall ) if( (screen->m_BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall )
{ {
if( ForceCloseManageCurseur ) if( m_endMouseCaptureCallback )
{ {
ForceCloseManageCurseur( this, &DC ); m_endMouseCaptureCallback( this, &DC );
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
} }
@ -1068,13 +1068,9 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// To avoid an unwanted block move command if the mouse is moved while double clicking // To avoid an unwanted block move command if the mouse is moved while double clicking
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) ) if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
{ {
if( !screen->IsBlockActive() ) if( !screen->IsBlockActive() && IsMouseCaptured() )
{ {
if( ForceCloseManageCurseur ) m_endMouseCaptureCallback( this, &DC );
{
ForceCloseManageCurseur( this, &DC );
m_AutoPAN_Request = false;
}
} }
} }
@ -1111,10 +1107,10 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
case WXK_ESCAPE: case WXK_ESCAPE:
m_AbortRequest = true; m_AbortRequest = true;
if( ManageCurseur && ForceCloseManageCurseur ) if( IsMouseCaptured() )
UnManageCursor( -1, m_defaultCursor ); EndMouseCapture( -1, m_defaultCursor );
else else
UnManageCursor( 0, m_cursor, wxEmptyString ); EndMouseCapture( 0, m_cursor, wxEmptyString );
break; break;
} }
@ -1207,14 +1203,14 @@ void EDA_DRAW_PANEL::OnPan( wxCommandEvent& event )
} }
void EDA_DRAW_PANEL::UnManageCursor( int id, int cursor, const wxString& title ) void EDA_DRAW_PANEL::EndMouseCapture( int id, int cursor, const wxString& title )
{ {
if( ManageCurseur && ForceCloseManageCurseur ) if( m_mouseCaptureCallback && m_endMouseCaptureCallback )
{ {
INSTALL_UNBUFFERED_DC( dc, this ); INSTALL_UNBUFFERED_DC( dc, this );
ForceCloseManageCurseur( this, &dc ); m_endMouseCaptureCallback( this, &dc );
ManageCurseur = NULL; m_mouseCaptureCallback = NULL;
ForceCloseManageCurseur = NULL; m_endMouseCaptureCallback = NULL;
m_AutoPAN_Request = false; m_AutoPAN_Request = false;
} }

View File

@ -56,7 +56,7 @@ void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC )
{ {
SCH_SCREEN* screen = aFrame->GetScreen(); SCH_SCREEN* screen = aFrame->GetScreen();
if( m_Flags & IS_NEW ) if( IsNew() )
{ {
if( !screen->CheckIfOnDrawList( this ) ) // don't want a loop! if( !screen->CheckIfOnDrawList( this ) ) // don't want a loop!
screen->AddToDrawList( this ); screen->AddToDrawList( this );
@ -68,14 +68,12 @@ void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC )
m_Flags = 0; m_Flags = 0;
screen->SetModify(); screen->SetModify();
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
aFrame->DrawPanel->ManageCurseur = NULL; aFrame->DrawPanel->SetMouseCapture( NULL, NULL );
aFrame->DrawPanel->ForceCloseManageCurseur = NULL;
if( aDC ) if( aDC )
{ {
aFrame->DrawPanel->CursorOff( aDC ); // Erase schematic cursor EDA_CROSS_HAIR_MANAGER( aFrame->DrawPanel, aDC ); // Erase schematic cursor
Draw( aFrame->DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); Draw( aFrame->DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
aFrame->DrawPanel->CursorOn( aDC ); // Display schematic cursor
} }
} }

View File

@ -18,15 +18,13 @@
#include "hotkeys_basic.h" #include "hotkeys_basic.h"
void EDA_DRAW_FRAME::RedrawScreen( bool aWarpPointer ) void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer )
{ {
AdjustScrollBars( aCenterPoint );
PutOnGrid( &(GetScreen()->m_Curseur) );
AdjustScrollBars();
#if !defined(__WXMAC__) #if !defined(__WXMAC__)
/* DrawPanel->Refresh() is not used here because the redraw is delayed and the mouse /* DrawPanel->Refresh() is not used here because the redraw is delayed and the mouse
* events (from MouseToCursorSchema ot others) during this delay create problems: the * events (from MoveCursorToCrossHair ot others) during this delay create problems: the
* mouse cursor position is false in calculations. TODO: see exactly how the mouse * mouse cursor position is false in calculations. TODO: see exactly how the mouse
* creates problems when moving during refresh use Refresh() and update() do not change * creates problems when moving during refresh use Refresh() and update() do not change
* problems * problems
@ -41,29 +39,17 @@ void EDA_DRAW_FRAME::RedrawScreen( bool aWarpPointer )
/* Move the mouse cursor to the on grid graphic cursor position */ /* Move the mouse cursor to the on grid graphic cursor position */
if( aWarpPointer ) if( aWarpPointer )
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
} }
/** Adjust the coordinate to the nearest grid value
* @param aCoord = coordinate to adjust
* @param aGridSize = pointer to a grid value. if NULL uses the current grid size
*/
void EDA_DRAW_FRAME::PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize )
{
wxCHECK_RET( aCoord != NULL, wxT( "Cannot pull NULL coordinate pointer on grid." ) );
*aCoord = GetScreen()->GetNearestGridPosition( *aCoord, aGridSize );
}
/** Redraw the screen with best zoom level and the best centering /** Redraw the screen with best zoom level and the best centering
* that shows all the page or the board * that shows all the page or the board
*/ */
void EDA_DRAW_FRAME::Zoom_Automatique( bool move_mouse_cursor ) void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
{ {
GetScreen()->SetZoom( BestZoom() ); // Set the best zoom GetScreen()->SetZoom( BestZoom() ); // Set the best zoom and get center point.
RedrawScreen( move_mouse_cursor ); // Set the best centering and refresh the screen RedrawScreen( GetScreen()->GetScrollCenterPosition(), aWarpPointer );
} }
@ -86,8 +72,7 @@ void EDA_DRAW_FRAME::Window_Zoom( EDA_Rect& Rect )
bestscale = MAX( bestscale, scalex ); bestscale = MAX( bestscale, scalex );
GetScreen()->SetScalingFactor( bestscale ); GetScreen()->SetScalingFactor( bestscale );
GetScreen()->m_Curseur = Rect.Centre(); RedrawScreen( Rect.Centre(), true );
RedrawScreen( TRUE );
} }
@ -104,31 +89,29 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
int id = event.GetId(); int id = event.GetId();
bool zoom_at_cursor = false; bool zoom_at_cursor = false;
BASE_SCREEN* screen = GetScreen(); BASE_SCREEN* screen = GetScreen();
wxPoint center = screen->GetScrollCenterPosition();
switch( id ) switch( id )
{ {
case ID_POPUP_ZOOM_IN: case ID_POPUP_ZOOM_IN:
zoom_at_cursor = true; zoom_at_cursor = true;
center = screen->GetCrossHairPosition();
// fall thru // fall thru
case ID_ZOOM_IN: case ID_ZOOM_IN:
if( id == ID_ZOOM_IN )
screen->m_Curseur = DrawPanel->GetScreenCenterLogicalPosition();
if( screen->SetPreviousZoom() ) if( screen->SetPreviousZoom() )
RedrawScreen( zoom_at_cursor ); RedrawScreen( center, zoom_at_cursor );
break; break;
case ID_POPUP_ZOOM_OUT: case ID_POPUP_ZOOM_OUT:
zoom_at_cursor = true; zoom_at_cursor = true;
center = screen->GetCrossHairPosition();
// fall thru // fall thru
case ID_ZOOM_OUT: case ID_ZOOM_OUT:
if( id == ID_ZOOM_OUT )
screen->m_Curseur = DrawPanel->GetScreenCenterLogicalPosition();
if( screen->SetNextZoom() ) if( screen->SetNextZoom() )
RedrawScreen( zoom_at_cursor ); RedrawScreen( center, zoom_at_cursor );
break; break;
case ID_ZOOM_REDRAW: case ID_ZOOM_REDRAW:
@ -136,7 +119,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
break; break;
case ID_POPUP_ZOOM_CENTER: case ID_POPUP_ZOOM_CENTER:
RedrawScreen( true ); RedrawScreen( center, true );
break; break;
case ID_ZOOM_PAGE: case ID_ZOOM_PAGE:
@ -147,7 +130,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
break; break;
case ID_POPUP_CANCEL: case ID_POPUP_CANCEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
default: default:
@ -160,7 +143,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
return; return;
} }
if( screen->SetZoom( screen->m_ZoomList[i] ) ) if( screen->SetZoom( screen->m_ZoomList[i] ) )
RedrawScreen( true ); RedrawScreen( center, true );
} }
UpdateStatusBar(); UpdateStatusBar();
@ -207,8 +190,7 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
screen->m_ZoomList[i] / screen->m_ZoomScalar ); screen->m_ZoomList[i] / screen->m_ZoomScalar );
else else
msg.Printf( wxT( "%.1f" ), msg.Printf( wxT( "%.1f" ),
(float) screen->m_ZoomList[i] / (float) screen->m_ZoomList[i] / screen->m_ZoomScalar );
screen->m_ZoomScalar );
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg, zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
wxEmptyString, wxITEM_CHECK ); wxEmptyString, wxITEM_CHECK );

View File

@ -351,7 +351,7 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD: case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message( wxEmptyString ); SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id ); DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
UpdateStatusBar(); UpdateStatusBar();
break; break;
@ -399,8 +399,8 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
PutOnGrid( &pos ); GetScreen()->SetCrossHairPosition( pos );
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize(); gridSize = GetScreen()->GetGridSize();
switch( g_KeyPressed ) switch( g_KeyPressed )
@ -409,14 +409,14 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
cmd.SetId( ID_POPUP_ZOOM_IN ); cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2; flagcurseur = 2;
pos = GetScreen()->m_Curseur; pos = GetScreen()->GetCrossHairPosition();
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;
pos = GetScreen()->m_Curseur; pos = GetScreen()->GetCrossHairPosition();
break; break;
case WXK_F3: case WXK_F3:
@ -429,18 +429,18 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
cmd.SetId( ID_POPUP_ZOOM_CENTER ); cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2; flagcurseur = 2;
pos = GetScreen()->m_Curseur; pos = GetScreen()->GetCrossHairPosition();
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;
pos = GetScreen()->m_Curseur; pos = GetScreen()->GetCrossHairPosition();
break; break;
case ' ': case ' ':
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
break; break;
case WXK_NUMPAD8: /* cursor moved up */ case WXK_NUMPAD8: /* cursor moved up */
@ -468,7 +468,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
break; break;
} }
GetScreen()->m_Curseur = pos; GetScreen()->SetCrossHairPosition( pos );
if( GetScreen()->IsRefreshReq() ) if( GetScreen()->IsRefreshReq() )
{ {
@ -476,20 +476,20 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
Refresh(); Refresh();
} }
if( oldpos != GetScreen()->m_Curseur ) if( oldpos != GetScreen()->GetCrossHairPosition() )
{ {
if( flagcurseur != 2 ) if( flagcurseur != 2 )
{ {
pos = GetScreen()->m_Curseur; pos = GetScreen()->GetCrossHairPosition();
GetScreen()->m_Curseur = oldpos; GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->CursorOff( aDC ); DrawPanel->CrossHairOff( aDC );
GetScreen()->m_Curseur = pos; GetScreen()->SetCrossHairPosition( pos );
DrawPanel->CursorOn( aDC ); DrawPanel->CrossHairOn( aDC );
} }
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, 0 ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, 0 );
} }
} }

View File

@ -492,8 +492,7 @@ void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event ) void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
{ {
CreateScreenCmp(); CreateScreenCmp();
DrawFrame->AdjustScrollBars(); DrawFrame->RedrawScreen( wxPoint( 0, 0 ), false );
DrawFrame->RedrawScreen( FALSE );
} }

View File

@ -100,7 +100,7 @@ void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if ( Module ) if ( Module )
Module->DisplayInfo( this ); Module->DisplayInfo( this );
DrawPanel->DrawCursor( DC ); DrawPanel->DrawCrossHair( DC );
} }

View File

@ -88,7 +88,7 @@ void SCH_EDIT_FRAME::InitBlockPasteInfos()
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
block->m_ItemsSelection.CopyList( m_blockItems.m_ItemsSelection ); block->m_ItemsSelection.CopyList( m_blockItems.m_ItemsSelection );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
} }
@ -102,10 +102,10 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
bool err = false; bool err = false;
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
if( DrawPanel->ManageCurseur == NULL ) if( !DrawPanel->IsMouseCaptured() )
{ {
err = true; err = true;
DisplayError( this, wxT( "HandleBlockPLace() : ManageCurseur = NULL" ) ); DisplayError( this, wxT( "HandleBlockPLace() : m_mouseCaptureCallback = NULL" ) );
} }
if( block->GetCount() == 0 ) if( block->GetCount() == 0 )
@ -130,8 +130,8 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
SaveCopyInUndoList( block->m_ItemsSelection, UR_MOVED, block->m_MoveVector ); SaveCopyInUndoList( block->m_ItemsSelection, UR_MOVED, block->m_MoveVector );
MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector ); MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector );
@ -140,8 +140,8 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DuplicateItemsInList( GetScreen(), block->m_ItemsSelection, block->m_MoveVector ); DuplicateItemsInList( GetScreen(), block->m_ItemsSelection, block->m_MoveVector );
@ -152,8 +152,9 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
break; break;
case BLOCK_PASTE: case BLOCK_PASTE:
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
PasteListOfItems( DC ); PasteListOfItems( DC );
block->ClearItemsList(); block->ClearItemsList();
break; break;
@ -171,14 +172,8 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
// clear struct.m_Flags. // clear struct.m_Flags.
GetScreen()->ClearDrawingState(); GetScreen()->ClearDrawingState();
GetScreen()->ClearBlockCommand();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
block->m_Flags = 0;
block->m_State = STATE_NO_BLOCK;
block->m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds( DrawPanel, DC ); GetScreen()->TestDanglingEnds( DrawPanel, DC );
if( block->GetCount() ) if( block->GetCount() )
@ -187,6 +182,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
block->ClearItemsList(); block->ClearItemsList();
} }
DrawPanel->SetMouseCapture( NULL, NULL );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
@ -213,20 +209,19 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
BlockState state = block->m_State; BlockState state = block->m_State;
CmdBlockType command = block->m_Command; CmdBlockType command = block->m_Command;
if( DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->m_endMouseCaptureCallback )
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC ); DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC );
block->m_State = state; block->m_State = state;
block->m_Command = command; block->m_Command = command;
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines; DrawPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand; GetScreen()->SetCrossHairPosition( block->GetEnd() );
GetScreen()->m_Curseur = block->GetEnd();
if( block->m_Command != BLOCK_ABORT ) if( block->m_Command != BLOCK_ABORT )
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
} }
if( DrawPanel->ManageCurseur != NULL ) if( DrawPanel->IsMouseCaptured() )
{ {
switch( block->m_Command ) switch( block->m_Command )
{ {
@ -251,16 +246,15 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{ {
nextcmd = true; nextcmd = true;
GetScreen()->SelectBlockItems(); GetScreen()->SelectBlockItems();
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
block->m_State = STATE_BLOCK_MOVE; block->m_State = STATE_BLOCK_MOVE;
} }
else else
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
} }
break; break;
@ -321,9 +315,8 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
block->m_Flags = 0; block->m_Flags = 0;
block->m_State = STATE_NO_BLOCK; block->m_State = STATE_NO_BLOCK;
block->m_Command = BLOCK_IDLE; block->m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
DrawPanel->SetMouseCapture( NULL, NULL );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
} }
@ -370,8 +363,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
break; break;
case BLOCK_DRAG: /* move to Drag */ case BLOCK_DRAG: /* move to Drag */
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
// Clear list of items to move, and rebuild it with items to drag: // Clear list of items to move, and rebuild it with items to drag:
block->ClearItemsList(); block->ClearItemsList();
@ -384,16 +377,16 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
blockCmdFinished = false; blockCmdFinished = false;
GetScreen()->SelectBlockItems(); GetScreen()->SelectBlockItems();
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
block->m_State = STATE_BLOCK_MOVE; block->m_State = STATE_BLOCK_MOVE;
} }
break; break;
case BLOCK_DELETE: /* move to Delete */ case BLOCK_DELETE: /* move to Delete */
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
@ -406,8 +399,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
break; break;
case BLOCK_SAVE: /* Save list in paste buffer*/ case BLOCK_SAVE: /* Save list in paste buffer*/
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
@ -418,20 +411,21 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
break; break;
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: /* Window Zoom */
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC ); DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC );
DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() ); DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() );
Window_Zoom( GetScreen()->m_BlockLocate ); Window_Zoom( GetScreen()->m_BlockLocate );
break; break;
case BLOCK_ROTATE: case BLOCK_ROTATE:
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
/* Compute the rotation center and put it on grid */ /* Compute the rotation center and put it on grid */
wxPoint rotationPoint = block->Centre(); wxPoint rotationPoint = block->Centre();
PutOnGrid( &rotationPoint ); GetScreen()->SetCrossHairPosition( rotationPoint );
SaveCopyInUndoList( block->m_ItemsSelection, UR_ROTATED, rotationPoint ); SaveCopyInUndoList( block->m_ItemsSelection, UR_ROTATED, rotationPoint );
RotateListOfItems( block->m_ItemsSelection, rotationPoint ); RotateListOfItems( block->m_ItemsSelection, rotationPoint );
OnModify(); OnModify();
@ -442,14 +436,14 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
break; break;
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
/* Compute the mirror center and put it on grid */ /* Compute the mirror center and put it on grid */
wxPoint mirrorPoint = block->Centre(); wxPoint mirrorPoint = block->Centre();
PutOnGrid( &mirrorPoint ); GetScreen()->SetCrossHairPosition( mirrorPoint );
SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_X, mirrorPoint ); SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_X, mirrorPoint );
Mirror_X_ListOfItems( block->m_ItemsSelection, mirrorPoint ); Mirror_X_ListOfItems( block->m_ItemsSelection, mirrorPoint );
OnModify(); OnModify();
@ -459,14 +453,14 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
break; break;
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
/* Compute the mirror center and put it on grid */ /* Compute the mirror center and put it on grid */
wxPoint mirrorPoint = block->Centre(); wxPoint mirrorPoint = block->Centre();
PutOnGrid( &mirrorPoint ); GetScreen()->SetCrossHairPosition( mirrorPoint );
SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_Y, mirrorPoint ); SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_Y, mirrorPoint );
MirrorListOfItems( block->m_ItemsSelection, mirrorPoint ); MirrorListOfItems( block->m_ItemsSelection, mirrorPoint );
OnModify(); OnModify();
@ -482,13 +476,9 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
if( blockCmdFinished ) if( blockCmdFinished )
{ {
block->ClearItemsList(); block->Clear();
block->m_Flags = 0;
block->m_State = STATE_NO_BLOCK;
block->m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
DrawPanel->SetMouseCapture( NULL, NULL );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
} }
} }
@ -517,7 +507,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
} }
/* Repaint new view. */ /* Repaint new view. */
block->m_MoveVector = screen->m_Curseur - block->m_BlockLastCursorPosition; block->m_MoveVector = screen->GetCrossHairPosition() - block->m_BlockLastCursorPosition;
block->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, block->m_Color ); block->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, block->m_Color );
for( unsigned ii = 0; ii < block->GetCount(); ii++ ) for( unsigned ii = 0; ii < block->GetCount(); ii++ )

View File

@ -80,14 +80,13 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{ {
BlockState state = GetScreen()->m_BlockLocate.m_State; BlockState state = GetScreen()->m_BlockLocate.m_State;
CmdBlockType command = GetScreen()->m_BlockLocate.m_Command; CmdBlockType command = GetScreen()->m_BlockLocate.m_Command;
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC ); DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC );
GetScreen()->m_BlockLocate.m_State = state; GetScreen()->m_BlockLocate.m_State = state;
GetScreen()->m_BlockLocate.m_Command = command; GetScreen()->m_BlockLocate.m_Command = command;
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines; DrawPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand; GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
GetScreen()->m_Curseur.x = GetScreen()->m_BlockLocate.GetRight(); GetScreen()->m_BlockLocate.GetBottom() ) );
GetScreen()->m_Curseur.y = GetScreen()->m_BlockLocate.GetBottom(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->MouseToCursorSchema();
} }
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.m_Command )
@ -106,12 +105,14 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( ItemCount ) if( ItemCount )
{ {
nextCmd = true; nextCmd = true;
if( DrawPanel->ManageCurseur != NULL )
if( DrawPanel->IsMouseCaptured() )
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( true ); DrawPanel->Refresh( true );
} }
@ -119,7 +120,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
nextCmd = true; nextCmd = true;
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
break; break;
@ -174,21 +175,18 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( ! nextCmd ) if( ! nextCmd )
{ {
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY ) if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY && m_component )
if ( m_component ) m_component->ClearSelectedItems();
m_component->ClearSelectedItems();
GetScreen()->m_BlockLocate.m_Flags = 0; GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
DrawPanel->SetMouseCapture( NULL, NULL );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
DrawPanel->Refresh( true ); DrawPanel->Refresh( true );
} }
return nextCmd; return nextCmd;
} }
@ -204,10 +202,10 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
bool err = false; bool err = false;
wxPoint pt; wxPoint pt;
if( DrawPanel->ManageCurseur == NULL ) if( !DrawPanel->IsMouseCaptured() )
{ {
err = true; err = true;
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) ); DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
@ -265,14 +263,12 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
OnModify(); OnModify();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->m_BlockLocate.m_Flags = 0; GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->Refresh( true ); DrawPanel->Refresh( true );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
} }
@ -309,8 +305,7 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
} }
/* Repaint new view */ /* Repaint new view */
PtBlock->m_MoveVector.x = screen->m_Curseur.x - PtBlock->m_BlockLastCursorPosition.x; PtBlock->m_MoveVector = screen->GetCrossHairPosition() - PtBlock->m_BlockLastCursorPosition;
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
GRSetDrawMode( aDC, g_XorMode ); GRSetDrawMode( aDC, g_XorMode );
PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color ); PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );

View File

@ -61,7 +61,7 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
} }
} }
wxPoint endpos = aPanel->GetScreen()->m_Curseur; wxPoint endpos = aPanel->GetScreen()->GetCrossHairPosition();
if( g_HVLines ) /* Coerce the line to vertical or horizontal one: */ if( g_HVLines ) /* Coerce the line to vertical or horizontal one: */
ComputeBreakPoint( CurrentLine, endpos ); ComputeBreakPoint( CurrentLine, endpos );
@ -90,7 +90,7 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
{ {
SCH_LINE* oldsegment, * newsegment, * nextsegment; SCH_LINE* oldsegment, * newsegment, * nextsegment;
wxPoint cursorpos = GetScreen()->m_Curseur; wxPoint cursorpos = GetScreen()->GetCrossHairPosition();
if( GetScreen()->GetCurItem() && (GetScreen()->GetCurItem()->m_Flags == 0) ) if( GetScreen()->GetCurItem() && (GetScreen()->GetCurItem()->m_Flags == 0) )
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
@ -145,8 +145,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
} }
GetScreen()->SetCurItem( newsegment ); GetScreen()->SetCurItem( newsegment );
DrawPanel->ManageCurseur = DrawSegment; DrawPanel->SetMouseCapture( DrawSegment, AbortCreateNewLine );
DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine;
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
} }
else // A segment is in progress: terminates the current segment and add a new segment. else // A segment is in progress: terminates the current segment and add a new segment.
@ -167,7 +166,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
return; return;
} }
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
/* Creates the new segment, or terminates the command /* Creates the new segment, or terminates the command
* if the end point is on a pin, junction or an other wire or bus */ * if the end point is on a pin, junction or an other wire or bus */
@ -179,9 +178,9 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
oldsegment->SetNext( GetScreen()->GetDrawItems() ); oldsegment->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( oldsegment ); GetScreen()->SetDrawItems( oldsegment );
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CrossHairOff( DC ); // Erase schematic cursor
oldsegment->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); oldsegment->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // Display schematic cursor DrawPanel->CrossHairOn( DC ); // Display schematic cursor
/* Create a new segment, and chain it after the current new segment */ /* Create a new segment, and chain it after the current new segment */
if( nextsegment ) if( nextsegment )
@ -203,7 +202,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
oldsegment->m_Flags = SELECTED; oldsegment->m_Flags = SELECTED;
newsegment->m_Flags = IS_NEW; newsegment->m_Flags = IS_NEW;
GetScreen()->SetCurItem( newsegment ); GetScreen()->SetCurItem( newsegment );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
/* This is the first segment: Now we know the start segment position. /* This is the first segment: Now we know the start segment position.
* Create a junction if needed. Note: a junction can be needed later, * Create a junction if needed. Note: a junction can be needed later,
@ -269,8 +268,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
GetScreen()->SetDrawItems( lastsegment ); GetScreen()->SetDrawItems( lastsegment );
} }
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
wxPoint end_point, alt_end_point; wxPoint end_point, alt_end_point;
@ -320,7 +318,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
GetScreen()->TestDanglingEnds( DrawPanel, DC ); GetScreen()->TestDanglingEnds( DrawPanel, DC );
/* Redraw wires and junctions which can be changed by TestDanglingEnds() */ /* Redraw wires and junctions which can be changed by TestDanglingEnds() */
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CrossHairOff( DC ); // Erase schematic cursor
EDA_ITEM* item = GetScreen()->GetDrawItems(); EDA_ITEM* item = GetScreen()->GetDrawItems();
while( item ) while( item )
@ -339,7 +337,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
item = item->Next(); item = item->Next();
} }
DrawPanel->CursorOn( DC ); // Display schematic cursor DrawPanel->CrossHairOn( DC ); // Display schematic cursor
SaveCopyInUndoList( s_OldWiresList, UR_WIRE_IMAGE ); SaveCopyInUndoList( s_OldWiresList, UR_WIRE_IMAGE );
s_OldWiresList = NULL; s_OldWiresList = NULL;
@ -412,7 +410,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
SCH_POLYLINE* polyLine = (SCH_POLYLINE*) screen->GetCurItem(); SCH_POLYLINE* polyLine = (SCH_POLYLINE*) screen->GetCurItem();
wxPoint endpos; wxPoint endpos;
endpos = screen->m_Curseur; endpos = screen->GetCrossHairPosition();
int idx = polyLine->GetCornerCount() - 1; int idx = polyLine->GetCornerCount() - 1;
@ -435,7 +433,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
} }
screen->RemoveFromDrawList( screen->GetCurItem() ); screen->RemoveFromDrawList( screen->GetCurItem() );
DrawPanel->ManageCurseur = NULL; DrawPanel->m_mouseCaptureCallback = NULL;
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
} }
@ -449,9 +447,9 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( wxDC* aDC, const wxPoint& aPosition,
m_itemToRepeat = junction; m_itemToRepeat = junction;
DrawPanel->CursorOff( aDC ); // Erase schematic cursor DrawPanel->CrossHairOff( aDC ); // Erase schematic cursor
junction->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); junction->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( aDC ); // Display schematic cursor DrawPanel->CrossHairOn( aDC ); // Display schematic cursor
junction->SetNext( GetScreen()->GetDrawItems() ); junction->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( junction ); GetScreen()->SetDrawItems( junction );
@ -471,9 +469,9 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPositio
NewNoConnect = new SCH_NO_CONNECT( aPosition ); NewNoConnect = new SCH_NO_CONNECT( aPosition );
m_itemToRepeat = NewNoConnect; m_itemToRepeat = NewNoConnect;
DrawPanel->CursorOff( aDC ); // Erase schematic cursor DrawPanel->CrossHairOff( aDC ); // Erase schematic cursor
NewNoConnect->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); NewNoConnect->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( aDC ); // Display schematic cursor DrawPanel->CrossHairOn( aDC ); // Display schematic cursor
NewNoConnect->SetNext( GetScreen()->GetDrawItems() ); NewNoConnect->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( NewNoConnect ); GetScreen()->SetDrawItems( NewNoConnect );
@ -491,8 +489,6 @@ static void AbortCreateNewLine( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( screen->GetCurItem() ) if( screen->GetCurItem() )
{ {
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
screen->RemoveFromDrawList( (SCH_ITEM*) screen->GetCurItem() ); screen->RemoveFromDrawList( (SCH_ITEM*) screen->GetCurItem() );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
screen->ReplaceWires( s_OldWiresList ); screen->ReplaceWires( s_OldWiresList );
@ -501,7 +497,6 @@ static void AbortCreateNewLine( EDA_DRAW_PANEL* Panel, wxDC* DC )
else else
{ {
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent(); SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent();
parent->SetRepeatItem( NULL ); parent->SetRepeatItem( NULL );
} }
@ -529,7 +524,8 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
if( m_itemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode if( m_itemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode
{ {
wxPoint pos = GetScreen()->m_Curseur - ( (SCH_COMPONENT*) m_itemToRepeat )->m_Pos; wxPoint pos = GetScreen()->GetCrossHairPosition() -
( (SCH_COMPONENT*) m_itemToRepeat )->m_Pos;
m_itemToRepeat->m_Flags = IS_NEW; m_itemToRepeat->m_Flags = IS_NEW;
( (SCH_COMPONENT*) m_itemToRepeat )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) m_itemToRepeat )->m_TimeStamp = GetTimeStamp();
m_itemToRepeat->Move( pos ); m_itemToRepeat->Move( pos );

View File

@ -45,8 +45,6 @@ static void ExitBusEntry( EDA_DRAW_PANEL* Panel, wxDC* DC )
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent(); SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent();
parent->SetRepeatItem( NULL ); parent->SetRepeatItem( NULL );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
} }
@ -65,7 +63,7 @@ static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
BusEntry->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); BusEntry->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
/* Redraw at the new position. */ /* Redraw at the new position. */
BusEntry->m_Pos = screen->m_Curseur; BusEntry->m_Pos = screen->GetCrossHairPosition();
BusEntry->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); BusEntry->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
} }
@ -73,7 +71,8 @@ static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* DC, int entry_type ) SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* DC, int entry_type )
{ {
// Create and place a new bus entry at cursor position // Create and place a new bus entry at cursor position
SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->m_Curseur, s_LastShape, entry_type ); SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->GetCrossHairPosition(), s_LastShape,
entry_type );
BusEntry->m_Flags = IS_NEW; BusEntry->m_Flags = IS_NEW;
BusEntry->Place( this, DC );; BusEntry->Place( this, DC );;
OnModify(); OnModify();
@ -96,15 +95,15 @@ void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC )
ItemInitialPosition = BusEntry->m_Pos; ItemInitialPosition = BusEntry->m_Pos;
DrawPanel->CursorOff( DC ); DrawPanel->CrossHairOff( DC );
GetScreen()->m_Curseur = BusEntry->m_Pos; GetScreen()->SetCrossHairPosition( BusEntry->m_Pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
GetScreen()->SetCurItem( BusEntry ); GetScreen()->SetCurItem( BusEntry );
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->m_mouseCaptureCallback = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitBusEntry; DrawPanel->m_endMouseCaptureCallback = ExitBusEntry;
DrawPanel->CursorOn( DC ); DrawPanel->CrossHairOn( DC );
} }

View File

@ -70,7 +70,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, bool aInc
break; break;
case SCH_COMPONENT_T: case SCH_COMPONENT_T:
Pin = GetScreen()->GetPin( GetScreen()->m_Curseur, &LibItem ); Pin = GetScreen()->GetPin( GetScreen()->GetCrossHairPosition(), &LibItem );
if( Pin ) if( Pin )
break; // Priority is probing a pin first break; // Priority is probing a pin first
@ -80,7 +80,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, bool aInc
break; break;
default: default:
Pin = GetScreen()->GetPin( GetScreen()->m_Curseur, &LibItem ); Pin = GetScreen()->GetPin( GetScreen()->GetCrossHairPosition(), &LibItem );
break; break;
case LIB_PIN_T: case LIB_PIN_T:
@ -240,8 +240,8 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
int hotkey = 0; int hotkey = 0;
wxPoint pos = aPosition; wxPoint pos = aPosition;
PutOnGrid( &pos ); pos = screen->GetNearestGridPosition( pos );
oldpos = screen->m_Curseur; oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize(); gridSize = screen->GetGridSize();
switch( g_KeyPressed ) switch( g_KeyPressed )
@ -279,7 +279,7 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
} }
// Update cursor position. // Update cursor position.
screen->m_Curseur = pos; screen->SetCrossHairPosition( pos );
if( screen->IsRefreshReq() ) if( screen->IsRefreshReq() )
{ {
@ -287,17 +287,17 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
wxSafeYield(); wxSafeYield();
} }
if( oldpos != screen->m_Curseur ) if( oldpos != screen->GetCrossHairPosition() )
{ {
pos = screen->m_Curseur; pos = screen->GetCrossHairPosition();
screen->m_Curseur = oldpos; screen->SetCrossHairPosition( oldpos );
DrawPanel->CursorOff( aDC ); DrawPanel->CrossHairOff( aDC );
screen->m_Curseur = pos; screen->SetCrossHairPosition( pos );
DrawPanel->CursorOn( aDC ); DrawPanel->CrossHairOn( aDC );
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, TRUE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, TRUE );
} }
} }
@ -322,8 +322,8 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
int hotkey = 0; int hotkey = 0;
wxPoint pos = aPosition; wxPoint pos = aPosition;
PutOnGrid( &pos ); pos = screen->GetNearestGridPosition( pos );
oldpos = screen->m_Curseur; oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize(); gridSize = screen->GetGridSize();
switch( g_KeyPressed ) switch( g_KeyPressed )
@ -361,7 +361,7 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
} }
// Update the cursor position. // Update the cursor position.
screen->m_Curseur = pos; screen->SetCrossHairPosition( pos );
if( screen->IsRefreshReq() ) if( screen->IsRefreshReq() )
{ {
@ -369,17 +369,17 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
wxSafeYield(); wxSafeYield();
} }
if( oldpos != screen->m_Curseur ) if( oldpos != screen->GetCrossHairPosition() )
{ {
pos = screen->m_Curseur; pos = screen->GetCrossHairPosition();
screen->m_Curseur = oldpos; screen->SetCrossHairPosition( oldpos );
DrawPanel->CursorOff( aDC ); DrawPanel->CrossHairOff( aDC );
screen->m_Curseur = pos; screen->SetCrossHairPosition( pos );
DrawPanel->CursorOn( aDC ); DrawPanel->CrossHairOn( aDC );
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, TRUE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, TRUE );
} }
} }
@ -403,8 +403,8 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
int hotkey = 0; int hotkey = 0;
wxPoint pos = aPosition; wxPoint pos = aPosition;
PutOnGrid( &pos ); pos = screen->GetNearestGridPosition( pos );
oldpos = screen->m_Curseur; oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize(); gridSize = screen->GetGridSize();
switch( g_KeyPressed ) switch( g_KeyPressed )
@ -442,7 +442,7 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
} }
// Update cursor position. // Update cursor position.
screen->m_Curseur = pos; screen->SetCrossHairPosition( pos );
if( screen->IsRefreshReq() ) if( screen->IsRefreshReq() )
{ {
@ -450,17 +450,17 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
wxSafeYield(); wxSafeYield();
} }
if( oldpos != screen->m_Curseur ) if( oldpos != screen->GetCrossHairPosition() )
{ {
pos = screen->m_Curseur; pos = screen->GetCrossHairPosition();
screen->m_Curseur = oldpos; screen->SetCrossHairPosition( oldpos );
DrawPanel->CursorOff( aDC ); DrawPanel->CrossHairOff( aDC );
screen->m_Curseur = pos; screen->SetCrossHairPosition( pos );
DrawPanel->CursorOn( aDC ); DrawPanel->CrossHairOn( aDC );
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, TRUE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, TRUE );
} }
} }

View File

@ -79,7 +79,7 @@ static bool MarkConnected( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, SCH_LINE
void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection ) void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
{ {
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
wxPoint refpos = screen->m_Curseur; wxPoint refpos = screen->GetCrossHairPosition();
SCH_ITEM* DelStruct; SCH_ITEM* DelStruct;
PICKED_ITEMS_LIST pickList; PICKED_ITEMS_LIST pickList;
@ -97,7 +97,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
DelStruct = screen->GetDrawItems(); DelStruct = screen->GetDrawItems();
while( DelStruct while( DelStruct
&& ( DelStruct = PickStruct( screen->m_Curseur, screen, && ( DelStruct = PickStruct( screen->GetCrossHairPosition(), screen,
JUNCTION_T | WIRE_T | BUS_T ) ) != NULL ) JUNCTION_T | WIRE_T | BUS_T ) ) != NULL )
{ {
DelStruct->m_Flags = SELECTEDNODE | STRUCT_DELETED; DelStruct->m_Flags = SELECTEDNODE | STRUCT_DELETED;
@ -234,7 +234,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
} }
// Delete labels attached to wires // Delete labels attached to wires
wxPoint pos = screen->m_Curseur; wxPoint pos = screen->GetCrossHairPosition();
for( DelStruct = screen->GetDrawItems(); DelStruct != NULL; for( DelStruct = screen->GetDrawItems(); DelStruct != NULL;
DelStruct = DelStruct->Next() ) DelStruct = DelStruct->Next() )
@ -245,8 +245,9 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
if( DelStruct->Type() != SCH_LABEL_T ) if( DelStruct->Type() != SCH_LABEL_T )
continue; continue;
GetScreen()->m_Curseur = ( (SCH_TEXT*) DelStruct )->m_Pos; GetScreen()->SetCrossHairPosition( ( (SCH_TEXT*) DelStruct )->m_Pos );
EDA_ITEM* TstStruct = PickStruct( screen->m_Curseur, GetScreen(), WIRE_T | BUS_T ); EDA_ITEM* TstStruct = PickStruct( screen->GetCrossHairPosition(), GetScreen(),
WIRE_T | BUS_T );
if( TstStruct && TstStruct->m_Flags & STRUCT_DELETED ) if( TstStruct && TstStruct->m_Flags & STRUCT_DELETED )
{ {
@ -259,7 +260,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
} }
} }
screen->m_Curseur = pos; screen->SetCrossHairPosition( pos );
} }
screen->ClearDrawingState(); screen->ClearDrawingState();
@ -292,23 +293,23 @@ bool LocateAndDeleteItem( SCH_EDIT_FRAME* frame, wxDC* DC )
SCH_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() ); SCH_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() );
bool item_deleted = FALSE; bool item_deleted = FALSE;
DelStruct = PickStruct( screen->m_Curseur, screen, MARKER_T ); DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, MARKER_T );
if( DelStruct == NULL ) if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, JUNCTION_T ); DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, JUNCTION_T );
if( DelStruct == NULL ) if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, NO_CONNECT_T ); DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, NO_CONNECT_T );
if( DelStruct == NULL ) if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, BUS_ENTRY_T ); DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, BUS_ENTRY_T );
if( DelStruct == NULL ) if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, WIRE_T | BUS_T ); DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, WIRE_T | BUS_T );
if( DelStruct == NULL ) if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, DRAW_ITEM_T ); DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, DRAW_ITEM_T );
if( DelStruct == NULL ) if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, TEXT_T | LABEL_T ); DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, TEXT_T | LABEL_T );
if( DelStruct == NULL ) if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, COMPONENT_T ); DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, COMPONENT_T );
if( DelStruct == NULL ) if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, SHEET_T ); DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, SHEET_T );
if( DelStruct ) if( DelStruct )
{ {

View File

@ -65,7 +65,7 @@ void InstallCmpeditFrame( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aComponent )
// so it comes up wide enough next time. // so it comes up wide enough next time.
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dialog.GetSize(); DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dialog.GetSize();
aParent->DrawPanel->MouseToCursorSchema(); aParent->DrawPanel->MoveCursorToCrossHair();
aParent->DrawPanel->m_IgnoreMouseEvents = false; aParent->DrawPanel->m_IgnoreMouseEvents = false;
} }

View File

@ -183,7 +183,7 @@ void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent )
void DialogLabelEditor::OnCancelClick( wxCommandEvent& aEvent ) void DialogLabelEditor::OnCancelClick( wxCommandEvent& aEvent )
{ {
m_Parent->DrawPanel->MouseToCursorSchema(); m_Parent->DrawPanel->MoveCursorToCrossHair();
EndModal( wxID_CANCEL ); EndModal( wxID_CANCEL );
} }
@ -236,6 +236,6 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
g_DefaultTextLabelSize = m_CurrentText->m_Size.x; g_DefaultTextLabelSize = m_CurrentText->m_Size.x;
m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentText->GetBoundingBox() ); m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
m_Parent->DrawPanel->MouseToCursorSchema(); m_Parent->DrawPanel->MoveCursorToCrossHair();
EndModal( wxID_OK ); EndModal( wxID_OK );
} }

View File

@ -109,7 +109,7 @@ void LIB_EDIT_FRAME::InstallFieldsEditorDialog( wxCommandEvent& event )
if( m_component == NULL ) if( m_component == NULL )
return; return;
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, m_component ); DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, m_component );

View File

@ -175,8 +175,7 @@ void DIALOG_ERC::OnLeftDClickMarkersList( wxCommandEvent& event )
m_Parent->m_CurrentSheet->UpdateAllScreenReferences(); m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
} }
sheet->LastScreen()->m_Curseur = pos; m_Parent->RedrawScreen( pos, true );
m_Parent->RedrawScreen( true );
} }

View File

@ -52,9 +52,9 @@ void SCH_EDIT_FRAME::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )
newpos = comp->GetTransform().TransformCoordinate( newpos ) + pos; newpos = comp->GetTransform().TransformCoordinate( newpos ) + pos;
DrawPanel->CursorOff( DC ); DrawPanel->CrossHairOff( DC );
GetScreen()->m_Curseur = newpos; GetScreen()->SetCrossHairPosition( newpos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
m_OldPos = aField->m_Pos; m_OldPos = aField->m_Pos;
m_Multiflag = 0; m_Multiflag = 0;
@ -69,11 +69,11 @@ void SCH_EDIT_FRAME::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )
} }
} }
DrawPanel->ForceCloseManageCurseur = AbortMoveCmpField; DrawPanel->m_endMouseCaptureCallback = AbortMoveCmpField;
DrawPanel->ManageCurseur = MoveCmpField; DrawPanel->m_mouseCaptureCallback = MoveCmpField;
aField->m_Flags = IS_MOVED; aField->m_Flags = IS_MOVED;
DrawPanel->CursorOn( DC ); DrawPanel->CrossHairOn( DC );
} }
@ -133,7 +133,7 @@ modified!\nYou must create a new power" ) );
newtext.Trim( true ); newtext.Trim( true );
newtext.Trim( false ); newtext.Trim( false );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
if ( diag != wxID_OK ) if ( diag != wxID_OK )
return; // cancelled by user return; // cancelled by user
@ -207,7 +207,7 @@ static void MoveCmpField( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
// But here we want the relative position of the moved field // But here we want the relative position of the moved field
// and we know the actual position. // and we know the actual position.
// So we are using the inverse rotation/mirror transform. // So we are using the inverse rotation/mirror transform.
wxPoint pt( aPanel->GetScreen()->m_Curseur - pos ); wxPoint pt( aPanel->GetScreen()->GetCrossHairPosition() - pos );
TRANSFORM itrsfm = component->GetTransform().InverseTransform(); TRANSFORM itrsfm = component->GetTransform().InverseTransform();
currentField->m_Pos = pos + itrsfm.TransformCoordinate( pt ); currentField->m_Pos = pos + itrsfm.TransformCoordinate( pt );
@ -218,9 +218,6 @@ static void MoveCmpField( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
static void AbortMoveCmpField( EDA_DRAW_PANEL* Panel, wxDC* DC ) static void AbortMoveCmpField( EDA_DRAW_PANEL* Panel, wxDC* DC )
{ {
Panel->ForceCloseManageCurseur = NULL;
Panel->ManageCurseur = NULL;
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) Panel->GetParent(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) Panel->GetParent();
SCH_FIELD* currentField = frame->GetCurrentField(); SCH_FIELD* currentField = frame->GetCurrentField();

View File

@ -62,24 +62,23 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
break; break;
} }
DrawPanel->CursorOff( DC ); DrawPanel->CrossHairOff( DC );
GetScreen()->m_Curseur = ItemInitialPosition; GetScreen()->SetCrossHairPosition( ItemInitialPosition );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
OnModify( ); OnModify( );
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->SetMouseCapture( ShowWhileMoving,ExitMoveTexte );
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
GetScreen()->SetCurItem( TextStruct ); GetScreen()->SetCurItem( TextStruct );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
DrawPanel->CursorOn( DC ); DrawPanel->CrossHairOn( DC );
} }
void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ) void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
{ {
if( TextStruct == NULL ) if( TextStruct == NULL )
TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur, TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->GetCrossHairPosition(),
GetScreen(), TEXT_T | LABEL_T ); GetScreen(), TEXT_T | LABEL_T );
if( TextStruct == NULL ) if( TextStruct == NULL )
return; return;
@ -89,7 +88,7 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
SaveCopyInUndoList( TextStruct, UR_CHANGED ); SaveCopyInUndoList( TextStruct, UR_CHANGED );
/* Erase old text */ /* Erase old text */
DrawPanel->CursorOff( DC ); DrawPanel->CrossHairOff( DC );
TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
int orient; int orient;
@ -111,7 +110,7 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
OnModify( ); OnModify( );
TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode ); TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
DrawPanel->CursorOn( DC ); DrawPanel->CrossHairOn( DC );
} }
@ -126,20 +125,20 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
switch( type ) switch( type )
{ {
case LAYER_NOTES: case LAYER_NOTES:
NewText = new SCH_TEXT( GetScreen()->m_Curseur ); NewText = new SCH_TEXT( GetScreen()->GetCrossHairPosition() );
break; break;
case LAYER_LOCLABEL: case LAYER_LOCLABEL:
NewText = new SCH_LABEL( GetScreen()->m_Curseur ); NewText = new SCH_LABEL( GetScreen()->GetCrossHairPosition() );
break; break;
case LAYER_HIERLABEL: case LAYER_HIERLABEL:
NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur ); NewText = new SCH_HIERLABEL( GetScreen()->GetCrossHairPosition() );
NewText->m_Shape = lastGlobalLabelShape; NewText->m_Shape = lastGlobalLabelShape;
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur ); NewText = new SCH_GLOBALLABEL( GetScreen()->GetCrossHairPosition() );
NewText->m_Shape = lastGlobalLabelShape; NewText->m_Shape = lastGlobalLabelShape;
break; break;
@ -173,9 +172,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
} }
NewText->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); NewText->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->SetMouseCapture( ShowWhileMoving, ExitMoveTexte );
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
GetScreen()->SetCurItem( NewText ); GetScreen()->SetCurItem( NewText );
return NewText; return NewText;
@ -201,7 +198,7 @@ static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
case SCH_TEXT_T: case SCH_TEXT_T:
( (SCH_TEXT*) TextStruct )->m_Pos = aPanel->GetScreen()->m_Curseur; ( (SCH_TEXT*) TextStruct )->m_Pos = aPanel->GetScreen()->GetCrossHairPosition();
break; break;
default: default:
@ -220,8 +217,6 @@ static void ExitMoveTexte( EDA_DRAW_PANEL* Panel, wxDC* DC )
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent(); SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent();
parent->SetRepeatItem( NULL ); parent->SetRepeatItem( NULL );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
if( Struct == NULL ) /* no current item */ if( Struct == NULL ) /* no current item */
{ {
@ -323,12 +318,12 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
} }
/* now delete the old text /* now delete the old text
* If it is a text flagged IS_NEW it will be deleted by ForceCloseManageCurseur() * If it is a text flagged IS_NEW it will be deleted by m_endMouseCaptureCallback()
* If not, we must delete it. * If not, we must delete it.
*/ */
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->m_mouseCaptureCallback && DrawPanel->m_endMouseCaptureCallback )
{ {
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC ); DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC );
} }
if( (flags & IS_NEW) == 0 ) // Remove old text from current list and if( (flags & IS_NEW) == 0 ) // Remove old text from current list and
@ -346,7 +341,7 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = NULL; g_ItemToUndoCopy = NULL;
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CrossHairOff( DC ); // Erase schematic cursor
/* Save the new text in undo list if the old text was not itself a "new created text" /* Save the new text in undo list if the old text was not itself a "new created text"
* In this case, the old text is already in undo list as a deleted item. * In this case, the old text is already in undo list as a deleted item.
@ -371,5 +366,5 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
} }
newtext->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); newtext->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // redraw schematic cursor DrawPanel->CrossHairOn( DC ); // redraw schematic cursor
} }

View File

@ -58,10 +58,10 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->ClrRefreshReq(); GetScreen()->ClrRefreshReq();
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->DrawCursor( DC ); DrawPanel->DrawCrossHair( DC );
// Display the sheet filename, and the sheet path, for non root sheets // Display the sheet filename, and the sheet path, for non root sheets
if( GetScreen()->GetFileName() == m_DefaultSchematicFileName ) if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )

View File

@ -65,9 +65,9 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
m_CurrentSheet->UpdateAllScreenReferences(); m_CurrentSheet->UpdateAllScreenReferences();
} }
sheetFoundIn->LastScreen()->m_Curseur = lastMarker->m_Pos; sheetFoundIn->LastScreen()->SetCrossHairPosition( lastMarker->m_Pos );
RedrawScreen( warpCursor ); RedrawScreen( lastMarker->m_Pos, warpCursor );
wxString path = sheetFoundIn->Path(); wxString path = sheetFoundIn->Path();
wxString units = GetAbbreviatedUnitsLabel(); wxString units = GetAbbreviatedUnitsLabel();
@ -195,8 +195,8 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
delta = Component->GetTransform().TransformCoordinate( pos ); delta = Component->GetTransform().TransformCoordinate( pos );
pos = delta + Component->m_Pos; pos = delta + Component->m_Pos;
wxPoint old_cursor_position = sheet->LastScreen()->m_Curseur; wxPoint old_cursor_position = sheet->LastScreen()->GetCrossHairPosition();
sheet->LastScreen()->m_Curseur = pos; sheet->LastScreen()->SetCrossHairPosition( pos );
curpos = GetScreen()->GetCrossHairScreenPosition(); curpos = GetScreen()->GetCrossHairScreenPosition();
@ -216,20 +216,20 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
#undef MARGIN #undef MARGIN
if( DoCenterAndRedraw ) if( DoCenterAndRedraw )
RedrawScreen( mouseWarp ); RedrawScreen( curpos, mouseWarp );
else else
{ {
INSTALL_UNBUFFERED_DC( dc, DrawPanel ); INSTALL_UNBUFFERED_DC( dc, DrawPanel );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->GetCrossHairPosition() );
DrawPanel->CursorOff( &dc ); DrawPanel->CrossHairOff( &dc );
if( mouseWarp ) if( mouseWarp )
DrawPanel->MoveCursor( curpos ); DrawPanel->MoveCursor( curpos );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); EXCHG( old_cursor_position, sheet->LastScreen()->GetCrossHairPosition() );
DrawPanel->CursorOn( &dc ); DrawPanel->CrossHairOn( &dc );
} }
} }
@ -339,9 +339,9 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& event )
m_CurrentSheet->UpdateAllScreenReferences(); m_CurrentSheet->UpdateAllScreenReferences();
} }
sheetFoundIn->LastScreen()->m_Curseur = lastItemPosition; sheetFoundIn->LastScreen()->SetCrossHairPosition( lastItemPosition );
RedrawScreen( warpCursor ); RedrawScreen( lastItemPosition, warpCursor );
msg = event.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable(); msg = event.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable();
SetStatusText( msg ); SetStatusText( msg );

View File

@ -34,8 +34,7 @@ wxString SCH_EDIT_FRAME::SelectFromLibBrowser( void )
{ {
wxSemaphore semaphore( 0, 1 ); wxSemaphore semaphore( 0, 1 );
/* Close the current Lib browser, if open, and open a new one, in /* Close the current Lib browser, if open, and open a new one, in "modal" mode */
* "modal" mode */
if( m_ViewlibFrame ) if( m_ViewlibFrame )
{ {
m_ViewlibFrame->Destroy(); m_ViewlibFrame->Destroy();
@ -43,7 +42,7 @@ wxString SCH_EDIT_FRAME::SelectFromLibBrowser( void )
} }
m_ViewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore ); m_ViewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore );
m_ViewlibFrame->AdjustScrollBars(); m_ViewlibFrame->AdjustScrollBars( wxPoint( 0 , 0 ) );
// Show the library viewer frame until it is closed // Show the library viewer frame until it is closed
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
@ -105,7 +104,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if ( dlg.ShowModal() == wxID_CANCEL ) if ( dlg.ShowModal() == wxID_CANCEL )
{ {
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; return NULL;
} }
@ -123,7 +122,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Name.IsEmpty() ) if( Name.IsEmpty() )
{ {
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; return NULL;
} }
@ -140,7 +139,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Name.IsEmpty() ) if( Name.IsEmpty() )
{ {
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; return NULL;
} }
} }
@ -151,7 +150,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( GetNameOfPartToLoad( this, Library, Name ) == 0 ) if( GetNameOfPartToLoad( this, Library, Name ) == 0 )
{ {
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; return NULL;
} }
} }
@ -162,7 +161,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Name.IsEmpty() ) if( Name.IsEmpty() )
{ {
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; return NULL;
} }
} }
@ -182,13 +181,13 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Entry == NULL ) if( Entry == NULL )
{ {
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; return NULL;
} }
} }
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( Entry == NULL ) if( Entry == NULL )
{ {
@ -199,12 +198,10 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
lastCommponentName = Name; lastCommponentName = Name;
AddHistoryComponentName( HistoryList, Name ); AddHistoryComponentName( HistoryList, Name );
DrawPanel->SetMouseCapture( ShowWhileMoving, ExitPlaceCmp );
DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
Component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert, Component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert,
GetScreen()->m_Curseur, true ); GetScreen()->GetCrossHairPosition(), true );
// Set the m_ChipName value, from component name in lib, for aliases // Set the m_ChipName value, from component name in lib, for aliases
// Note if Entry is found, and if Name is an alias of a component, // Note if Entry is found, and if Name is an alias of a component,
// alias exists because its root component was found // alias exists because its root component was found
@ -234,7 +231,7 @@ static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
Component->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); Component->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
} }
move_vector = screen->m_Curseur - Component->m_Pos; move_vector = screen->GetCrossHairPosition() - Component->m_Pos;
Component->Move( move_vector ); Component->Move( move_vector );
Component->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); Component->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
} }
@ -253,7 +250,7 @@ void SCH_EDIT_FRAME::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, wxDC* DC,
/* Deletes the previous component. */ /* Deletes the previous component. */
if( DC ) if( DC )
{ {
DrawPanel->CursorOff( DC ); DrawPanel->CrossHairOff( DC );
if( DrawComponent->m_Flags ) if( DrawComponent->m_Flags )
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
@ -272,7 +269,7 @@ void SCH_EDIT_FRAME::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, wxDC* DC,
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); DrawPanel->CrossHairOn( DC );
} }
GetScreen()->TestDanglingEnds( DrawPanel, DC ); GetScreen()->TestDanglingEnds( DrawPanel, DC );
@ -302,9 +299,7 @@ static void ExitPlaceCmp( EDA_DRAW_PANEL* Panel, wxDC* DC )
Component->m_Flags = 0; Component->m_Flags = 0;
} }
Panel->Refresh( TRUE ); Panel->Refresh( true );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
} }
@ -427,12 +422,11 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
g_ItemToUndoCopy = Component->Clone(); g_ItemToUndoCopy = Component->Clone();
} }
DrawPanel->CursorOff( DC ); DrawPanel->CrossHairOff( DC );
GetScreen()->m_Curseur = Component->m_Pos; GetScreen()->SetCrossHairPosition( Component->m_Pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->SetMouseCapture( ShowWhileMoving, ExitPlaceCmp );
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
GetScreen()->SetCurItem( Component ); GetScreen()->SetCurItem( Component );
OldPos = Component->m_Pos; OldPos = Component->m_Pos;
OldTransform = Component->GetTransform(); OldTransform = Component->GetTransform();
@ -455,10 +449,10 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
Component->m_Flags |= IS_MOVED; Component->m_Flags |= IS_MOVED;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, FALSE );
#endif #endif
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->CursorOn( DC ); DrawPanel->CrossHairOn( DC );
} }

View File

@ -270,7 +270,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
} }
else else
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
RedrawScreen( true ); RedrawScreen( screen->GetScrollCenterPosition(), true );
} }
} }

View File

@ -299,7 +299,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */ case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:
@ -724,7 +724,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
{ {
SCH_SHEET* sheet = (SCH_SHEET*) aItem; SCH_SHEET* sheet = (SCH_SHEET*) aItem;
// If it's a sheet, then check if a pinsheet is under the cursor // If it's a sheet, then check if a pinsheet is under the cursor
SCH_SHEET_PIN* slabel = sheet->GetLabel( GetScreen()->m_Curseur ); SCH_SHEET_PIN* slabel = sheet->GetLabel( GetScreen()->GetCrossHairPosition() );
if( slabel ) if( slabel )
aItem = slabel; aItem = slabel;
@ -733,7 +733,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem->Type() == SCH_JUNCTION_T ) if( aItem->Type() == SCH_JUNCTION_T )
{ {
// If it's a junction, pick the underlying wire instead // If it's a junction, pick the underlying wire instead
aItem = PickStruct( GetScreen()->m_Curseur, GetScreen(), WIRE_T ); aItem = PickStruct( GetScreen()->GetCrossHairPosition(), GetScreen(), WIRE_T );
} }
if( aItem == NULL ) if( aItem == NULL )
@ -813,7 +813,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem == NULL ) if( aItem == NULL )
{ {
aItem = PickStruct( GetScreen()->m_Curseur, GetScreen(), aItem = PickStruct( GetScreen()->GetCrossHairPosition(), GetScreen(),
COMPONENT_T | TEXT_T | LABEL_T | SHEET_T ); COMPONENT_T | TEXT_T | LABEL_T | SHEET_T );
if( aItem == NULL ) if( aItem == NULL )
break; break;
@ -928,7 +928,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break; break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */ case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
break; break;
case HK_ZOOM_IN: case HK_ZOOM_IN:

View File

@ -66,7 +66,7 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event )
wxString CmpName; wxString CmpName;
LIB_ALIAS* LibEntry = NULL; LIB_ALIAS* LibEntry = NULL;
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
if( GetScreen()->IsModify() if( GetScreen()->IsModify()
&& !IsOK( this, _( "Current part not saved.\n\nDiscard current changes?" ) ) ) && !IsOK( this, _( "Current part not saved.\n\nDiscard current changes?" ) ) )
@ -216,10 +216,10 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->ClrRefreshReq(); GetScreen()->ClrRefreshReq();
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->DrawCursor( DC ); DrawPanel->DrawCrossHair( DC );
DisplayLibInfos(); DisplayLibInfos();
UpdateStatusBar(); UpdateStatusBar();
@ -235,7 +235,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
wxFileName fn; wxFileName fn;
wxString msg; wxString msg;
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
if( GetScreen()->IsModify() ) if( GetScreen()->IsModify() )
{ {
@ -373,7 +373,7 @@ void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event )
wxArrayString ListNames; wxArrayString ListNames;
wxString msg; wxString msg;
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
m_lastDrawItem = NULL; m_lastDrawItem = NULL;
m_drawItem = NULL; m_drawItem = NULL;
@ -472,7 +472,7 @@ void LIB_EDIT_FRAME::CreateNewLibraryPart( wxCommandEvent& event )
lost!\n\nClear the current component from the screen?" ) ) ) lost!\n\nClear the current component from the screen?" ) ) )
return; return;
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
m_drawItem = NULL; m_drawItem = NULL;

View File

@ -49,7 +49,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_Curseur ); GetScreen()->GetCrossHairPosition() );
} }
if( DrawEntry ) if( DrawEntry )
@ -103,7 +103,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_Curseur ); GetScreen()->GetCrossHairPosition() );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
@ -156,7 +156,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( m_drawItem == NULL ) if( m_drawItem == NULL )
{ {
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_Curseur ); GetScreen()->GetCrossHairPosition() );
} }
if( m_drawItem == NULL ) if( m_drawItem == NULL )
{ {
@ -227,6 +227,6 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break; break;
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
} }

View File

@ -347,13 +347,13 @@ int LIB_EDIT_FRAME::BestZoom()
BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert ); BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert );
dx = BoundaryBox.GetWidth(); dx = BoundaryBox.GetWidth();
dy = BoundaryBox.GetHeight(); dy = BoundaryBox.GetHeight();
GetScreen()->m_Curseur = BoundaryBox.Centre(); GetScreen()->SetScrollCenterPosition( BoundaryBox.Centre() );
} }
else else
{ {
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x; dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y; dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
} }
/* /*
@ -375,6 +375,7 @@ int LIB_EDIT_FRAME::BestZoom()
{ {
if( m_clientSize == wxSize( -1, -1 ) ) if( m_clientSize == wxSize( -1, -1 ) )
m_clientSize = DrawPanel->GetClientSize(); m_clientSize = DrawPanel->GetClientSize();
size = m_clientSize; size = m_clientSize;
} }
@ -582,7 +583,7 @@ void LIB_EDIT_FRAME::OnViewEntryDoc( wxCommandEvent& event )
void LIB_EDIT_FRAME::OnSelectBodyStyle( wxCommandEvent& event ) void LIB_EDIT_FRAME::OnSelectBodyStyle( wxCommandEvent& event )
{ {
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
if( event.GetId() == ID_DE_MORGAN_NORMAL_BUTT ) if( event.GetId() == ID_DE_MORGAN_NORMAL_BUTT )
m_convert = 1; m_convert = 1;
@ -625,18 +626,18 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_LIBEDIT_CANCEL_EDITING: case ID_POPUP_LIBEDIT_CANCEL_EDITING:
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->UnManageCursor(); DrawPanel->EndMouseCapture();
else else
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
break; break;
case ID_POPUP_LIBEDIT_DELETE_ITEM: case ID_POPUP_LIBEDIT_DELETE_ITEM:
DrawPanel->UnManageCursor(); DrawPanel->EndMouseCapture();
break; break;
default: default:
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW, wxEmptyString ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor(), wxEmptyString );
break; break;
} }
@ -715,7 +716,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_LIBEDIT_END_CREATE_ITEM: case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( m_drawItem ) if( m_drawItem )
{ {
EndDrawGraphicItem( &dc ); EndDrawGraphicItem( &dc );
@ -725,7 +726,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_BODY_EDIT_ITEM: case ID_POPUP_LIBEDIT_BODY_EDIT_ITEM:
if( m_drawItem ) if( m_drawItem )
{ {
DrawPanel->CursorOff( &dc ); DrawPanel->CrossHairOff( &dc );
switch( m_drawItem->Type() ) switch( m_drawItem->Type() )
{ {
@ -744,7 +745,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
; ;
} }
DrawPanel->CursorOn( &dc ); DrawPanel->CrossHairOn( &dc );
} }
break; break;
@ -765,11 +766,11 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_drawItem == NULL ) if( m_drawItem == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
int oldFlags = m_drawItem->GetFlags(); int oldFlags = m_drawItem->GetFlags();
m_drawItem->SetFlags( 0 ); m_drawItem->SetFlags( 0 );
m_drawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform ); m_drawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform );
( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCursorDrawPosition() ); ( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCrossHairPosition( true ) );
m_drawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform ); m_drawItem->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL, DefaultTransform );
m_drawItem->SetFlags( oldFlags ); m_drawItem->SetFlags( oldFlags );
break; break;
@ -778,30 +779,31 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_DELETE_ITEM: case ID_POPUP_LIBEDIT_DELETE_ITEM:
if( m_drawItem == NULL ) if( m_drawItem == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->CursorOff( &dc ); DrawPanel->CrossHairOff( &dc );
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
if( m_drawItem->Type() == LIB_PIN_T ) if( m_drawItem->Type() == LIB_PIN_T )
{ {
DeletePin( &dc, m_component, (LIB_PIN*) m_drawItem ); DeletePin( &dc, m_component, (LIB_PIN*) m_drawItem );
} }
else else
{ {
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
else else
m_component->RemoveDrawItem( m_drawItem, DrawPanel, &dc ); m_component->RemoveDrawItem( m_drawItem, DrawPanel, &dc );
} }
m_drawItem = NULL; m_drawItem = NULL;
OnModify( ); OnModify( );
DrawPanel->CursorOn( &dc ); DrawPanel->CrossHairOn( &dc );
break; break;
case ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST: case ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST:
if( m_drawItem == NULL ) if( m_drawItem == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( m_drawItem->Type() == LIB_PIN_T ) if( m_drawItem->Type() == LIB_PIN_T )
StartMovePin( &dc ); StartMovePin( &dc );
else else
@ -813,7 +815,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_drawItem == NULL ) if( m_drawItem == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( m_drawItem->Type() == LIB_RECTANGLE_T if( m_drawItem->Type() == LIB_RECTANGLE_T
|| m_drawItem->Type() == LIB_CIRCLE_T || m_drawItem->Type() == LIB_CIRCLE_T
|| m_drawItem->Type() == LIB_POLYLINE_T || m_drawItem->Type() == LIB_POLYLINE_T
@ -828,7 +830,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT: case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT:
if( m_drawItem == NULL && m_drawItem->Type() != LIB_TEXT_T ) if( m_drawItem == NULL && m_drawItem->Type() != LIB_TEXT_T )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( !m_drawItem->InEditMode() ) if( !m_drawItem->InEditMode() )
{ {
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
@ -843,7 +845,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{ {
if( m_drawItem == NULL || ( m_drawItem->Type() != LIB_FIELD_T ) ) if( m_drawItem == NULL || ( m_drawItem->Type() != LIB_FIELD_T ) )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( !m_drawItem->InEditMode() ) if( !m_drawItem->InEditMode() )
{ {
@ -859,13 +861,13 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM: case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM:
if( m_drawItem == NULL ) if( m_drawItem == NULL )
break; break;
DrawPanel->CursorOff( &dc ); DrawPanel->CrossHairOff( &dc );
if( m_drawItem->Type() == LIB_FIELD_T ) if( m_drawItem->Type() == LIB_FIELD_T )
{ {
EditField( &dc, (LIB_FIELD*) m_drawItem ); EditField( &dc, (LIB_FIELD*) m_drawItem );
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->CursorOn( &dc ); DrawPanel->CrossHairOn( &dc );
break; break;
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
@ -876,7 +878,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id ); GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
@ -888,34 +890,34 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_SELECT_ITEMS_BLOCK: case ID_POPUP_SELECT_ITEMS_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->m_BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY; GetScreen()->m_BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_MIRROR_Y_BLOCK: case ID_POPUP_MIRROR_Y_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_Y; GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_Y;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
@ -1074,8 +1076,8 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
wxT( "Cannot create new part from non-existant current part." ) ); wxT( "Cannot create new part from non-existant current part." ) );
INSTALL_UNBUFFERED_DC( dc, DrawPanel ); INSTALL_UNBUFFERED_DC( dc, DrawPanel );
DrawPanel->CursorOff( &dc ); DrawPanel->CrossHairOff( &dc );
EditField( &dc, &m_component->GetValueField() ); EditField( &dc, &m_component->GetValueField() );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->CursorOn( &dc ); DrawPanel->CrossHairOn( &dc );
} }

View File

@ -166,7 +166,7 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor()
if( m_drawItem == NULL ) if( m_drawItem == NULL )
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT, m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_Curseur ); GetScreen()->GetCrossHairPosition() );
} }
return m_drawItem; return m_drawItem;

View File

@ -47,7 +47,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
{ {
if( !SnapPoint2( Screen->m_MousePosition, COMPONENT_T, DrawList ) ) if( !SnapPoint2( Screen->m_MousePosition, COMPONENT_T, DrawList ) )
{ {
if( !SnapPoint2( Screen->m_Curseur, COMPONENT_T, DrawList ) ) if( !SnapPoint2( Screen->GetCrossHairPosition(), COMPONENT_T, DrawList ) )
break; break;
} }

View File

@ -352,7 +352,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case SCH_COMPONENT_T: case SCH_COMPONENT_T:
InstallCmpeditFrame( this, (SCH_COMPONENT*) item ); InstallCmpeditFrame( this, (SCH_COMPONENT*) item );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case SCH_TEXT_T: case SCH_TEXT_T:
@ -364,7 +364,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case SCH_FIELD_T: case SCH_FIELD_T:
EditCmpFieldText( (SCH_FIELD*) item, aDC ); EditCmpFieldText( (SCH_FIELD*) item, aDC );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case SCH_MARKER_T: case SCH_MARKER_T:

View File

@ -71,7 +71,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
if( DrawStruct && (DrawStruct->Type() == SCH_SHEET_T) ) if( DrawStruct && (DrawStruct->Type() == SCH_SHEET_T) )
{ {
SCH_SHEET* sheet = (SCH_SHEET*) DrawStruct; SCH_SHEET* sheet = (SCH_SHEET*) DrawStruct;
SCH_SHEET_PIN* slabel = sheet->GetLabel( GetScreen()->m_Curseur ); SCH_SHEET_PIN* slabel = sheet->GetLabel( GetScreen()->GetCrossHairPosition() );
if( slabel ) if( slabel )
DrawStruct = slabel; DrawStruct = slabel;
@ -494,7 +494,7 @@ void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAM
if( !is_new ) if( !is_new )
{ {
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(), if( PickStruct( frame->GetScreen()->GetCrossHairPosition(), frame->GetScreen(),
WIRE_T | BUS_T | EXCLUDE_ENDPOINTS_T ) ) WIRE_T | BUS_T | EXCLUDE_ENDPOINTS_T ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm );
} }
@ -502,7 +502,7 @@ void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAM
msg = AddHotkeyName( _( "Delete Junction" ), s_Schematic_Hokeys_Descr, HK_DELETE ); msg = AddHotkeyName( _( "Delete Junction" ), s_Schematic_Hokeys_Descr, HK_DELETE );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE, msg, delete_xpm );
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(), WIRE_T | BUS_T ) ) if( PickStruct( frame->GetScreen()->GetCrossHairPosition(), frame->GetScreen(), WIRE_T | BUS_T ) )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ), delete_node_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ), ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
@ -514,7 +514,7 @@ void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAM
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame ) void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
{ {
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
wxPoint pos = frame->GetScreen()->m_Curseur; wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg; wxString msg;
if( is_new ) if( is_new )
@ -532,7 +532,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ), ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
delete_connection_xpm ); delete_connection_xpm );
if( PickStruct( frame->GetScreen()->m_Curseur, frame->GetScreen(), if( PickStruct( frame->GetScreen()->GetCrossHairPosition(), frame->GetScreen(),
WIRE_T | BUS_T | EXCLUDE_ENDPOINTS_T ) ) WIRE_T | BUS_T | EXCLUDE_ENDPOINTS_T ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm );
@ -552,7 +552,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame ) void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
{ {
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE; bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
wxPoint pos = frame->GetScreen()->m_Curseur; wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg; wxString msg;
if( is_new ) if( is_new )
{ {

View File

@ -123,7 +123,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
if( pin->IsNew() ) if( pin->IsNew() )
{ {
pin->m_Flags |= IS_CANCELLED; pin->m_Flags |= IS_CANCELLED;
DrawPanel->UnManageCursor(); DrawPanel->EndMouseCapture();
} }
return; return;
} }
@ -194,8 +194,6 @@ static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC )
parent->RestoreComponent(); parent->RestoreComponent();
/* clear edit flags */ /* clear edit flags */
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
parent->SetDrawItem( NULL ); parent->SetDrawItem( NULL );
parent->SetLastDrawItem( NULL ); parent->SetLastDrawItem( NULL );
Panel->Refresh( true ); Panel->Refresh( true );
@ -216,12 +214,11 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC )
// Some tests // Some tests
if( (CurrentPin == NULL) || (CurrentPin->Type() != LIB_PIN_T) ) if( (CurrentPin == NULL) || (CurrentPin->Type() != LIB_PIN_T) )
{ {
wxMessageBox( wxT("LIB_EDIT_FRAME::PlacePin() error") ); wxMessageBox( wxT( "LIB_EDIT_FRAME::PlacePin() error" ) );
return; return;
} }
newpos.x = GetScreen()->m_Curseur.x; newpos = GetScreen()->GetCrossHairPosition( true );
newpos.y = -GetScreen()->m_Curseur.y;
// Tst for an other pin in same new position: // Tst for an other pin in same new position:
for( Pin = m_component->GetNextPin(); Pin != NULL; Pin = m_component->GetNextPin( Pin ) ) for( Pin = m_component->GetNextPin(); Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
@ -235,7 +232,7 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC )
status = status =
IsOK( this, _( "This position is already occupied by \ IsOK( this, _( "This position is already occupied by \
another pin. Continue?" ) ); another pin. Continue?" ) );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = false; DrawPanel->m_IgnoreMouseEvents = false;
if( !status ) if( !status )
@ -252,8 +249,7 @@ another pin. Continue?" ) );
else else
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
DrawPanel->ManageCurseur = NULL; DrawPanel->EndMouseCapture();
DrawPanel->ForceCloseManageCurseur = NULL;
OnModify(); OnModify();
CurrentPin->SetPosition( newpos ); CurrentPin->SetPosition( newpos );
@ -280,11 +276,11 @@ another pin. Continue?" ) );
Pin->m_Flags = 0; Pin->m_Flags = 0;
} }
DrawPanel->CursorOff( DC ); DrawPanel->CrossHairOff( DC );
bool showPinText = true; bool showPinText = true;
CurrentPin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, CurrentPin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE,
&showPinText, DefaultTransform ); &showPinText, DefaultTransform );
DrawPanel->CursorOn( DC ); DrawPanel->CrossHairOn( DC );
m_drawItem = NULL; m_drawItem = NULL;
} }
@ -322,15 +318,13 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
startPos.x = OldPos.x; startPos.x = OldPos.x;
startPos.y = -OldPos.y; startPos.y = -OldPos.y;
DrawPanel->CursorOff( DC ); DrawPanel->CrossHairOff( DC );
GetScreen()->m_Curseur = startPos; GetScreen()->SetCrossHairPosition( startPos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
CurrentPin->DisplayInfo( this ); CurrentPin->DisplayInfo( this );
DrawPanel->ManageCurseur = DrawMovePin; DrawPanel->SetMouseCapture( DrawMovePin, AbortPinMove );
DrawPanel->ForceCloseManageCurseur = AbortPinMove; DrawPanel->CrossHairOn( DC );
DrawPanel->CursorOn( DC );
} }
@ -361,7 +355,7 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
} }
/* Redraw pin in new position */ /* Redraw pin in new position */
CurrentPin->SetPosition( aPanel->GetScreen()->GetCursorDrawPosition() ); CurrentPin->SetPosition( aPanel->GetScreen()->GetCrossHairPosition( true ) );
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform ); CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform );
PinPreviousPos = CurrentPin->GetPosition(); PinPreviousPos = CurrentPin->GetPosition();
@ -435,7 +429,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
if( g_EditPinByPinIsOn == false ) if( g_EditPinByPinIsOn == false )
pin->m_Flags |= IS_LINKED; pin->m_Flags |= IS_LINKED;
pin->SetPosition( GetScreen()->GetCursorDrawPosition() ); pin->SetPosition( GetScreen()->GetCrossHairPosition( true ) );
pin->SetLength( LastPinLength ); pin->SetLength( LastPinLength );
pin->SetOrientation( LastPinOrient ); pin->SetOrientation( LastPinOrient );
pin->SetType( LastPinType ); pin->SetType( LastPinType );
@ -451,7 +445,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetId( ID_LIBEDIT_EDIT_PIN ); cmd.SetId( ID_LIBEDIT_EDIT_PIN );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = false; DrawPanel->m_IgnoreMouseEvents = false;
if( pin->m_Flags & IS_CANCELLED ) if( pin->m_Flags & IS_CANCELLED )
@ -462,8 +456,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
else else
{ {
ClearTempCopyComponent(); ClearTempCopyComponent();
DrawPanel->ManageCurseur = DrawMovePin; DrawPanel->SetMouseCapture( DrawMovePin, AbortPinMove );
DrawPanel->ForceCloseManageCurseur = AbortPinMove;
if( DC ) if( DC )
pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, wxCOPY, &showPinText, pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, wxCOPY, &showPinText,
@ -607,10 +600,9 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
if( g_EditPinByPinIsOn == false ) if( g_EditPinByPinIsOn == false )
Pin->m_Flags |= IS_LINKED; Pin->m_Flags |= IS_LINKED;
wxPoint savepos = GetScreen()->m_Curseur; wxPoint savepos = GetScreen()->GetCrossHairPosition();
DrawPanel->CursorOff( DC ); DrawPanel->CrossHairOff( DC );
GetScreen()->m_Curseur.x = Pin->GetPosition().x; GetScreen()->SetCrossHairPosition( wxPoint( Pin->GetPosition().x, -Pin->GetPosition().y ) );
GetScreen()->m_Curseur.y = -Pin->GetPosition().y;
// Add this new pin in list, and creates pins for others parts if needed // Add this new pin in list, and creates pins for others parts if needed
m_drawItem = Pin; m_drawItem = Pin;
@ -618,8 +610,8 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
PlacePin( DC ); PlacePin( DC );
m_lastDrawItem = Pin; m_lastDrawItem = Pin;
GetScreen()->m_Curseur = savepos; GetScreen()->SetCrossHairPosition( savepos );
DrawPanel->CursorOn( DC ); DrawPanel->CrossHairOn( DC );
Pin->DisplayInfo( this ); Pin->DisplayInfo( this );
OnModify( ); OnModify( );

View File

@ -366,8 +366,7 @@ void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
int fieldNdx; int fieldNdx;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
frame->DrawPanel->ManageCurseur = NULL; frame->DrawPanel->SetMouseCapture( NULL, NULL );
frame->DrawPanel->ForceCloseManageCurseur = NULL;
SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent(); SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();

View File

@ -417,9 +417,9 @@ void SCH_SHEET::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
if( IsNew() ) if( IsNew() )
{ {
// fix size and position of the new sheet // fix size and position of the new sheet
// using the last values set by the ManageCurseur function // using the last values set by the m_mouseCaptureCallback function
frame->DrawPanel->ManageCurseur = NULL; frame->DrawPanel->SetMouseCapture( NULL, NULL );
frame->DrawPanel->ForceCloseManageCurseur = NULL;
if( !frame->EditSheet( this, DC ) ) if( !frame->EditSheet( this, DC ) )
{ {
frame->GetScreen()->SetCurItem( NULL ); frame->GetScreen()->SetCurItem( NULL );

View File

@ -128,13 +128,13 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_DELETE: case ID_POPUP_SCH_DELETE:
// Stop the current command (if any) but keep the current tool // Stop the current command (if any) but keep the current tool
DrawPanel->UnManageCursor(); DrawPanel->EndMouseCapture();
break; break;
default: default:
// Stop the current command and deselect the current tool // Stop the current command and deselect the current tool
DrawPanel->UnManageCursor( 0, DrawPanel->GetDefaultCursor() ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
break; break;
} }
@ -156,7 +156,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case wxID_PASTE: case wxID_PASTE:
HandleBlockBegin( &dc, BLOCK_PASTE, screen->m_Curseur ); HandleBlockBegin( &dc, BLOCK_PASTE, screen->GetCrossHairPosition() );
break; break;
case ID_HIERARCHY_PUSH_POP_BUTT: case ID_HIERARCHY_PUSH_POP_BUTT:
@ -228,12 +228,12 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_ENTRY_SELECT_SLASH: case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '/' ); SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '/' );
break; break;
case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH: case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '\\' ); SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) screen->GetCurItem(), '\\' );
break; break;
@ -243,7 +243,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_END_LINE: case ID_POPUP_END_LINE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
EndSegment( &dc ); EndSegment( &dc );
break; break;
@ -252,27 +252,27 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_ROTATE_TEXT: case ID_POPUP_SCH_ROTATE_TEXT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ChangeTextOrient( (SCH_TEXT*) screen->GetCurItem(), &dc ); ChangeTextOrient( (SCH_TEXT*) screen->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_LABEL_T ); ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_LABEL_T );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_GLOBAL_LABEL_T ); ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_GLOBAL_LABEL_T );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_HIERARCHICAL_LABEL_T ); ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_HIERARCHICAL_LABEL_T );
break; break;
case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT: case ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_TEXT_T ); ConvertTextType( (SCH_TEXT*) screen->GetCurItem(), &dc, SCH_TEXT_T );
break; break;
@ -282,7 +282,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_ROTATE_FIELD: case ID_POPUP_SCH_ROTATE_FIELD:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
RotateCmpField( (SCH_FIELD*) screen->GetCurItem(), &dc ); RotateCmpField( (SCH_FIELD*) screen->GetCurItem(), &dc );
break; break;
@ -292,7 +292,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_DELETE_NODE: case ID_POPUP_SCH_DELETE_NODE:
case ID_POPUP_SCH_DELETE_CONNECTION: case ID_POPUP_SCH_DELETE_CONNECTION:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DeleteConnection( id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE ); DeleteConnection( id == ID_POPUP_SCH_DELETE_CONNECTION ? TRUE : FALSE );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
@ -302,9 +302,9 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_BREAK_WIRE: case ID_POPUP_SCH_BREAK_WIRE:
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
SCH_ITEM* oldWiresList = screen->ExtractWires( true ); SCH_ITEM* oldWiresList = screen->ExtractWires( true );
screen->BreakSegment( screen->m_Curseur ); screen->BreakSegment( screen->GetCrossHairPosition() );
if( oldWiresList ) if( oldWiresList )
SaveCopyInUndoList( oldWiresList, UR_WIRE_IMAGE ); SaveCopyInUndoList( oldWiresList, UR_WIRE_IMAGE );
@ -343,12 +343,12 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_END_SHEET: case ID_POPUP_SCH_END_SHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
screen->GetCurItem()->Place( this, &dc ); screen->GetCurItem()->Place( this, &dc );
break; break;
case ID_POPUP_SCH_RESIZE_SHEET: case ID_POPUP_SCH_RESIZE_SHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ReSizeSheet( (SCH_SHEET*) screen->GetCurItem(), &dc ); ReSizeSheet( (SCH_SHEET*) screen->GetCurItem(), &dc );
screen->TestDanglingEnds( DrawPanel, &dc ); screen->TestDanglingEnds( DrawPanel, &dc );
break; break;
@ -391,7 +391,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_MOVE_PINSHEET: case ID_POPUP_SCH_MOVE_PINSHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
StartMove_PinSheet( (SCH_SHEET_PIN*) screen->GetCurItem(), &dc ); StartMove_PinSheet( (SCH_SHEET_PIN*) screen->GetCurItem(), &dc );
break; break;
@ -413,7 +413,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// fall through // fall through
case ID_POPUP_SCH_MOVE_ITEM_REQUEST: case ID_POPUP_SCH_MOVE_ITEM_REQUEST:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( id == ID_POPUP_SCH_DRAG_CMP_REQUEST ) if( id == ID_POPUP_SCH_DRAG_CMP_REQUEST )
{ {
@ -421,7 +421,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// is to simulate a block drag command // is to simulate a block drag command
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ {
if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->m_Curseur ) ) if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->GetCrossHairPosition() ) )
break; break;
// Give a non null size to the search block: // Give a non null size to the search block:
@ -434,12 +434,12 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_SCH_DRAG_WIRE_REQUEST: case ID_POPUP_SCH_DRAG_WIRE_REQUEST:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
// The easiest way to handle a drag component is to simulate a // The easiest way to handle a drag component is to simulate a
// block drag command // block drag command
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ {
if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->m_Curseur ) ) if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->GetCrossHairPosition() ) )
break; break;
// Ensure the block selection contains the segment, or one end of // Ensure the block selection contains the segment, or one end of
@ -500,7 +500,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
option = CMP_NORMAL; break; option = CMP_NORMAL; break;
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( screen->GetCurItem()->m_Flags == 0 ) if( screen->GetCurItem()->m_Flags == 0 )
SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(), UR_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) screen->GetCurItem(), UR_CHANGED );
@ -510,7 +510,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
case ID_POPUP_SCH_INIT_CMP: case ID_POPUP_SCH_INIT_CMP:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_SCH_EDIT_VALUE_CMP: case ID_POPUP_SCH_EDIT_VALUE_CMP:
@ -563,7 +563,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ConvertPart( (SCH_COMPONENT*) screen->GetCurItem(), &dc ); ConvertPart( (SCH_COMPONENT*) screen->GetCurItem(), &dc );
break; break;
@ -602,7 +602,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( screen->GetCurItem() == NULL ) if( screen->GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
SelPartUnit( (SCH_COMPONENT*) screen->GetCurItem(), SelPartUnit( (SCH_COMPONENT*) screen->GetCurItem(),
id + 1 - ID_POPUP_SCH_SELECT_UNIT1, &dc ); id + 1 - ID_POPUP_SCH_SELECT_UNIT1, &dc );
break; break;
@ -656,7 +656,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
@ -665,39 +665,39 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_DELETE, &dc ); HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
SetSheetNumberAndCount(); SetSheetNumberAndCount();
break; break;
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_ROTATE, &dc ); HandleBlockEndByPopUp( BLOCK_ROTATE, &dc );
break; break;
case ID_POPUP_MIRROR_X_BLOCK: case ID_POPUP_MIRROR_X_BLOCK:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_MIRROR_X, &dc ); HandleBlockEndByPopUp( BLOCK_MIRROR_X, &dc );
break; break;
case ID_POPUP_MIRROR_Y_BLOCK: case ID_POPUP_MIRROR_Y_BLOCK:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_MIRROR_Y, &dc ); HandleBlockEndByPopUp( BLOCK_MIRROR_Y, &dc );
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_COPY, &dc ); HandleBlockEndByPopUp( BLOCK_COPY, &dc );
break; break;
case ID_POPUP_DRAG_BLOCK: case ID_POPUP_DRAG_BLOCK:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
HandleBlockEndByPopUp( BLOCK_DRAG, &dc ); HandleBlockEndByPopUp( BLOCK_DRAG, &dc );
break; break;
case ID_POPUP_SCH_ADD_JUNCTION: case ID_POPUP_SCH_ADD_JUNCTION:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
screen->SetCurItem( AddJunction( &dc, screen->m_Curseur, true ) ); screen->SetCurItem( AddJunction( &dc, screen->GetCrossHairPosition(), true ) );
screen->TestDanglingEnds( DrawPanel, &dc ); screen->TestDanglingEnds( DrawPanel, &dc );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
break; break;
@ -739,7 +739,7 @@ void SCH_EDIT_FRAME::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
if( DrawStruct == NULL ) if( DrawStruct == NULL )
return; return;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
@ -797,11 +797,11 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
screen->ClearBlockCommand(); screen->ClearBlockCommand();
// Stop the current command (if any) but keep the current tool // Stop the current command (if any) but keep the current tool
DrawPanel->UnManageCursor(); DrawPanel->EndMouseCapture();
} }
else else
{ {
// Stop the current command (if any) but keep the current tool // Stop the current command (if any) but keep the current tool
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
} }
} }

View File

@ -398,8 +398,7 @@ int SCH_EDIT_FRAME::BestZoom()
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
zoom = MAX( (double) dx / (double) size.x, (double) dy / (double) size.y ); zoom = MAX( (double) dx / (double) size.x, (double) dy / (double) size.y );
GetScreen()->m_Curseur.x = dx / 2; GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
GetScreen()->m_Curseur.y = dy / 2;
return wxRound( zoom * (double) GetScreen()->m_ZoomScalar ); return wxRound( zoom * (double) GetScreen()->m_ZoomScalar );
} }
@ -693,12 +692,12 @@ void SCH_EDIT_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
{ {
if( m_ViewlibFrame ) if( m_ViewlibFrame )
{ {
m_ViewlibFrame->Show( TRUE ); m_ViewlibFrame->Show( true );
} }
else else
{ {
m_ViewlibFrame = new LIB_VIEW_FRAME( this ); m_ViewlibFrame = new LIB_VIEW_FRAME( this );
m_ViewlibFrame->AdjustScrollBars(); m_ViewlibFrame->AdjustScrollBars( wxPoint( 0 , 0 ) );
} }
} }
@ -707,7 +706,7 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
{ {
if( m_LibeditFrame ) if( m_LibeditFrame )
{ {
m_LibeditFrame->Show( TRUE ); m_LibeditFrame->Show( true );
} }
else else
{ {
@ -715,7 +714,7 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
wxT( "Library Editor" ), wxT( "Library Editor" ),
wxPoint( -1, -1 ), wxPoint( -1, -1 ),
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );
m_LibeditFrame->AdjustScrollBars(); m_LibeditFrame->AdjustScrollBars( wxPoint( 0, 0 ) );
} }
} }

View File

@ -210,7 +210,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( aSheet->m_SheetName.IsEmpty() ) if( aSheet->m_SheetName.IsEmpty() )
aSheet->m_SheetName.Printf( wxT( "Sheet%8.8lX" ), GetTimeStamp() ); aSheet->m_SheetName.Printf( wxT( "Sheet%8.8lX" ), GetTimeStamp() );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = false; DrawPanel->m_IgnoreMouseEvents = false;
aSheet->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); aSheet->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
@ -219,7 +219,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
/* Move selected sheet with the cursor. /* Move selected sheet with the cursor.
* Callback function use by ManageCurseur. * Callback function use by m_mouseCaptureCallback.
*/ */
static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
@ -233,13 +233,13 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( sheet->m_Flags & IS_RESIZED ) if( sheet->m_Flags & IS_RESIZED )
{ {
wxSize newSize( MAX( s_PreviousSheetWidth, screen->m_Curseur.x - sheet->m_Pos.x ), wxSize newSize( MAX( s_PreviousSheetWidth, screen->GetCrossHairPosition().x - sheet->m_Pos.x ),
MAX( s_PreviousSheetHeight, screen->m_Curseur.y - sheet->m_Pos.y ) ); MAX( s_PreviousSheetHeight, screen->GetCrossHairPosition().y - sheet->m_Pos.y ) );
sheet->Resize( newSize ); sheet->Resize( newSize );
} }
else /* Move Sheet */ else /* Move Sheet */
{ {
moveVector = screen->m_Curseur - sheet->m_Pos; moveVector = screen->GetCrossHairPosition() - sheet->m_Pos;
sheet->Move( moveVector ); sheet->Move( moveVector );
} }
@ -263,12 +263,12 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
} }
else if( (sheet->m_Flags & (IS_RESIZED|IS_MOVED)) ) else if( (sheet->m_Flags & (IS_RESIZED|IS_MOVED)) )
{ {
wxPoint curspos = screen->m_Curseur; wxPoint curspos = screen->GetCrossHairPosition();
aPanel->GetScreen()->m_Curseur = s_OldPos; aPanel->GetScreen()->SetCrossHairPosition( s_OldPos );
MoveOrResizeSheet( aPanel, aDC, wxDefaultPosition, true ); MoveOrResizeSheet( aPanel, aDC, wxDefaultPosition, true );
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
sheet->m_Flags = 0; sheet->m_Flags = 0;
screen->m_Curseur = curspos; screen->SetCrossHairPosition( curspos );
} }
else else
{ {
@ -276,8 +276,6 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
} }
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
aPanel->ManageCurseur = NULL;
aPanel->ForceCloseManageCurseur = NULL;
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
} }
@ -292,7 +290,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
SCH_SHEET* sheet = new SCH_SHEET( GetScreen()->m_Curseur ); SCH_SHEET* sheet = new SCH_SHEET( GetScreen()->GetCrossHairPosition() );
sheet->m_Flags = IS_NEW | IS_RESIZED; sheet->m_Flags = IS_NEW | IS_RESIZED;
sheet->m_TimeStamp = GetTimeStamp(); sheet->m_TimeStamp = GetTimeStamp();
@ -305,10 +303,8 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
// also need to update the hierarchy, if we are adding // also need to update the hierarchy, if we are adding
// a sheet to a screen that already has multiple instances (!) // a sheet to a screen that already has multiple instances (!)
GetScreen()->SetCurItem( sheet ); GetScreen()->SetCurItem( sheet );
DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
DrawPanel->ManageCurseur = MoveOrResizeSheet; DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, false );
DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, aDC, wxDefaultPosition, false );
return sheet; return sheet;
} }
@ -341,9 +337,8 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
sheetLabel.m_Pos.y - aSheet->m_Pos.y ); sheetLabel.m_Pos.y - aSheet->m_Pos.y );
} }
DrawPanel->ManageCurseur = MoveOrResizeSheet; DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->ManageCurseur( DrawPanel, aDC, wxDefaultPosition, true );
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo
{ {
@ -358,16 +353,15 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( ( aSheet == NULL ) || ( aSheet->Type() != SCH_SHEET_T ) ) if( ( aSheet == NULL ) || ( aSheet->Type() != SCH_SHEET_T ) )
return; return;
DrawPanel->CursorOff( aDC ); DrawPanel->CrossHairOff( aDC );
GetScreen()->m_Curseur = aSheet->m_Pos; GetScreen()->SetCrossHairPosition( aSheet->m_Pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
s_OldPos = aSheet->m_Pos; s_OldPos = aSheet->m_Pos;
aSheet->m_Flags |= IS_MOVED; aSheet->m_Flags |= IS_MOVED;
DrawPanel->ManageCurseur = MoveOrResizeSheet; DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->ManageCurseur( DrawPanel, aDC, wxDefaultPosition, true ); DrawPanel->CrossHairOn( aDC );
DrawPanel->CursorOn( aDC );
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo
{ {

View File

@ -57,8 +57,6 @@ static void ExitPinSheet( EDA_DRAW_PANEL* Panel, wxDC* DC )
} }
Panel->GetScreen()->SetCurItem( NULL ); Panel->GetScreen()->SetCurItem( NULL );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
} }
@ -86,11 +84,10 @@ void SCH_SHEET_PIN::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
m_Pos = tmp; m_Pos = tmp;
} }
ConstraintOnEdge( frame->GetScreen()->m_Curseur ); ConstraintOnEdge( frame->GetScreen()->GetCrossHairPosition() );
Sheet->Draw( frame->DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); Sheet->Draw( frame->DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
frame->DrawPanel->ManageCurseur = NULL; frame->DrawPanel->EndMouseCapture();
frame->DrawPanel->ForceCloseManageCurseur = NULL;
} }
@ -102,9 +99,8 @@ void SCH_EDIT_FRAME::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC )
s_InitialPosition = SheetLabel->m_Pos; s_InitialPosition = SheetLabel->m_Pos;
s_InitialEdge = SheetLabel->GetEdge(); s_InitialEdge = SheetLabel->GetEdge();
DrawPanel->ManageCurseur = Move_PinSheet; DrawPanel->SetMouseCapture( Move_PinSheet, ExitPinSheet );
DrawPanel->ForceCloseManageCurseur = ExitPinSheet; DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
} }
@ -119,7 +115,7 @@ static void Move_PinSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
if( aErase ) if( aErase )
SheetLabel->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); SheetLabel->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
SheetLabel->ConstraintOnEdge( aPanel->GetScreen()->m_Curseur ); SheetLabel->ConstraintOnEdge( aPanel->GetScreen()->GetCrossHairPosition() );
SheetLabel->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode ); SheetLabel->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
} }
@ -189,9 +185,8 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::Create_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
GetScreen()->SetCurItem( NewSheetLabel ); GetScreen()->SetCurItem( NewSheetLabel );
s_CurrentTypeLabel = NewSheetLabel->m_Shape; s_CurrentTypeLabel = NewSheetLabel->m_Shape;
DrawPanel->ManageCurseur = Move_PinSheet; DrawPanel->SetMouseCapture( Move_PinSheet, ExitPinSheet );
DrawPanel->ForceCloseManageCurseur = ExitPinSheet; DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
OnModify(); OnModify();
return NewSheetLabel; return NewSheetLabel;
@ -243,8 +238,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
s_CurrentTypeLabel = NewSheetLabel->m_Shape = HLabel->m_Shape; s_CurrentTypeLabel = NewSheetLabel->m_Shape = HLabel->m_Shape;
GetScreen()->SetCurItem( NewSheetLabel ); GetScreen()->SetCurItem( NewSheetLabel );
DrawPanel->ManageCurseur = Move_PinSheet; DrawPanel->SetMouseCapture( Move_PinSheet, ExitPinSheet );
DrawPanel->ForceCloseManageCurseur = ExitPinSheet;
Move_PinSheet( DrawPanel, DC, wxDefaultPosition, false ); Move_PinSheet( DrawPanel, DC, wxDefaultPosition, false );
return NewSheetLabel; return NewSheetLabel;

View File

@ -107,11 +107,8 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( item == NULL ) if( item == NULL )
return; return;
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
bool newItem = item->IsNew(); bool newItem = item->IsNew();
item->EndEdit( parent->GetScreen()->GetCursorDrawPosition(), true ); item->EndEdit( parent->GetScreen()->GetCrossHairPosition( true ), true );
if( newItem ) if( newItem )
{ {
@ -127,9 +124,8 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC )
LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC ) LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC )
{ {
DrawPanel->ManageCurseur = SymbolDisplayDraw; DrawPanel->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn; wxPoint drawPos = GetScreen()->GetCrossHairPosition( true );
wxPoint drawPos = GetScreen()->GetCursorDrawPosition();
// no temp copy -> the current version of component will be used for Undo // no temp copy -> the current version of component will be used for Undo
// This is normal when adding new items to the current component // This is normal when adding new items to the current component
@ -164,7 +160,7 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC*
DrawPanel->m_IgnoreMouseEvents = true; DrawPanel->m_IgnoreMouseEvents = true;
EditSymbolText( NULL, Text ); EditSymbolText( NULL, Text );
DrawPanel->m_IgnoreMouseEvents = false; DrawPanel->m_IgnoreMouseEvents = false;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( Text->m_Text.IsEmpty() ) if( Text->m_Text.IsEmpty() )
{ {
@ -194,16 +190,15 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC*
m_drawItem->SetConvert( m_convert ); m_drawItem->SetConvert( m_convert );
// Draw initial symbol: // Draw initial symbol:
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
} }
else else
{ {
DrawPanel->ManageCurseur = NULL; DrawPanel->EndMouseCapture();
DrawPanel->ForceCloseManageCurseur = NULL;
return NULL; return NULL;
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
return m_drawItem; return m_drawItem;
@ -217,7 +212,7 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC )
if( m_drawItem == NULL ) if( m_drawItem == NULL )
return; return;
wxPoint pos = GetScreen()->GetCursorDrawPosition(); wxPoint pos = GetScreen()->GetCrossHairPosition( true );
if( m_drawItem->ContinueEdit( pos ) ) if( m_drawItem->ContinueEdit( pos ) )
{ {
@ -251,11 +246,11 @@ static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
{ {
int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit(); int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit();
wxString text = ((LIB_FIELD*)item)->GetFullText( unit ); wxString text = ((LIB_FIELD*)item)->GetFullText( unit );
item->Draw( aPanel, aDC, Screen->GetCursorDrawPosition(), -1, g_XorMode, &text, item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), -1, g_XorMode, &text,
DefaultTransform ); DefaultTransform );
} }
else else
item->Draw( aPanel, aDC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL, item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), -1, g_XorMode, NULL,
DefaultTransform ); DefaultTransform );
} }
@ -268,10 +263,9 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC )
SetCursor( wxCURSOR_HAND ); SetCursor( wxCURSOR_HAND );
TempCopyComponent(); TempCopyComponent();
m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCursorDrawPosition() ); m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCrossHairPosition( true ) );
DrawPanel->ManageCurseur = RedrawWhileMovingCursor; DrawPanel->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn );
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn; DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
} }
@ -282,10 +276,9 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC )
return; return;
TempCopyComponent(); TempCopyComponent();
m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCursorDrawPosition() ); m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCrossHairPosition( true ) );
DrawPanel->ManageCurseur = SymbolDisplayDraw; DrawPanel->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn; DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
} }
@ -300,7 +293,7 @@ static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
return; return;
item->SetEraseLastDrawItem( aErase ); item->SetEraseLastDrawItem( aErase );
item->Draw( aPanel, aDC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL, item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), -1, g_XorMode, NULL,
DefaultTransform ); DefaultTransform );
} }
@ -328,13 +321,12 @@ void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC )
if( m_drawItem->IsNew() ) if( m_drawItem->IsNew() )
m_component->AddDrawItem( m_drawItem ); m_component->AddDrawItem( m_drawItem );
m_drawItem->EndEdit( GetScreen()->GetCursorDrawPosition() ); m_drawItem->EndEdit( GetScreen()->GetCrossHairPosition( true ) );
m_drawItem = NULL; m_drawItem = NULL;
OnModify(); OnModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->Refresh(); DrawPanel->Refresh();
} }

View File

@ -52,8 +52,8 @@ void LIB_EDIT_FRAME::LoadOneSymbol( void )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
wxFileName fn = dlg.GetPath(); wxFileName fn = dlg.GetPath();
@ -229,14 +229,13 @@ void LIB_EDIT_FRAME::PlaceAncre()
if( m_component == NULL ) if( m_component == NULL )
return; return;
wxPoint offset( -GetScreen()->m_Curseur.x, GetScreen()->m_Curseur.y ); wxPoint offset( -GetScreen()->GetCrossHairPosition().x, GetScreen()->GetCrossHairPosition().y );
OnModify( ); OnModify( );
m_component->SetOffset( offset ); m_component->SetOffset( offset );
/* Redraw the symbol */ /* Redraw the symbol */
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0; RedrawScreen( wxPoint( 0 , 0 ), true );
RedrawScreen( TRUE );
DrawPanel->Refresh(); DrawPanel->Refresh();
} }

View File

@ -301,7 +301,7 @@ void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv )
void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
{ {
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
UpdateStatusBar(); UpdateStatusBar();
} }
@ -313,8 +313,7 @@ int LIB_VIEW_FRAME::BestZoom()
LIB_COMPONENT* component; LIB_COMPONENT* component;
CMP_LIBRARY* lib; CMP_LIBRARY* lib;
GetScreen()->m_Curseur.x = 0; GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
GetScreen()->m_Curseur.y = 0;
bestzoom = 16; bestzoom = 16;
lib = CMP_LIBRARY::FindLibrary( m_libraryName ); lib = CMP_LIBRARY::FindLibrary( m_libraryName );
@ -360,7 +359,7 @@ int LIB_VIEW_FRAME::BestZoom()
(double) GetScreen()->m_ZoomScalar ); (double) GetScreen()->m_ZoomScalar );
bestzoom = MAX( ii, jj ) + 1; bestzoom = MAX( ii, jj ) + 1;
GetScreen()->m_Curseur = BoundaryBox.Centre(); GetScreen()->SetScrollCenterPosition( BoundaryBox.Centre() );
return bestzoom; return bestzoom;
} }

View File

@ -296,7 +296,7 @@ void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), m_unit, m_convert, GR_DEFAULT_DRAWMODE ); component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), m_unit, m_convert, GR_DEFAULT_DRAWMODE );
/* Redraw the cursor */ /* Redraw the cursor */
DrawPanel->DrawCursor( DC ); DrawPanel->DrawCrossHair( DC );
if( !tmp.IsEmpty() ) if( !tmp.IsEmpty() )
component->SetName( tmp ); component->SetName( tmp );

View File

@ -89,11 +89,11 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
{ {
bool err = false; bool err = false;
if( DrawPanel->ManageCurseur == NULL ) if( !DrawPanel->IsMouseCaptured() )
{ {
err = true; err = true;
DisplayError( this, DisplayError( this,
wxT( "Error in HandleBlockPLace : ManageCurseur = NULL" ) ); wxT( "Error in HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
@ -106,15 +106,17 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
Block_Move( DC ); Block_Move( DC );
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
Block_Duplicate( DC ); Block_Duplicate( DC );
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
@ -134,13 +136,10 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
break; break;
} }
DrawPanel->SetMouseCapture( NULL, NULL );
GetScreen()->SetModify(); GetScreen()->SetModify();
GetScreen()->ClearBlockCommand();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
if( GetScreen()->m_BlockLocate.GetCount() ) if( GetScreen()->m_BlockLocate.GetCount() )
{ {
DisplayError( this, wxT( "HandleBlockPLace error: some items left" ) ); DisplayError( this, wxT( "HandleBlockPLace error: some items left" ) );
@ -166,7 +165,7 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
bool nextcmd = false; bool nextcmd = false;
bool zoom_command = false; bool zoom_command = false;
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.m_Command )
{ {
@ -181,14 +180,14 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list */ case BLOCK_PRESELECT_MOVE: /* Move with preselection list */
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
nextcmd = true; nextcmd = true;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
Block_Delete( DC ); Block_Delete( DC );
break; break;
@ -211,12 +210,8 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
if( ! nextcmd ) if( ! nextcmd )
{ {
GetScreen()->m_BlockLocate.m_Flags = 0; GetScreen()->ClearBlockCommand();
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; DrawPanel->SetMouseCapture( NULL, NULL );
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->m_BlockLocate.ClearItemsList();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DisplayToolMsg( wxEmptyString ); DisplayToolMsg( wxEmptyString );
} }
@ -253,9 +248,9 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP ) if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP )
{ {
screen->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->m_BlockLocate.m_MoveVector.x = screen->GetCrossHairPosition().x -
screen->m_BlockLocate.GetRight(); screen->m_BlockLocate.GetRight();
screen->m_BlockLocate.m_MoveVector.y = screen->m_Curseur.y - screen->m_BlockLocate.m_MoveVector.y = screen->GetCrossHairPosition().y -
screen->m_BlockLocate.GetBottom(); screen->m_BlockLocate.GetBottom();
} }
@ -306,11 +301,11 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC )
wxPoint delta; wxPoint delta;
wxPoint oldpos; wxPoint oldpos;
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->GetCrossHairPosition();
DrawPanel->ManageCurseur = NULL; DrawPanel->m_mouseCaptureCallback = NULL;
GetScreen()->m_Curseur = oldpos; GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
GetScreen()->SetModify(); GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize(); GetScreen()->m_BlockLocate.Normalize();
@ -338,11 +333,11 @@ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC )
wxPoint delta; wxPoint delta;
wxPoint oldpos; wxPoint oldpos;
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->GetCrossHairPosition();
DrawPanel->ManageCurseur = NULL; DrawPanel->m_mouseCaptureCallback = NULL;
GetScreen()->m_Curseur = oldpos; GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
GetScreen()->SetModify(); GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize(); GetScreen()->m_BlockLocate.Normalize();

View File

@ -20,7 +20,7 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
int hotkey = 0; int hotkey = 0;
wxPoint pos = aPosition; wxPoint pos = aPosition;
PutOnGrid( &pos ); pos = GetScreen()->GetNearestGridPosition( pos );
if( GetScreen()->IsRefreshReq() ) if( GetScreen()->IsRefreshReq() )
{ {
@ -37,7 +37,7 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
return; return;
} }
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize(); gridSize = GetScreen()->GetGridSize();
switch( g_KeyPressed ) switch( g_KeyPressed )
@ -71,19 +71,19 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
break; break;
} }
GetScreen()->m_Curseur = pos; GetScreen()->SetCrossHairPosition( pos );
if( oldpos != GetScreen()->m_Curseur ) if( oldpos != GetScreen()->GetCrossHairPosition() )
{ {
pos = GetScreen()->m_Curseur; pos = GetScreen()->GetCrossHairPosition();
GetScreen()->m_Curseur = oldpos; GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->CursorOff( aDC ); DrawPanel->CrossHairOff( aDC );
GetScreen()->m_Curseur = pos; GetScreen()->SetCrossHairPosition( pos );
DrawPanel->CursorOn( aDC ); DrawPanel->CrossHairOn( aDC );
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, true ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true );
} }
} }

View File

@ -97,10 +97,10 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
TraceWorkSheet( DC, screen, 0 ); TraceWorkSheet( DC, screen, 0 );
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->DrawCursor( DC ); DrawPanel->DrawCrossHair( DC );
// Display the filename and the layer name (found in the gerber files, if any) // Display the filename and the layer name (found in the gerber files, if any)
// relative to the active layer // relative to the active layer

View File

@ -97,7 +97,8 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
DrawPanel->UnManageCursor( ); DrawPanel->EndMouseCapture( );
/* Should not be executed, except bug */ /* Should not be executed, except bug */
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE ) if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
{ {
@ -105,14 +106,16 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
} }
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
SetToolID( 0, 0, wxEmptyString ); SetToolID( 0, 0, wxEmptyString );
else else
DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() ); DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() );
break; break;
default: default:
DrawPanel->UnManageCursor( ); DrawPanel->EndMouseCapture( );
break; break;
} }

View File

@ -247,7 +247,7 @@ int WinEDA_GerberFrame::BestZoom()
x = (double) bbox.GetWidth() / (double) size.x; x = (double) bbox.GetWidth() / (double) size.x;
y = (double) bbox.GetHeight() / (double) size.y; y = (double) bbox.GetHeight() / (double) size.y;
GetScreen()->m_Curseur = bbox.Centre(); GetScreen()->SetScrollCenterPosition( bbox.Centre() );
int best_zoom = wxRound( MAX( x, y ) * (double) GetScreen()->m_ZoomScalar ); int best_zoom = wxRound( MAX( x, y ) * (double) GetScreen()->m_ZoomScalar );
return best_zoom; return best_zoom;

View File

@ -126,7 +126,7 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
break; break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */ case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:

View File

@ -15,12 +15,13 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
wxPoint ref; wxPoint ref;
bool found = false; bool found = false;
if( aTypeloc == CURSEUR_ON_GRILLE ) if( aTypeloc == CURSEUR_ON_GRILLE )
ref = GetScreen()->m_Curseur; ref = GetScreen()->GetCrossHairPosition();
else else
ref = GetScreen()->m_MousePosition; ref = GetScreen()->m_MousePosition;
int layer = GetScreen()->m_Active_Layer; int layer = GetScreen()->m_Active_Layer;
// Search first on active layer // Search first on active layer
BOARD_ITEM* item = GetBoard()->m_Drawings; BOARD_ITEM* item = GetBoard()->m_Drawings;

View File

@ -54,7 +54,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD: case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message( wxEmptyString ); SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = state; DisplayOpt.DisplayPolarCood = state;
UpdateStatusBar(); UpdateStatusBar();
break; break;

View File

@ -62,10 +62,18 @@ class BASE_SCREEN : public EDA_ITEM
char m_FlagSave; ///< Indicates automatic file save. char m_FlagSave; ///< Indicates automatic file save.
EDA_ITEM* m_CurrentItem; ///< Currently selected object EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection. GRID_TYPE m_Grid; ///< Current grid selection.
wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
/**
* The cross hair position in logical (drawing) units. The cross hair is not the cursor
* position. It is an addition indicator typically drawn on grid to indicate to the
* user where the current action will be performed.
*/
wxPoint m_crossHairPosition;
public: public:
wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */ wxPoint m_DrawOrg; /* offsets for drawing the circuit on the screen */
wxPoint m_Curseur; /* Screen cursor coordinate (on grid) in user units. */
wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */ wxPoint m_MousePosition; /* Mouse cursor coordinate (off grid) in user units. */
wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid) wxPoint m_O_Curseur; /* Relative Screen cursor coordinate (on grid)
* in user units. (coordinates from last reset position)*/ * in user units. (coordinates from last reset position)*/
@ -151,14 +159,28 @@ public:
virtual int GetInternalUnits( void ); virtual int GetInternalUnits( void );
/** /**
* Return the current cursor position in drawing coordinates. * Function GetCrossHairPosition
* * return the current cross hair position in logical (drawing) coordinates.
* This call inverts the Y axis coordinated of m_Curseur to correct for the difference * @param aInvertY Inverts the Y axis position.
* between the wxWidgets GDI and the Kicad drawing coordinates. * @return The cross hair position in drawing coordinates.
*
* @return - The cursor position in drawing coordinates.
*/ */
wxPoint GetCursorDrawPosition() { return wxPoint( m_Curseur.x, -m_Curseur.y ); } wxPoint GetCrossHairPosition( bool aInvertY = false ) const
{
if( aInvertY )
return wxPoint( m_crossHairPosition.x, -m_crossHairPosition.y );
return wxPoint( m_crossHairPosition.x, m_crossHairPosition.y );
}
/**
* Function SetCrossHairPosition
* sets the screen cross hair position to \a aPosition in logical (drawing) units.
* @param aPosition The new cross hair position.
* @param aSnapToGrid Sets the cross hair position to the nearest grid position to
* \a aPosition.
*
*/
void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
/* general Undo/Redo command control */ /* general Undo/Redo command control */
@ -352,7 +374,7 @@ public:
*/ */
wxPoint RefPos( bool useMouse ) wxPoint RefPos( bool useMouse )
{ {
return useMouse ? m_MousePosition : m_Curseur; return useMouse ? m_MousePosition : m_crossHairPosition;
} }
/** /**
@ -408,6 +430,12 @@ public:
void ClearBlockCommand() { m_BlockLocate.Clear(); } void ClearBlockCommand() { m_BlockLocate.Clear(); }
wxPoint GetScrollCenterPosition() const { return m_scrollCenter; }
void SetScrollCenterPosition( const wxPoint& aCenterPosition )
{
m_scrollCenter = aCenterPosition;
}
#if defined(DEBUG) #if defined(DEBUG)
/** /**

View File

@ -15,6 +15,18 @@ class BASE_SCREEN;
class PCB_SCREEN; class PCB_SCREEN;
/**
* Mouse capture callback function prototype.
*/
typedef void ( *MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase );
/**
* End mouse capture callback function prototype.
*/
typedef void ( *END_MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
class EDA_DRAW_PANEL : public wxScrolledWindow class EDA_DRAW_PANEL : public wxScrolledWindow
{ {
private: private:
@ -53,12 +65,11 @@ public:
/* Cursor management (used in editing functions) */ /* Cursor management (used in editing functions) */
/* Mouse capture move callback function prototype. */ /* Mouse capture move callback function. */
void (*ManageCurseur)( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback;
bool aErase );
/* Abort managed cursor callback function prototype. */ /* Abort mouse capture callback function. */
void (*ForceCloseManageCurseur)( EDA_DRAW_PANEL* aPanel, wxDC* aDC ); END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback;
public: public:
@ -123,10 +134,10 @@ public:
void OnActivate( wxActivateEvent& event ); void OnActivate( wxActivateEvent& event );
/** /**
* Fucntion DoPrepareDC * Function DoPrepareDC
* sets up the device context \a aDC for drawing. * sets up the device context \a aDC for drawing.
* <p> * <p>
* This overrides wxScrolledWindow::DoPrepareDC() for settting up the the device context * This overrides wxScrolledWindow::DoPrepareDC() for setting up the the device context
* used for drawing. The scale factor and drawing logical offset are set and the base * used for drawing. The scale factor and drawing logical offset are set and the base
* method is called to set the DC device origin (scroll bar position). This connects * method is called to set the DC device origin (scroll bar position). This connects
* everything together to achieve the appropriate coordinate manipulation using wxDC * everything together to achieve the appropriate coordinate manipulation using wxDC
@ -153,7 +164,7 @@ public:
/* Mouse and keys events */ /* Mouse and keys events */
/** /**
* Funtion OnMouseWheel * Function OnMouseWheel
* handles mouse wheel events. * handles mouse wheel events.
* <p> * <p>
* The mouse wheel is used to provide support for zooming and panning. This * The mouse wheel is used to provide support for zooming and panning. This
@ -188,7 +199,7 @@ public:
* Function IsPointOnDisplay * Function IsPointOnDisplay
* @param aPosition The position to test in logical (drawing) units. * @param aPosition The position to test in logical (drawing) units.
* @return true if \a aPosition is visible on the screen. * @return true if \a aPosition is visible on the screen.
* false if \a aPosition is not visiable on the screen. * false if \a aPosition is not visible on the screen.
*/ */
bool IsPointOnDisplay( const wxPoint& aPosition ); bool IsPointOnDisplay( const wxPoint& aPosition );
@ -227,7 +238,11 @@ public:
*/ */
wxPoint GetScreenCenterLogicalPosition(); wxPoint GetScreenCenterLogicalPosition();
void MouseToCursorSchema(); /**
* Function MoveCursorToCrossHair
* warps the cursor to the current cross hair position.
*/
void MoveCursorToCrossHair();
/** /**
* Function MoveCursor * Function MoveCursor
@ -238,27 +253,40 @@ public:
/* Cursor functions */ /* Cursor functions */
/** /**
* Draw the user cursor. * Function DrawCrossHair
* * draws the user cross hair.
* The user cursor is not the mouse cursor although they may be at the * <p>
* same screen position. The mouse cursor is still render by the OS. * The user cross hair is not the mouse cursor although they may be at the same screen
* This is a drawn cross hair that is used to snap to grid when grid snapping * position. The mouse cursor is still render by the OS. This is a drawn cross hair
* is enabled. This is required because OSX does not allow moving the * that is used to snap to grid when grid snapping is enabled. This is as an indicator
* cursor programmatically. * to where the next user action will take place.
* * </p>
* @param aDC - the device context to draw the cursor * @param aDC - the device context to draw the cursor
* @param aColor - the color to draw the cursor * @param aColor - the color to draw the cursor
*/ */
void DrawCursor( wxDC* aDC, int aColor = WHITE ); void DrawCrossHair( wxDC* aDC, int aColor = WHITE );
// remove the grid cursor from the display // Hide the cross hair.
void CursorOff( wxDC* DC ); void CrossHairOff( wxDC* DC );
// display the grid cursor // Show the cross hair.
void CursorOn( wxDC* DC ); void CrossHairOn( wxDC* DC );
/** /**
* Release managed cursor. * Function SetMouseCapture
* sets the mouse capture and end mouse capture callbacks to \a aMouseCaptureCallback
* and \a aEndMouseCaptureCallback respectively.
*/
void SetMouseCapture( MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback,
END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback )
{
m_mouseCaptureCallback = aMouseCaptureCallback;
m_endMouseCaptureCallback = aEndMouseCaptureCallback;
}
/**
* Function EndMouseCapture
* ends mouse a capture.
* *
* Check to see if the cursor is being managed for block or editing commands and release it. * Check to see if the cursor is being managed for block or editing commands and release it.
* @param aId The command ID to restore or -1 to keep the current command ID. * @param aId The command ID to restore or -1 to keep the current command ID.
@ -267,7 +295,10 @@ public:
* @param aTitle The tool message to display in the status bar or wxEmptyString to clear * @param aTitle The tool message to display in the status bar or wxEmptyString to clear
* the message. * the message.
*/ */
void UnManageCursor( int aId = -1, int aCursorId = -1, const wxString& aTitle = wxEmptyString ); void EndMouseCapture( int aId = -1, int aCursorId = -1,
const wxString& aTitle = wxEmptyString );
inline bool IsMouseCaptured() const { return m_mouseCaptureCallback != NULL; }
int GetDefaultCursor() const { return m_defaultCursor; } int GetDefaultCursor() const { return m_defaultCursor; }
@ -275,4 +306,34 @@ public:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
/**
* Class EDA_CROSS_HAIR_MANAGER
* is used to hide the cross hair and restore it when the class goes out of scope.
*/
class EDA_CROSS_HAIR_MANAGER
{
public:
EDA_CROSS_HAIR_MANAGER( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) :
m_panel( aPanel ),
m_dc( aDC )
{
if( aPanel && aDC )
aPanel->CrossHairOff( aDC );
}
~EDA_CROSS_HAIR_MANAGER()
{
if( m_panel && m_dc )
m_panel->CrossHairOn( m_dc );
}
private:
EDA_DRAW_PANEL* m_panel;
wxDC* m_dc;
DECLARE_NO_COPY_CLASS( EDA_CROSS_HAIR_MANAGER )
};
#endif /* #ifndef PANEL_WXSTRUCT_H */ #endif /* #ifndef PANEL_WXSTRUCT_H */

View File

@ -281,7 +281,6 @@ public:
*/ */
virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu ); virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
void Affiche_Message( const wxString& message );
void EraseMsgBox(); void EraseMsgBox();
void Process_PageSettings( wxCommandEvent& event ); void Process_PageSettings( wxCommandEvent& event );
virtual void SetToolbars(); virtual void SetToolbars();
@ -297,6 +296,7 @@ public:
virtual void ReCreateVToolbar() = 0; virtual void ReCreateVToolbar() = 0;
virtual void ReCreateMenuBar(); virtual void ReCreateMenuBar();
virtual void ReCreateAuxiliaryToolbar(); virtual void ReCreateAuxiliaryToolbar();
/** /**
* Function SetToolID * Function SetToolID
* Enables the icon of the selected tool in the vertical toolbar. * Enables the icon of the selected tool in the vertical toolbar.
@ -392,28 +392,19 @@ public:
virtual void OnSize( wxSizeEvent& event ); virtual void OnSize( wxSizeEvent& event );
void OnEraseBackground( wxEraseEvent& SizeEvent ); void OnEraseBackground( wxEraseEvent& SizeEvent );
void SetToolbarBgColor( int color_num );
virtual void OnZoom( wxCommandEvent& event ); virtual void OnZoom( wxCommandEvent& event );
void OnGrid( int grid_type ); void OnGrid( int grid_type );
/** /**
* Function RedrawScreen * Function RedrawScreen
* redraws the entire screen area by updating the scroll bars and mouse pointer in * redraws the entire screen area by updating the scroll bars and mouse pointer in
* order to have the current graphic cursor position at the center of the screen. * order to have \a aCenterPoint at the center of the screen.
* @param aWarpPointer Moves the mouse cursor is to the drawing position ( which * @param aCenterPoint The position in logical units to center the scroll bars.
* is usually on grid) if true. * @param aWarpPointer Moves the mouse cursor to \a aCenterPoint if true.
*
* Note: Mac OS ** does not ** allow moving mouse cursor by program.
*/ */
void RedrawScreen( bool aWarpPointer ); void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
/** Adjust the coordinate to the nearest grid value void Zoom_Automatique( bool aWarpPointer );
* @param aCoord = coordinate to adjust
* @param aGridSize = pointer to a grid value. if NULL uses the current grid size
*/
void PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize = NULL );
void Zoom_Automatique( bool move_mouse_cursor );
/* Set the zoom level to show the area Rect */ /* Set the zoom level to show the area Rect */
void Window_Zoom( EDA_Rect& Rect ); void Window_Zoom( EDA_Rect& Rect );
@ -438,14 +429,12 @@ public:
wxString GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition ); wxString GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition );
void DisplayToolMsg( const wxString& msg ); void DisplayToolMsg( const wxString& msg );
void Process_Zoom( wxCommandEvent& event );
void Process_Grid( wxCommandEvent& event );
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0; virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0; virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ToolOnRightClick( wxCommandEvent& event ); virtual void ToolOnRightClick( wxCommandEvent& event );
void AdjustScrollBars(); void AdjustScrollBars( const wxPoint& aCenterPosition );
/** /**
* Function OnActivate (virtual) * Function OnActivate (virtual)
@ -544,9 +533,7 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used) * @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/ */
virtual void PrintPage( wxDC* aDC, virtual void PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
int aPrintMask, bool aPrintMirrorMode,
void * aData = NULL);
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -22,10 +22,10 @@ void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
return; return;
OnModify(); OnModify();
DrawPanel->CursorOff( DC ); // Erase cursor shape DrawPanel->CrossHairOff( DC ); // Erase cursor shape
track->SetState( SEGM_FIXE, Flag_On ); track->SetState( SEGM_FIXE, Flag_On );
track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL ); track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
DrawPanel->CursorOn( DC ); // Display cursor shape DrawPanel->CrossHairOn( DC ); // Display cursor shape
track->DisplayInfo( this ); track->DisplayInfo( this );
} }
@ -39,7 +39,7 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
if( (track == NULL ) || (track->Type() == TYPE_ZONE) ) if( (track == NULL ) || (track->Type() == TYPE_ZONE) )
return; return;
DrawPanel->CursorOff( DC ); // Erase cursor shape DrawPanel->CrossHairOff( DC ); // Erase cursor shape
Track = Marque_Une_Piste( GetBoard(), track, &nb_segm, NULL, true ); Track = Marque_Une_Piste( GetBoard(), track, &nb_segm, NULL, true );
Trace_Une_Piste( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL ); Trace_Une_Piste( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL );
@ -50,7 +50,7 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
Track = Track->Next(); Track = Track->Next();
} }
DrawPanel->CursorOn( DC ); // Display cursor shape DrawPanel->CrossHairOn( DC ); // Display cursor shape
OnModify(); OnModify();
} }
@ -74,7 +74,7 @@ void WinEDA_PcbFrame::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
} }
} }
DrawPanel->CursorOff( DC ); // Erase cursor shape DrawPanel->CrossHairOff( DC ); // Erase cursor shape
while( Track ) /* Flag change */ while( Track ) /* Flag change */
{ {
if( (net_code >= 0 ) && (net_code != Track->GetNet()) ) if( (net_code >= 0 ) && (net_code != Track->GetNet()) )
@ -86,6 +86,6 @@ void WinEDA_PcbFrame::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
Track = Track->Next(); Track = Track->Next();
} }
DrawPanel->CursorOn( DC ); // Display cursor shape DrawPanel->CrossHairOn( DC ); // Display cursor shape
OnModify(); OnModify();
} }

View File

@ -90,15 +90,14 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
return; return;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( DrawPanel->ManageCurseur if( DrawPanel->IsMouseCaptured() )
&& DrawPanel->ForceCloseManageCurseur )
{ {
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
} }
break; break;
default: // Abort a current command (if any) default: // Abort a current command (if any)
DrawPanel->UnManageCursor( 0, DrawPanel->GetDefaultCursor() ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
break; break;
} }
@ -211,10 +210,8 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
*/ */
if( PlaceModulesHorsPcb && edgesExists ) if( PlaceModulesHorsPcb && edgesExists )
{ {
if( GetScreen()->m_Curseur.y < if( GetScreen()->GetCrossHairPosition().y < (GetBoard()->m_BoundaryBox.GetBottom() + 2000) )
(GetBoard()->m_BoundaryBox.GetBottom() + 2000) ) GetScreen()->GetCrossHairPosition().y = GetBoard()->m_BoundaryBox.GetBottom() + 2000;
GetScreen()->m_Curseur.y = GetBoard()->m_BoundaryBox.GetBottom() +
2000;
} }
/* calculate the area needed by footprints */ /* calculate the area needed by footprints */
@ -232,7 +229,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
Xsize_allowed = (int) ( sqrt( surface ) * 4.0 / 3.0 ); Xsize_allowed = (int) ( sqrt( surface ) * 4.0 / 3.0 );
start = current = GetScreen()->m_Curseur; start = current = GetScreen()->GetCrossHairPosition();
Ymax_size = 0; Ymax_size = 0;
for( unsigned ii = 0; ii < moduleList.size(); ii++ ) for( unsigned ii = 0; ii < moduleList.size(); ii++ )
@ -254,14 +251,10 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
Ymax_size = 0; Ymax_size = 0;
} }
GetScreen()->m_Curseur.x = GetScreen()->SetCrossHairPosition( current + Module->m_Pos -
current.x + Module->m_Pos.x - Module->m_RealBoundaryBox.GetX(); Module->m_RealBoundaryBox.GetPosition() );
GetScreen()->m_Curseur.y =
current.y + Module->m_Pos.y - Module->m_RealBoundaryBox.GetY();
Ymax_size = MAX( Ymax_size, Module->m_RealBoundaryBox.GetHeight() ); Ymax_size = MAX( Ymax_size, Module->m_RealBoundaryBox.GetHeight() );
PutOnGrid( &GetScreen()->m_Curseur );
Place_Module( Module, NULL, true ); Place_Module( Module, NULL, true );
current.x += Module->m_RealBoundaryBox.GetWidth() + pas_grille; current.x += Module->m_RealBoundaryBox.GetWidth() + pas_grille;

View File

@ -276,10 +276,10 @@ end_of_tst:
break; break;
/* Place module. */ /* Place module. */
CurrPosition = GetScreen()->m_Curseur; CurrPosition = GetScreen()->GetCrossHairPosition();
GetScreen()->m_Curseur = PosOK; GetScreen()->SetCrossHairPosition( PosOK );
Place_Module( Module, DC ); Place_Module( Module, DC );
GetScreen()->m_Curseur = CurrPosition; GetScreen()->SetCrossHairPosition( CurrPosition );
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
Module->SetRectangleExinscrit(); Module->SetRectangleExinscrit();
@ -616,7 +616,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
DrawModuleOutlines( DrawPanel, DC, Module ); DrawModuleOutlines( DrawPanel, DC, Module );
mincout = -1.0; mincout = -1.0;
Affiche_Message( wxT( "Score ??, pos ??" ) ); SetStatusText( wxT( "Score ??, pos ??" ) );
for( ; CurrPosition.x < GetBoard()->m_BoundaryBox.GetRight() - fx; for( ; CurrPosition.x < GetBoard()->m_BoundaryBox.GetRight() - fx;
CurrPosition.x += g_GridRoutingSize ) CurrPosition.x += g_GridRoutingSize )
@ -674,7 +674,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
(int) mincout, (int) mincout,
(float) LastPosOK.x / 10000, (float) LastPosOK.x / 10000,
(float) LastPosOK.y / 10000 ); (float) LastPosOK.y / 10000 );
Affiche_Message( msg ); SetStatusText( msg );
} }
} }
if( DisplayChevelu ) if( DisplayChevelu )

View File

@ -158,7 +158,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
return; return;
} }
Affiche_Message( _( "Place Cells" ) ); SetStatusText( _( "Place Cells" ) );
PlaceCells( GetBoard(), -1, FORCE_PADS ); PlaceCells( GetBoard(), -1, FORCE_PADS );
/* Construction of the track list for router. */ /* Construction of the track list for router. */
@ -176,9 +176,8 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
InitWork(); /* Free memory for the list of router connections. */ InitWork(); /* Free memory for the list of router connections. */
Board.UnInitBoard(); Board.UnInitBoard();
stop = time( NULL ) - start; stop = time( NULL ) - start;
msg.Printf( wxT( "time = %d second%s" ), stop, msg.Printf( wxT( "time = %d second%s" ), stop, ( stop == 1 ) ? wxT( "" ) : wxT( "s" ) );
( stop == 1 ) ? wxT( "" ) : wxT( "s" ) ); SetStatusText( msg );
Affiche_Message( msg );
} }

View File

@ -112,7 +112,7 @@ int WinEDA_BasePcbFrame::BestZoom( void )
else else
jj = 31; jj = 31;
bestzoom = MAX( ii, jj ) + 1; bestzoom = MAX( ii, jj ) + 1;
GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); GetScreen()->SetScrollCenterPosition( m_Pcb->m_BoundaryBox.Centre() );
return bestzoom * GetScreen()->m_ZoomScalar; return bestzoom * GetScreen()->m_ZoomScalar;
} }
@ -129,16 +129,15 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
/* There may be need to reframe the drawing. */ /* There may be need to reframe the drawing. */
if( !DrawPanel->IsPointOnDisplay( aPos ) ) if( !DrawPanel->IsPointOnDisplay( aPos ) )
{ {
screen->m_Curseur = aPos; RedrawScreen( aPos, true );
RedrawScreen( true );
} }
else else
{ {
// Put cursor on item position // Put cursor on item position
DrawPanel->CursorOff( &dc ); DrawPanel->CrossHairOff( &dc );
screen->m_Curseur = aPos; screen->SetCrossHairPosition( aPos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->CursorOn( &dc ); DrawPanel->CrossHairOn( &dc );
} }
} }
@ -323,8 +322,8 @@ void WinEDA_BasePcbFrame::UpdateStatusBar()
wxString Line; wxString Line;
double theta, ro; double theta, ro;
int dx = screen->m_Curseur.x - screen->m_O_Curseur.x; int dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
int dy = screen->m_Curseur.y - screen->m_O_Curseur.y; int dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
if( dx==0 && dy==0 ) if( dx==0 && dy==0 )
theta = 0.0; theta = 0.0;

View File

@ -85,15 +85,15 @@ private:
static bool InstallBlockCmdFrame( WinEDA_BasePcbFrame* parent, const wxString& title ) static bool InstallBlockCmdFrame( WinEDA_BasePcbFrame* parent, const wxString& title )
{ {
int nocmd; int nocmd;
wxPoint oldpos = parent->GetScreen()->m_Curseur; wxPoint oldpos = parent->GetScreen()->GetCrossHairPosition();
parent->DrawPanel->m_IgnoreMouseEvents = true; parent->DrawPanel->m_IgnoreMouseEvents = true;
DIALOG_BLOCK_OPTIONS dlg( parent, title ); DIALOG_BLOCK_OPTIONS dlg( parent, title );
nocmd = dlg.ShowModal(); nocmd = dlg.ShowModal();
parent->GetScreen()->m_Curseur = oldpos; parent->GetScreen()->SetCrossHairPosition( oldpos );
parent->DrawPanel->MouseToCursorSchema(); parent->DrawPanel->MoveCursorToCrossHair();
parent->DrawPanel->m_IgnoreMouseEvents = false; parent->DrawPanel->m_IgnoreMouseEvents = false;
parent->DrawPanel->SetCursor( parent->DrawPanel->GetDefaultCursor() ); parent->DrawPanel->SetCursor( parent->DrawPanel->GetDefaultCursor() );
@ -201,11 +201,12 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
{ {
bool err = false; bool err = false;
if( DrawPanel->ManageCurseur == NULL ) if( !DrawPanel->IsMouseCaptured() )
{ {
err = true; err = true;
DisplayError( this, wxT( "Error in HandleBlockPLace : ManageCurseur = NULL" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.m_Command )
@ -217,15 +218,17 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
Block_Move(); Block_Move();
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
Block_Duplicate(); Block_Duplicate();
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
@ -240,11 +243,9 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
OnModify(); OnModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL; GetScreen()->ClearBlockCommand();
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
if( GetScreen()->m_BlockLocate.GetCount() ) if( GetScreen()->m_BlockLocate.GetCount() )
{ {
DisplayError( this, wxT( "Error in HandleBlockPLace some items left in list" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace some items left in list" ) );
@ -274,11 +275,8 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
// If coming here after cancel block, clean up and exit // If coming here after cancel block, clean up and exit
if( GetScreen()->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( GetScreen()->m_BlockLocate.m_State == STATE_NO_BLOCK )
{ {
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL; GetScreen()->ClearBlockCommand();
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->m_BlockLocate.ClearItemsList();
DisplayToolMsg( wxEmptyString ); DisplayToolMsg( wxEmptyString );
return false; return false;
} }
@ -292,7 +290,7 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
cancelCmd = true; cancelCmd = true;
// undraw block outline // undraw block outline
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
} }
else else
{ {
@ -307,7 +305,7 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
} }
} }
if( !cancelCmd && DrawPanel->ManageCurseur ) if( !cancelCmd && DrawPanel->IsMouseCaptured() )
{ {
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.m_Command )
{ {
@ -321,24 +319,24 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
nextcmd = true; nextcmd = true;
DrawPanel->ManageCurseur = drawMovingBlock; DrawPanel->m_mouseCaptureCallback = drawMovingBlock;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
DrawPanel->ManageCurseur = NULL; DrawPanel->m_mouseCaptureCallback = NULL;
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
Block_Delete(); Block_Delete();
break; break;
case BLOCK_ROTATE: /* Rotation */ case BLOCK_ROTATE: /* Rotation */
DrawPanel->ManageCurseur = NULL; DrawPanel->m_mouseCaptureCallback = NULL;
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
Block_Rotate(); Block_Rotate();
break; break;
case BLOCK_FLIP: /* Flip */ case BLOCK_FLIP: /* Flip */
DrawPanel->ManageCurseur = NULL; DrawPanel->m_mouseCaptureCallback = NULL;
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
Block_Flip(); Block_Flip();
break; break;
@ -358,7 +356,7 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
// Turn off the redraw block routine now so it is not displayed // Turn off the redraw block routine now so it is not displayed
// with one corner at the new center of the screen // with one corner at the new center of the screen
DrawPanel->ManageCurseur = NULL; DrawPanel->m_mouseCaptureCallback = NULL;
Window_Zoom( GetScreen()->m_BlockLocate ); Window_Zoom( GetScreen()->m_BlockLocate );
break; break;
@ -369,12 +367,8 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
if( ! nextcmd ) if( ! nextcmd )
{ {
GetScreen()->m_BlockLocate.m_Flags = 0; GetScreen()->ClearBlockCommand();
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; DrawPanel->SetMouseCapture( NULL, NULL );
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->m_BlockLocate.ClearItemsList();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DisplayToolMsg( wxEmptyString ); DisplayToolMsg( wxEmptyString );
} }
@ -583,7 +577,7 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP ) if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP )
{ {
screen->m_BlockLocate.m_MoveVector = screen->m_Curseur - screen->m_BlockLocate.m_MoveVector = screen->GetCrossHairPosition() -
screen->m_BlockLocate.m_BlockLastCursorPosition; screen->m_BlockLocate.m_BlockLastCursorPosition;
} }
@ -671,7 +665,7 @@ void WinEDA_PcbFrame::Block_Rotate()
wxPoint centre; // rotation cent-re for the rotation transform wxPoint centre; // rotation cent-re for the rotation transform
int rotAngle = 900; // rotation angle in 0.1 deg. int rotAngle = 900; // rotation angle in 0.1 deg.
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->GetCrossHairPosition();
centre = GetScreen()->m_BlockLocate.Centre(); centre = GetScreen()->m_BlockLocate.Centre();
OnModify(); OnModify();
@ -740,7 +734,7 @@ void WinEDA_PcbFrame::Block_Flip()
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection; PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection;
itemsList->m_Status = UR_FLIPPED; itemsList->m_Status = UR_FLIPPED;
memo = GetScreen()->m_Curseur; memo = GetScreen()->GetCrossHairPosition();
center = GetScreen()->m_BlockLocate.Centre(); center = GetScreen()->m_BlockLocate.Centre();

View File

@ -103,14 +103,13 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
{ {
BlockState state = GetScreen()->m_BlockLocate.m_State; BlockState state = GetScreen()->m_BlockLocate.m_State;
CmdBlockType command = GetScreen()->m_BlockLocate.m_Command; CmdBlockType command = GetScreen()->m_BlockLocate.m_Command;
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC ); DrawPanel->m_endMouseCaptureCallback( DrawPanel, DC );
GetScreen()->m_BlockLocate.m_State = state; GetScreen()->m_BlockLocate.m_State = state;
GetScreen()->m_BlockLocate.m_Command = command; GetScreen()->m_BlockLocate.m_Command = command;
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines; DrawPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand; GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
GetScreen()->m_Curseur.x = GetScreen()->m_BlockLocate.GetRight(); GetScreen()->m_BlockLocate.GetBottom() ) );
GetScreen()->m_Curseur.y = GetScreen()->m_BlockLocate.GetBottom(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->MouseToCursorSchema();
} }
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.m_Command )
@ -127,12 +126,14 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
if( itemsCount ) if( itemsCount )
{ {
nextcmd = true; nextcmd = true;
if( DrawPanel->ManageCurseur != NULL )
if( DrawPanel->IsMouseCaptured() )
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
@ -140,7 +141,7 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
nextcmd = true; nextcmd = true;
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
break; break;
@ -189,16 +190,13 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
{ {
ClearMarkItems( currentModule ); ClearMarkItems( currentModule );
} }
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
DrawPanel->Refresh( TRUE );
}
GetScreen()->ClearBlockCommand();
SetCurItem( NULL );
DrawPanel->SetMouseCapture( NULL, NULL );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
DrawPanel->Refresh( true );
}
return nextcmd; return nextcmd;
} }
@ -217,10 +215,10 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
bool err = FALSE; bool err = FALSE;
MODULE* currentModule = GetBoard()->m_Modules; MODULE* currentModule = GetBoard()->m_Modules;
if( DrawPanel->ManageCurseur == NULL ) if( !DrawPanel->IsMouseCaptured() )
{ {
err = TRUE; err = TRUE;
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) ); DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
@ -272,14 +270,12 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
OnModify(); OnModify();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->m_BlockLocate.m_Flags = 0; GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->Refresh( true );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
} }
@ -339,7 +335,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
} }
/* Repaint new view. */ /* Repaint new view. */
PtBlock->m_MoveVector = screen->m_Curseur - PtBlock->m_BlockLastCursorPosition; PtBlock->m_MoveVector = screen->GetCrossHairPosition() - PtBlock->m_BlockLastCursorPosition;
PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color ); PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );

View File

@ -74,7 +74,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC,
if( aCleanVias ) // delete redundant vias if( aCleanVias ) // delete redundant vias
{ {
frame->Affiche_Message( _( "Clean vias" ) ); frame->SetStatusText( _( "Clean vias" ) );
clean_vias( frame->GetBoard() ); clean_vias( frame->GetBoard() );
} }
@ -83,7 +83,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC,
but is not on the pad or the via center */ but is not on the pad or the via center */
if( aConnectToPads ) if( aConnectToPads )
{ {
frame->Affiche_Message( _( "Reconnect pads" ) ); frame->SetStatusText( _( "Reconnect pads" ) );
/* Create missing segments when a track end covers a pad, but is not on the pad center */ /* Create missing segments when a track end covers a pad, but is not on the pad center */
ConnectDanglingEndToPad( frame, DC ); ConnectDanglingEndToPad( frame, DC );
@ -98,18 +98,18 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC,
/* Remove null segments and intermediate points on aligned segments */ /* Remove null segments and intermediate points on aligned segments */
if( aMergeSegments ) if( aMergeSegments )
{ {
frame->Affiche_Message( _( "Merge track segments" ) ); frame->SetStatusText( _( "Merge track segments" ) );
clean_segments( frame ); clean_segments( frame );
} }
/* Delete dangling tracks */ /* Delete dangling tracks */
if( aDeleteUnconnectedSegm ) if( aDeleteUnconnectedSegm )
{ {
frame->Affiche_Message( _( "Delete unconnected tracks" ) ); frame->SetStatusText( _( "Delete unconnected tracks" ) );
DeleteUnconnectedTracks( frame, DC ); DeleteUnconnectedTracks( frame, DC );
} }
frame->Affiche_Message( _( "Cleanup finished" ) ); frame->SetStatusText( _( "Cleanup finished" ) );
frame->Compile_Ratsnest( DC, true ); frame->Compile_Ratsnest( DC, true );

View File

@ -370,7 +370,7 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
m_Pcb->GetRatsnestsCount(), m_Pcb->GetNoconnectCount(), m_Pcb->GetRatsnestsCount(), m_Pcb->GetNoconnectCount(),
nb_net_noconnect ); nb_net_noconnect );
Affiche_Message( msg ); SetStatusText( msg );
return; return;
} }

View File

@ -214,7 +214,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
DrawPanel->m_AbortRequest = true; // changed in false if an item DrawPanel->m_AbortRequest = true; // changed in false if an item
PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
// DrawPanel->m_IgnoreMouseEvents = false; // DrawPanel->m_IgnoreMouseEvents = false;
@ -231,9 +231,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
wxRealPoint gridSize; wxRealPoint gridSize;
wxPoint oldpos; wxPoint oldpos;
int hotkey = 0; int hotkey = 0;
wxPoint pos = aPosition; wxPoint pos = GetScreen()->GetNearestGridPosition( aPosition );
PutOnGrid( &pos );
// Save the board after the time out : // Save the board after the time out :
int CurrentTime = time( NULL ); int CurrentTime = time( NULL );
@ -262,7 +260,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
SetTitle( GetScreen()->GetFileName() ); SetTitle( GetScreen()->GetFileName() );
} }
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize(); gridSize = GetScreen()->GetGridSize();
@ -298,7 +296,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
} }
// 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 = pos; GetScreen()->SetCrossHairPosition( pos );
/* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the /* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the
* cursor is left off grid this is better to reach items to delete off grid, * cursor is left off grid this is better to reach items to delete off grid,
@ -319,16 +317,15 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
if( keep_on_grid ) if( keep_on_grid )
{ {
wxPoint on_grid = pos; wxPoint on_grid = GetScreen()->GetNearestGridPosition( pos );
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, this, m_ID_current_state, grid, on_grid, &pos ) ) if( Magnetize( m_Pcb, this, m_ID_current_state, grid, on_grid, &pos ) )
{ {
GetScreen()->m_Curseur = pos; GetScreen()->SetCrossHairPosition( pos );
} }
else else
{ {
@ -339,27 +336,27 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
|| !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment, || !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
GetScreen()->m_Active_Layer, GetScreen()->RefPos( true ) ) ) GetScreen()->m_Active_Layer, GetScreen()->RefPos( true ) ) )
{ {
GetScreen()->m_Curseur = on_grid; GetScreen()->SetCrossHairPosition( on_grid );
} }
} }
} }
if( oldpos != GetScreen()->m_Curseur ) if( oldpos != GetScreen()->GetCrossHairPosition() )
{ {
pos = GetScreen()->m_Curseur; pos = GetScreen()->GetCrossHairPosition();
GetScreen()->m_Curseur = oldpos; GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->CursorOff( aDC ); DrawPanel->CrossHairOff( aDC );
GetScreen()->m_Curseur = pos; GetScreen()->SetCrossHairPosition( pos );
DrawPanel->CursorOn( aDC ); DrawPanel->CrossHairOn( aDC );
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
{ {
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY
wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC ); wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC );
oDC.Clear(); oDC.Clear();
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, false );
#else #else
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, true ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true );
#endif #endif
} }
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY

View File

@ -41,6 +41,7 @@ void RemoteCommand( const char* cmdline )
char* text; char* text;
MODULE* module = 0; MODULE* module = 0;
WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*)wxGetApp().GetTopWindow(); WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*)wxGetApp().GetTopWindow();
wxPoint pos;
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
@ -61,9 +62,10 @@ void RemoteCommand( const char* cmdline )
else else
msg.Printf( _( "%s not found" ), GetChars( modName ) ); msg.Printf( _( "%s not found" ), GetChars( modName ) );
frame->Affiche_Message( msg ); frame->SetStatusText( msg );
if( module ) if( module )
frame->GetScreen()->m_Curseur = module->GetPosition(); pos = module->GetPosition();
} }
else if( strcmp( idcmd, "$PIN:" ) == 0 ) else if( strcmp( idcmd, "$PIN:" ) == 0 )
{ {
@ -80,6 +82,7 @@ void RemoteCommand( const char* cmdline )
modName = CONV_FROM_UTF8( text ); modName = CONV_FROM_UTF8( text );
module = frame->GetBoard()->FindModuleByReference( modName ); module = frame->GetBoard()->FindModuleByReference( modName );
if( module ) if( module )
pad = module->FindPadByName( pinName ); pad = module->FindPadByName( pinName );
@ -88,7 +91,7 @@ void RemoteCommand( const char* cmdline )
netcode = pad->GetNet(); netcode = pad->GetNet();
// put cursor on the pad: // put cursor on the pad:
frame->GetScreen()->m_Curseur = pad->GetPosition(); pos = pad->GetPosition();
} }
if( netcode > 0 ) /* highlight the pad net*/ if( netcode > 0 ) /* highlight the pad net*/
@ -106,22 +109,20 @@ void RemoteCommand( const char* cmdline )
msg.Printf( _( "%s not found" ), GetChars( modName ) ); msg.Printf( _( "%s not found" ), GetChars( modName ) );
else if( pad == NULL ) else if( pad == NULL )
{ {
msg.Printf( _( "%s pin %s not found" ), msg.Printf( _( "%s pin %s not found" ), GetChars( modName ), GetChars( pinName ) );
GetChars( modName ), GetChars( pinName ) );
frame->SetCurItem( module ); frame->SetCurItem( module );
} }
else else
{ {
msg.Printf( _( "%s pin %s found" ), msg.Printf( _( "%s pin %s found" ), GetChars( modName ), GetChars( pinName ) );
GetChars( modName ), GetChars( pinName ) );
frame->SetCurItem( pad ); frame->SetCurItem( pad );
} }
frame->Affiche_Message( msg ); frame->SetStatusText( msg );
} }
if( module ) // if found, center the module on screen, and redraw the screen. if( module ) // if found, center the module on screen, and redraw the screen.
frame->RedrawScreen( false ); frame->RedrawScreen( pos, false );
} }

View File

@ -85,8 +85,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
if( g_CurrentTrackList.GetCount() == 0 ) if( g_CurrentTrackList.GetCount() == 0 )
{ {
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
if( g_HighLight_Status ) if( g_HighLight_Status )
High_Light( DC ); High_Light( DC );
@ -96,8 +95,8 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
} }
else else
{ {
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
return g_CurrentTrackSegment; return g_CurrentTrackSegment;
} }

View File

@ -452,20 +452,17 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
if( m_DC ) if( m_DC )
{ {
m_Parent->DrawPanel->CursorOff( m_DC ); m_Parent->DrawPanel->CrossHairOff( m_DC );
m_CurrentModule->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); m_CurrentModule->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
} }
// Initialize masks clearances // Initialize masks clearances
m_CurrentModule->m_LocalClearance = m_CurrentModule->m_LocalClearance =
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->m_InternalUnits );
m_Parent->m_InternalUnits );
m_CurrentModule->m_LocalSolderMaskMargin = m_CurrentModule->m_LocalSolderMaskMargin =
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits );
m_Parent->m_InternalUnits );
m_CurrentModule->m_LocalSolderPasteMargin = m_CurrentModule->m_LocalSolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits );
m_Parent->m_InternalUnits );
double dtmp = 0.0; double dtmp = 0.0;
msg = m_SolderPasteMarginRatioCtrl->GetValue(); msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );
@ -579,30 +576,30 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
if( m_DC ) if( m_DC )
{ {
m_CurrentModule->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); m_CurrentModule->Draw( m_Parent->DrawPanel, m_DC, GR_OR );
m_Parent->DrawPanel->CursorOn( m_DC ); m_Parent->DrawPanel->CrossHairOn( m_DC );
} }
} }
void DIALOG_MODULE_BOARD_EDITOR::OnEditReference( wxCommandEvent& event ) void DIALOG_MODULE_BOARD_EDITOR::OnEditReference( wxCommandEvent& event )
{ {
wxPoint tmp = m_Parent->GetScreen()->m_Curseur; wxPoint tmp = m_Parent->GetScreen()->GetCrossHairPosition();
m_Parent->GetScreen()->m_Curseur = m_ReferenceCopy->m_Pos; m_Parent->GetScreen()->SetCrossHairPosition( m_ReferenceCopy->m_Pos );
m_ReferenceCopy->SetParent( m_CurrentModule ); m_ReferenceCopy->SetParent( m_CurrentModule );
m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL ); m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL );
m_Parent->GetScreen()->m_Curseur = tmp; m_Parent->GetScreen()->SetCrossHairPosition( tmp );
m_ReferenceCtrl->SetValue( m_ReferenceCopy->m_Text ); m_ReferenceCtrl->SetValue( m_ReferenceCopy->m_Text );
} }
void DIALOG_MODULE_BOARD_EDITOR::OnEditValue( wxCommandEvent& event ) void DIALOG_MODULE_BOARD_EDITOR::OnEditValue( wxCommandEvent& event )
{ {
wxPoint tmp = m_Parent->GetScreen()->m_Curseur; wxPoint tmp = m_Parent->GetScreen()->GetCrossHairPosition();
m_Parent->GetScreen()->m_Curseur = m_ValueCopy->m_Pos; m_Parent->GetScreen()->SetCrossHairPosition( m_ValueCopy->m_Pos );
m_ValueCopy->SetParent( m_CurrentModule ); m_ValueCopy->SetParent( m_CurrentModule );
m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL ); m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL );
m_Parent->GetScreen()->m_Curseur = tmp; m_Parent->GetScreen()->SetCrossHairPosition( tmp );
m_ValueCtrl->SetValue( m_ValueCopy->m_Text ); m_ValueCtrl->SetValue( m_ValueCopy->m_Text );
} }

View File

@ -426,10 +426,10 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
void DIALOG_MODULE_MODULE_EDITOR::OnEditReference(wxCommandEvent& event) void DIALOG_MODULE_MODULE_EDITOR::OnEditReference(wxCommandEvent& event)
/***********************************************************************/ /***********************************************************************/
{ {
wxPoint tmp = m_Parent->GetScreen()->m_Curseur; wxPoint tmp = m_Parent->GetScreen()->GetCrossHairPosition();
m_Parent->GetScreen()->m_Curseur = m_ReferenceCopy->m_Pos; m_Parent->GetScreen()->SetCrossHairPosition( m_ReferenceCopy->m_Pos );
m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL ); m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL );
m_Parent->GetScreen()->m_Curseur = tmp; m_Parent->GetScreen()->SetCrossHairPosition( tmp );
m_ReferenceCtrl->SetValue(m_ReferenceCopy->m_Text); m_ReferenceCtrl->SetValue(m_ReferenceCopy->m_Text);
} }
@ -437,10 +437,10 @@ void DIALOG_MODULE_MODULE_EDITOR::OnEditReference(wxCommandEvent& event)
void DIALOG_MODULE_MODULE_EDITOR::OnEditValue(wxCommandEvent& event) void DIALOG_MODULE_MODULE_EDITOR::OnEditValue(wxCommandEvent& event)
/***********************************************************/ /***********************************************************/
{ {
wxPoint tmp = m_Parent->GetScreen()->m_Curseur; wxPoint tmp = m_Parent->GetScreen()->GetCrossHairPosition();
m_Parent->GetScreen()->m_Curseur = m_ValueCopy->m_Pos; m_Parent->GetScreen()->SetCrossHairPosition( m_ValueCopy->m_Pos );
m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL ); m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL );
m_Parent->GetScreen()->m_Curseur = tmp; m_Parent->GetScreen()->SetCrossHairPosition( tmp);
m_ValueCtrl->SetValue(m_ValueCopy->m_Text); m_ValueCtrl->SetValue(m_ValueCopy->m_Text);
} }

View File

@ -144,7 +144,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD: case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message( wxEmptyString ); SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = state; DisplayOpt.DisplayPolarCood = state;
UpdateStatusBar(); UpdateStatusBar();
break; break;

View File

@ -68,7 +68,7 @@ void WinEDA_PcbFrame::InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wx
DialogGraphicItemProperties* dialog = new DialogGraphicItemProperties( this, DialogGraphicItemProperties* dialog = new DialogGraphicItemProperties( this,
aItem, aDC ); aItem, aDC );
dialog->ShowModal(); dialog->Destroy(); dialog->ShowModal(); dialog->Destroy();
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
} }

View File

@ -64,7 +64,7 @@ void WinEDA_PcbFrame::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC )
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
DIALOG_PCB_TEXT_PROPERTIES dlg( this, TextPCB, DC ); DIALOG_PCB_TEXT_PROPERTIES dlg( this, TextPCB, DC );
dlg.ShowModal(); dlg.ShowModal();
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
} }

View File

@ -210,10 +210,8 @@ static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC )
} }
} }
status_dimension = 0; status_dimension = 0;
Panel->ManageCurseur = NULL; ((WinEDA_PcbFrame*)Panel->GetParent())->SetCurItem( NULL );
Panel->ForceCloseManageCurseur = NULL;
((WinEDA_PcbFrame*)Panel->GetParent())->SetCurItem(NULL);
} }
@ -226,7 +224,7 @@ DIMENSION* WinEDA_PcbFrame::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
if( Dimension == NULL ) /* debut reel du trace */ if( Dimension == NULL ) /* debut reel du trace */
{ {
status_dimension = 1; status_dimension = 1;
pos = GetScreen()->m_Curseur; pos = GetScreen()->GetCrossHairPosition();
Dimension = new DIMENSION( GetBoard() ); Dimension = new DIMENSION( GetBoard() );
Dimension->m_Flags = IS_NEW; Dimension->m_Flags = IS_NEW;
@ -267,8 +265,7 @@ DIMENSION* WinEDA_PcbFrame::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
Dimension->Draw( DrawPanel, DC, GR_XOR ); Dimension->Draw( DrawPanel, DC, GR_XOR );
DrawPanel->ManageCurseur = Montre_Position_New_Dimension; DrawPanel->SetMouseCapture( Montre_Position_New_Dimension, Exit_EditDimension );
DrawPanel->ForceCloseManageCurseur = Exit_EditDimension;
return Dimension; return Dimension;
} }
@ -289,8 +286,7 @@ DIMENSION* WinEDA_PcbFrame::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
SaveCopyInUndoList( Dimension, UR_NEW ); SaveCopyInUndoList( Dimension, UR_NEW );
OnModify(); OnModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
return NULL; return NULL;
} }
@ -301,7 +297,7 @@ static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
{ {
PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem(); DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem();
wxPoint pos = screen->m_Curseur; wxPoint pos = screen->GetCrossHairPosition();
if( Dimension == NULL ) if( Dimension == NULL )
return; return;

View File

@ -38,14 +38,14 @@ void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
{ {
if( Edge == NULL ) if( Edge == NULL )
return; return;
Edge->Draw( DrawPanel, DC, GR_XOR ); Edge->Draw( DrawPanel, DC, GR_XOR );
Edge->m_Flags |= IS_MOVED; Edge->m_Flags |= IS_MOVED;
MoveVector.x = MoveVector.y = 0; MoveVector.x = MoveVector.y = 0;
CursorInitialPosition = GetScreen()->m_Curseur; CursorInitialPosition = GetScreen()->GetCrossHairPosition();
DrawPanel->ManageCurseur = Move_Segment; DrawPanel->SetMouseCapture( Move_Segment, Exit_EditEdge_Module );
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge_Module;
SetCurItem( Edge ); SetCurItem( Edge );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
} }
@ -63,8 +63,7 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge )
Edge->m_End0 -= MoveVector; Edge->m_End0 -= MoveVector;
Edge->m_Flags = 0; Edge->m_Flags = 0;
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
OnModify(); OnModify();
MODULE* Module = (MODULE*) Edge->GetParent(); MODULE* Module = (MODULE*) Edge->GetParent();
@ -89,7 +88,7 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
Edge->Draw( aPanel, aDC, GR_XOR, MoveVector ); Edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
} }
MoveVector = -(screen->m_Curseur - CursorInitialPosition); MoveVector = -(screen->GetCrossHairPosition() - CursorInitialPosition);
Edge->Draw( aPanel, aDC, GR_XOR, MoveVector ); Edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
@ -115,7 +114,7 @@ static void ShowEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aP
Edge->Draw( aPanel, aDC, GR_XOR ); Edge->Draw( aPanel, aDC, GR_XOR );
} }
Edge->m_End = screen->m_Curseur; Edge->m_End = screen->GetCrossHairPosition();
/* Update relative coordinate. */ /* Update relative coordinate. */
Edge->m_End0 = Edge->m_End - Module->m_Pos; Edge->m_End0 = Edge->m_End - Module->m_Pos;
@ -185,8 +184,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge )
/* an edge is put on a copper layer, and it is very dangerous. a /* an edge is put on a copper layer, and it is very dangerous. a
*confirmation is requested */ *confirmation is requested */
if( !IsOK( this, if( !IsOK( this,
_( _( "The graphic item will be on a copper layer. It is very dangerous. Are you sure?" ) ) )
"The graphic item will be on a copper layer. It is very dangerous. Are you sure?" ) ) )
return; return;
} }
@ -223,13 +221,15 @@ void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* aEdge )
{ {
wxString buffer; wxString buffer;
buffer = ReturnStringFromValue( g_UserUnit, g_ModuleSegmentWidth, GetScreen()->GetInternalUnits() ); buffer = ReturnStringFromValue( g_UserUnit, g_ModuleSegmentWidth,
GetScreen()->GetInternalUnits() );
wxTextEntryDialog dlg( this, _( "New Width:" ), _( "Edge Width" ), buffer ); wxTextEntryDialog dlg( this, _( "New Width:" ), _( "Edge Width" ), buffer );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return; // cancelled by user return; // cancelled by user
buffer = dlg.GetValue( ); buffer = dlg.GetValue( );
g_ModuleSegmentWidth = ReturnValueFromString( g_UserUnit, buffer, GetScreen()->GetInternalUnits() ); g_ModuleSegmentWidth = ReturnValueFromString( g_UserUnit, buffer,
GetScreen()->GetInternalUnits() );
if( aEdge ) if( aEdge )
{ {
@ -289,8 +289,7 @@ static void Exit_EditEdge_Module( EDA_DRAW_PANEL* Panel, wxDC* DC )
Edge->Draw( Panel, DC, GR_OR ); Edge->Draw( Panel, DC, GR_OR );
} }
} }
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
Panel->GetScreen()->SetCurItem( NULL ); Panel->GetScreen()->SetCurItem( NULL );
} }
@ -339,7 +338,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge->SetLayer( SILKSCREEN_N_BACK ); Edge->SetLayer( SILKSCREEN_N_BACK );
/* Initialise the starting point of the new segment or arc */ /* Initialise the starting point of the new segment or arc */
Edge->m_Start = GetScreen()->m_Curseur; Edge->m_Start = GetScreen()->GetCrossHairPosition();
/* Initialise the ending point of the new segment or arc */ /* Initialise the ending point of the new segment or arc */
Edge->m_End = Edge->m_Start; Edge->m_End = Edge->m_Start;
@ -351,9 +350,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge->m_End0 = Edge->m_Start0; Edge->m_End0 = Edge->m_Start0;
module->Set_Rectangle_Encadrement(); module->Set_Rectangle_Encadrement();
DrawPanel->SetMouseCapture( ShowEdgeModule, Exit_EditEdge_Module );
DrawPanel->ManageCurseur = ShowEdgeModule;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge_Module;
} }
/* Segment creation in progress. /* Segment creation in progress.
* The ending coordinate are updated by the function * The ending coordinate are updated by the function
@ -380,7 +377,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge->m_Flags = IS_NEW; Edge->m_Flags = IS_NEW;
Edge->m_Width = g_ModuleSegmentWidth; Edge->m_Width = g_ModuleSegmentWidth;
Edge->m_Start = GetScreen()->m_Curseur; Edge->m_Start = GetScreen()->GetCrossHairPosition();
Edge->m_End = Edge->m_Start; Edge->m_End = Edge->m_Start;
/* Update relative coordinate. */ /* Update relative coordinate. */
@ -418,6 +415,5 @@ void WinEDA_ModuleEditFrame::End_Edge_Module( EDGE_MODULE* Edge )
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );
OnModify(); OnModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
} }

View File

@ -39,7 +39,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
MODULE* module; MODULE* module;
DrawPanel->CursorOff( &dc ); DrawPanel->CrossHairOff( &dc );
wxGetMousePosition( &pos.x, &pos.y ); wxGetMousePosition( &pos.x, &pos.y );
@ -118,11 +118,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( DrawPanel->ManageCurseur if( DrawPanel->IsMouseCaptured() )
&& DrawPanel->ForceCloseManageCurseur )
{ {
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
} }
/* Should not be executed, just in case */ /* Should not be executed, just in case */
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE ) if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
{ {
@ -130,20 +130,23 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
} }
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
else else
SetCursor( DrawPanel->GetDefaultCursor() ); SetCursor( DrawPanel->GetDefaultCursor() );
break; break;
default: // Finish (abort) the command default: // Finish (abort) the command
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->IsMouseCaptured() )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
if( m_ID_current_state != id ) if( m_ID_current_state != id )
{ {
if( m_ID_last_state != m_ID_current_state ) if( m_ID_last_state != m_ID_current_state )
m_ID_last_state = m_ID_current_state; m_ID_last_state = m_ID_current_state;
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
} }
break; break;
@ -296,7 +299,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_END_LINE: case ID_POPUP_PCB_END_LINE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
// EndSegment(&dc); // EndSegment(&dc);
break; break;
@ -305,7 +308,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( GetCurItem() == NULL ) if( GetCurItem() == NULL )
break; break;
Edit_Track_Width( &dc, (TRACK*) GetCurItem() ); Edit_Track_Width( &dc, (TRACK*) GetCurItem() );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
OnModify(); OnModify();
break; break;
@ -313,7 +316,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( GetCurItem() == NULL ) if( GetCurItem() == NULL )
break; break;
Edit_TrackSegm_Width( &dc, (TRACK*) GetCurItem() ); Edit_TrackSegm_Width( &dc, (TRACK*) GetCurItem() );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
OnModify(); OnModify();
break; break;
@ -329,16 +332,16 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
dlg.ShowModal(); dlg.ShowModal();
} }
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_END_TRACK: case ID_POPUP_PCB_END_TRACK:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
End_Route( (TRACK*) GetCurItem(), &dc ); End_Route( (TRACK*) GetCurItem(), &dc );
break; break;
case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE: case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem()->m_Flags & IS_DRAGGED ) if( GetCurItem()->m_Flags & IS_DRAGGED )
{ {
PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc ); PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
@ -350,12 +353,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
* switch from _/ to -\ . * switch from _/ to -\ .
* If a track is in progress, it will be redrawn * If a track is in progress, it will be redrawn
*/ */
if( DrawPanel->ManageCurseur == ShowNewTrackWhenMovingCursor ) if( DrawPanel->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor )
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false ); ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false );
g_Alternate_Track_Posture = !g_Alternate_Track_Posture; g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
if( DrawPanel->ManageCurseur == ShowNewTrackWhenMovingCursor ) if( DrawPanel->m_mouseCaptureCallback == ShowNewTrackWhenMovingCursor )
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false ); ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false );
break; break;
@ -364,7 +367,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( !IsMicroViaAcceptable() ) if( !IsMicroViaAcceptable() )
break; break;
case ID_POPUP_PCB_PLACE_VIA: case ID_POPUP_PCB_PLACE_VIA:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem()->m_Flags & IS_DRAGGED ) if( GetCurItem()->m_Flags & IS_DRAGGED )
{ {
PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc ); PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
@ -384,7 +387,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DELETE_TRACKSEG: case ID_POPUP_PCB_DELETE_TRACKSEG:
if( GetCurItem() == NULL ) if( GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) ); SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) );
OnModify(); OnModify();
break; break;
@ -392,14 +395,14 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DELETE_TRACK: case ID_POPUP_PCB_DELETE_TRACK:
if( GetCurItem() == NULL ) if( GetCurItem() == NULL )
break; break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Delete_Track( &dc, (TRACK*) GetCurItem() ); Delete_Track( &dc, (TRACK*) GetCurItem() );
SetCurItem( NULL ); SetCurItem( NULL );
OnModify(); OnModify();
break; break;
case ID_POPUP_PCB_DELETE_TRACKNET: case ID_POPUP_PCB_DELETE_TRACKNET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Delete_net( &dc, (TRACK*) GetCurItem() ); Delete_net( &dc, (TRACK*) GetCurItem() );
SetCurItem( NULL ); SetCurItem( NULL );
OnModify(); OnModify();
@ -433,7 +436,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_DELETE_ZONE: case ID_POPUP_PCB_DELETE_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() == NULL ) if( GetCurItem() == NULL )
break; break;
{ {
@ -453,20 +456,20 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE: case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Add_Similar_Zone( &dc, (ZONE_CONTAINER*) GetCurItem() ); Add_Similar_Zone( &dc, (ZONE_CONTAINER*) GetCurItem() );
break; break;
case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE: case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Add_Zone_Cutout( &dc, (ZONE_CONTAINER*) GetCurItem() ); Add_Zone_Cutout( &dc, (ZONE_CONTAINER*) GetCurItem() );
break; break;
case ID_POPUP_PCB_DELETE_ZONE_CONTAINER: case ID_POPUP_PCB_DELETE_ZONE_CONTAINER:
case ID_POPUP_PCB_DELETE_ZONE_CUTOUT: case ID_POPUP_PCB_DELETE_ZONE_CUTOUT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
{ {
int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNet(); int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNet();
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() ); Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
@ -483,7 +486,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_ZONE_CORNER: case ID_POPUP_PCB_MOVE_ZONE_CORNER:
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Start_Move_Zone_Corner( &dc, Start_Move_Zone_Corner( &dc,
@ -495,7 +498,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT: case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Start_Move_Zone_Drag_Outline_Edge( &dc, Start_Move_Zone_Drag_Outline_Edge( &dc,
@ -506,7 +509,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_ZONE_OUTLINES: case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
Start_Move_Zone_Outlines( &dc, zone_cont ); Start_Move_Zone_Outlines( &dc, zone_cont );
@ -515,9 +518,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_ADD_ZONE_CORNER: case ID_POPUP_PCB_ADD_ZONE_CORNER:
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->GetCrossHairPosition();
/* add corner between zone_cont->m_CornerSelection /* add corner between zone_cont->m_CornerSelection
* and zone_cont->m_CornerSelection+1 * and zone_cont->m_CornerSelection+1
@ -539,7 +542,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_PLACE_ZONE_OUTLINES: case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
case ID_POPUP_PCB_PLACE_ZONE_CORNER: case ID_POPUP_PCB_PLACE_ZONE_CORNER:
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem(); ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont ); End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont );
DrawPanel->m_AutoPAN_Request = false; DrawPanel->m_AutoPAN_Request = false;
@ -547,7 +550,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
} }
case ID_POPUP_PCB_FILL_ALL_ZONES: case ID_POPUP_PCB_FILL_ALL_ZONES:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Fill_All_Zones(); Fill_All_Zones();
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
break; break;
@ -583,7 +586,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_FILL_ZONE: case ID_POPUP_PCB_FILL_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Fill_Zone( (ZONE_CONTAINER*) GetCurItem() ); Fill_Zone( (ZONE_CONTAINER*) GetCurItem() );
test_1_net_connexion( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() ); test_1_net_connexion( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() );
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
@ -622,8 +625,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DisplayInfoMessage( this, msg ); DisplayInfoMessage( this, msg );
break; break;
} }
GetScreen()->m_Curseur = ((MODULE*) GetCurItem())->m_Pos; GetScreen()->SetCrossHairPosition( ((MODULE*) GetCurItem())->m_Pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
StartMove_Module( (MODULE*) GetCurItem(), &dc ); StartMove_Module( (MODULE*) GetCurItem(), &dc );
break; break;
@ -640,12 +643,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DisplayInfoMessage( this, msg ); DisplayInfoMessage( this, msg );
break; break;
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
StartMove_Module( module, &dc ); StartMove_Module( module, &dc );
break; break;
case ID_POPUP_PCB_DELETE_MODULE: case ID_POPUP_PCB_DELETE_MODULE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
// If the current Item is a pad, text module ...: Get its parent // If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE ) if( GetCurItem()->Type() != TYPE_MODULE )
@ -669,7 +672,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE: case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
// If the current Item is a pad, text module ...: Get its parent // If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE ) if( GetCurItem()->Type() != TYPE_MODULE )
@ -692,7 +695,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE: case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
// If the current Item is a pad, text module ...: Get its parent // If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE ) if( GetCurItem()->Type() != TYPE_MODULE )
@ -715,7 +718,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_CHANGE_SIDE_MODULE: case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
// If the current Item is a pad, text module ...: Get its parent // If the current Item is a pad, text module ...: Get its parent
if( GetCurItem()->Type() != TYPE_MODULE ) if( GetCurItem()->Type() != TYPE_MODULE )
@ -744,7 +747,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE ) if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE )
break; break;
InstallModuleOptionsFrame( (MODULE*) GetCurItem(), &dc ); InstallModuleOptionsFrame( (MODULE*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_DRAG_PAD_REQUEST: case ID_POPUP_PCB_DRAG_PAD_REQUEST:
@ -760,7 +763,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
g_Drag_Pistes_On = true; g_Drag_Pistes_On = true;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
StartMovePad( (D_PAD*) GetCurItem(), &dc ); StartMovePad( (D_PAD*) GetCurItem(), &dc );
break; break;
@ -777,28 +780,28 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
g_Drag_Pistes_On = false; g_Drag_Pistes_On = false;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
StartMovePad( (D_PAD*) GetCurItem(), &dc ); StartMovePad( (D_PAD*) GetCurItem(), &dc );
break; break;
case ID_POPUP_PCB_EDIT_PAD: case ID_POPUP_PCB_EDIT_PAD:
InstallPadOptionsFrame( (D_PAD*) GetCurItem() ); InstallPadOptionsFrame( (D_PAD*) GetCurItem() );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED ); SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
Import_Pad_Settings( (D_PAD*) GetCurItem(), true ); Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
break; break;
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Global_Import_Pad_Settings( (D_PAD*) GetCurItem(), true ); Global_Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
break; break;
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS: case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Export_Pad_Settings( (D_PAD*) GetCurItem() ); Export_Pad_Settings( (D_PAD*) GetCurItem() );
break; break;
@ -806,12 +809,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED ); SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
DeletePad( (D_PAD*) GetCurItem() ); DeletePad( (D_PAD*) GetCurItem() );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_EDIT_TEXTMODULE: case ID_POPUP_PCB_EDIT_TEXTMODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetCurItem(), &dc ); InstallTextModOptionsFrame( (TEXTE_MODULE*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_RESET_TEXT_SIZE: case ID_POPUP_PCB_RESET_TEXT_SIZE:
@ -819,27 +822,27 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST: case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
StartMoveTexteModule( (TEXTE_MODULE*) GetCurItem(), &dc ); StartMoveTexteModule( (TEXTE_MODULE*) GetCurItem(), &dc );
break; break;
case ID_POPUP_PCB_ROTATE_TEXTMODULE: case ID_POPUP_PCB_ROTATE_TEXTMODULE:
RotateTextModule( (TEXTE_MODULE*) GetCurItem(), RotateTextModule( (TEXTE_MODULE*) GetCurItem(),
&dc ); &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_DELETE_TEXTMODULE: case ID_POPUP_PCB_DELETE_TEXTMODULE:
DeleteTextModule( (TEXTE_MODULE*) GetCurItem() ); DeleteTextModule( (TEXTE_MODULE*) GetCurItem() );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_SELECT_LAYER: case ID_POPUP_PCB_SELECT_LAYER:
itmp = SelectLayer( getActiveLayer(), -1, -1 ); itmp = SelectLayer( getActiveLayer(), -1, -1 );
if( itmp >= 0 ) if( itmp >= 0 )
setActiveLayer( itmp ); setActiveLayer( itmp );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
@ -850,7 +853,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
itmp = SelectLayer( getActiveLayer(), FIRST_NO_COPPER_LAYER, -1 ); itmp = SelectLayer( getActiveLayer(), FIRST_NO_COPPER_LAYER, -1 );
if( itmp >= 0 ) if( itmp >= 0 )
setActiveLayer( itmp ); setActiveLayer( itmp );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_SELECT_CU_LAYER: case ID_POPUP_PCB_SELECT_CU_LAYER:
@ -861,7 +864,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_LAYER_PAIR: case ID_POPUP_PCB_SELECT_LAYER_PAIR:
SelectLayerPair(); SelectLayerPair();
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
@ -872,60 +875,60 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_TEXTEPCB: case ID_POPUP_PCB_EDIT_TEXTEPCB:
InstallTextPCBOptionsFrame( (TEXTE_PCB*) GetCurItem(), &dc ); InstallTextPCBOptionsFrame( (TEXTE_PCB*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_ROTATE_TEXTEPCB: case ID_POPUP_PCB_ROTATE_TEXTEPCB:
Rotate_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc ); Rotate_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_DELETE_TEXTEPCB: case ID_POPUP_PCB_DELETE_TEXTEPCB:
Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc ); Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_MOVE_MIRE_REQUEST: case ID_POPUP_PCB_MOVE_MIRE_REQUEST:
StartMove_Mire( (MIREPCB*) GetCurItem(), &dc ); StartMove_Mire( (MIREPCB*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_EDIT_MIRE: case ID_POPUP_PCB_EDIT_MIRE:
InstallMireOptionsFrame( (MIREPCB*) GetCurItem(), &dc ); InstallMireOptionsFrame( (MIREPCB*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_DELETE_MIRE: case ID_POPUP_PCB_DELETE_MIRE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Delete_Mire( (MIREPCB*) GetCurItem(), &dc ); Delete_Mire( (MIREPCB*) GetCurItem(), &dc );
SetCurItem( NULL ); SetCurItem( NULL );
break; break;
case ID_POPUP_PCB_DELETE_DIMENSION: case ID_POPUP_PCB_DELETE_DIMENSION:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Delete_Dimension( (DIMENSION*) GetCurItem(), &dc ); Delete_Dimension( (DIMENSION*) GetCurItem(), &dc );
SetCurItem( NULL ); SetCurItem( NULL );
break; break;
case ID_POPUP_PCB_EDIT_DIMENSION: case ID_POPUP_PCB_EDIT_DIMENSION:
Install_Edit_Dimension( (DIMENSION*) GetCurItem(), &dc ); Install_Edit_Dimension( (DIMENSION*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_DELETE_DRAWING: case ID_POPUP_PCB_DELETE_DRAWING:
Delete_Segment_Edge( (DRAWSEGMENT*) GetCurItem(), &dc ); Delete_Segment_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_DELETE_MARKER: case ID_POPUP_PCB_DELETE_MARKER:
RemoveStruct( GetCurItem(), &dc ); RemoveStruct( GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_GETINFO_MARKER: case ID_POPUP_PCB_GETINFO_MARKER:
if( GetCurItem() && GetCurItem()->Type() == TYPE_MARKER_PCB ) if( GetCurItem() && GetCurItem()->Type() == TYPE_MARKER_PCB )
( (MARKER_PCB*) GetCurItem() )->DisplayMarkerInfo( this ); ( (MARKER_PCB*) GetCurItem() )->DisplayMarkerInfo( this );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_DELETE_DRAWING_LAYER: case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
@ -933,22 +936,22 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
Delete_Drawings_All_Layer( GetCurItem()->GetLayer() ); Delete_Drawings_All_Layer( GetCurItem()->GetLayer() );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case ID_POPUP_PCB_EDIT_DRAWING: case ID_POPUP_PCB_EDIT_DRAWING:
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), &dc ); InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_MOVE_DRAWING_REQUEST: case ID_POPUP_PCB_MOVE_DRAWING_REQUEST:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Start_Move_DrawItem( (DRAWSEGMENT*) GetCurItem(), &dc ); Start_Move_DrawItem( (DRAWSEGMENT*) GetCurItem(), &dc );
break; break;
case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) ) if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
{ {
End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc ); End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
@ -957,7 +960,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE: case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) ) if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
{ {
if( End_Zone( &dc ) ) if( End_Zone( &dc ) )
@ -967,7 +970,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER: case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) ) if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
{ {
if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline, if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline,
@ -977,29 +980,29 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(),
&dc, id ); &dc, id );
break; break;
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
case ID_POPUP_PCB_MOVE_TRACK_NODE: case ID_POPUP_PCB_MOVE_TRACK_NODE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), Start_MoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(),
&dc, id ); &dc, id );
break; break;
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE: case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Start_DragTrackSegmentAndKeepSlope( (TRACK*) GetScreen()->GetCurItem(), Start_DragTrackSegmentAndKeepSlope( (TRACK*) GetScreen()->GetCurItem(),
&dc ); &dc );
break; break;
case ID_POPUP_PCB_BREAK_TRACK: case ID_POPUP_PCB_BREAK_TRACK:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
{ {
TRACK* track = (TRACK*) GetScreen()->GetCurItem(); TRACK* track = (TRACK*) GetScreen()->GetCurItem();
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->GetCrossHairPosition();
track->Draw( DrawPanel, &dc, GR_XOR ); track->Draw( DrawPanel, &dc, GR_XOR );
PICKED_ITEMS_LIST itemsListPicker; PICKED_ITEMS_LIST itemsListPicker;
TRACK* newtrack = CreateLockPoint( GetBoard(), pos, track, &itemsListPicker); TRACK* newtrack = CreateLockPoint( GetBoard(), pos, track, &itemsListPicker);
@ -1058,7 +1061,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
} }
SetToolbars(); SetToolbars();
DrawPanel->CursorOn( &dc ); DrawPanel->CrossHairOn( &dc );
DrawPanel->m_IgnoreMouseEvents = false; DrawPanel->m_IgnoreMouseEvents = false;
} }
@ -1068,7 +1071,7 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame, EDA_ITEM* DrawStruct, wxD
if( DrawStruct == NULL ) if( DrawStruct == NULL )
return; return;
frame->DrawPanel->MouseToCursorSchema(); frame->DrawPanel->MoveCursorToCrossHair();
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {

View File

@ -32,9 +32,6 @@ static TEXTE_PCB s_TextCopy( (BOARD_ITEM*) NULL ); /* copy of the edited text
*/ */
void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC ) void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC )
{ {
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
TEXTE_PCB* TextePcb = (TEXTE_PCB*) Panel->GetScreen()->GetCurItem(); TEXTE_PCB* TextePcb = (TEXTE_PCB*) Panel->GetScreen()->GetCurItem();
( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL ); ( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL );
@ -61,8 +58,7 @@ void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC )
*/ */
void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
{ {
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
if( TextePcb == NULL ) if( TextePcb == NULL )
@ -79,8 +75,7 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
} }
if( TextePcb->m_Flags == IS_MOVED ) // If moved only if( TextePcb->m_Flags == IS_MOVED ) // If moved only
SaveCopyInUndoList( TextePcb, UR_MOVED, SaveCopyInUndoList( TextePcb, UR_MOVED, TextePcb->m_Pos - s_TextCopy.m_Pos );
TextePcb->m_Pos - s_TextCopy.m_Pos );
else else
{ {
// Restore initial params // Restore initial params
@ -109,10 +104,9 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
TextePcb->Draw( DrawPanel, DC, GR_XOR ); TextePcb->Draw( DrawPanel, DC, GR_XOR );
TextePcb->m_Flags |= IS_MOVED; TextePcb->m_Flags |= IS_MOVED;
TextePcb->DisplayInfo( this ); TextePcb->DisplayInfo( this );
DrawPanel->ManageCurseur = Move_Texte_Pcb; DrawPanel->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text );
DrawPanel->ForceCloseManageCurseur = Abort_Edit_Pcb_Text;
SetCurItem( TextePcb ); SetCurItem( TextePcb );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
} }
@ -128,7 +122,7 @@ static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aP
if( aErase ) if( aErase )
TextePcb->Draw( aPanel, aDC, GR_XOR ); TextePcb->Draw( aPanel, aDC, GR_XOR );
TextePcb->m_Pos = aPanel->GetScreen()->m_Curseur; TextePcb->m_Pos = aPanel->GetScreen()->GetCrossHairPosition();
TextePcb->Draw( aPanel, aDC, GR_XOR ); TextePcb->Draw( aPanel, aDC, GR_XOR );
} }
@ -143,8 +137,7 @@ void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
SaveCopyInUndoList( TextePcb, UR_DELETED ); SaveCopyInUndoList( TextePcb, UR_DELETED );
TextePcb->UnLink(); TextePcb->UnLink();
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
} }
@ -166,7 +159,7 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
TextePcb->m_Mirror = true; TextePcb->m_Mirror = true;
TextePcb->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize; TextePcb->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize;
TextePcb->m_Pos = GetScreen()->m_Curseur; TextePcb->m_Pos = GetScreen()->GetCrossHairPosition();
TextePcb->m_Thickness = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth; TextePcb->m_Thickness = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth;
InstallTextPCBOptionsFrame( TextePcb, DC ); InstallTextPCBOptionsFrame( TextePcb, DC );

View File

@ -126,10 +126,10 @@ void WinEDA_PcbFrame::Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem )
{ {
TRACK* oldsegm = (TRACK*) itemsListPicker.GetPickedItemLink( 0 ); TRACK* oldsegm = (TRACK*) itemsListPicker.GetPickedItemLink( 0 );
wxASSERT( oldsegm ); wxASSERT( oldsegm );
DrawPanel->CursorOff( aDC ); // Erase cursor shape DrawPanel->CrossHairOff( aDC ); // Erase cursor shape
oldsegm->Draw( DrawPanel, aDC, GR_XOR ); // Erase old track shape oldsegm->Draw( DrawPanel, aDC, GR_XOR ); // Erase old track shape
aTrackItem->Draw( DrawPanel, aDC, GR_OR ); // Display new track shape aTrackItem->Draw( DrawPanel, aDC, GR_OR ); // Display new track shape
DrawPanel->CursorOn( aDC ); // Display cursor shape DrawPanel->CrossHairOn( aDC ); // Display cursor shape
} }
SaveCopyInUndoList( itemsListPicker, UR_CHANGED ); SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
} }
@ -167,7 +167,8 @@ void WinEDA_PcbFrame::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment )
// Some segment have changed: redraw them and save in undo list // Some segment have changed: redraw them and save in undo list
if( aDC ) if( aDC )
{ {
DrawPanel->CursorOff( aDC ); // Erase cursor shape DrawPanel->CrossHairOff( aDC ); // Erase cursor shape
for( unsigned ii = 0; ii < itemsListPicker.GetCount(); ii++ ) for( unsigned ii = 0; ii < itemsListPicker.GetCount(); ii++ )
{ {
TRACK* segm = (TRACK*) itemsListPicker.GetPickedItemLink( ii ); TRACK* segm = (TRACK*) itemsListPicker.GetPickedItemLink( ii );
@ -176,7 +177,7 @@ void WinEDA_PcbFrame::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment )
segm->Draw( DrawPanel, aDC, GR_OR ); // Display new track shape segm->Draw( DrawPanel, aDC, GR_OR ); // Display new track shape
} }
DrawPanel->CursorOn( aDC ); // Display cursor shape DrawPanel->CrossHairOn( aDC ); // Display cursor shape
} }
SaveCopyInUndoList( itemsListPicker, UR_CHANGED ); SaveCopyInUndoList( itemsListPicker, UR_CHANGED );

View File

@ -32,12 +32,11 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
return; return;
drawitem->Draw( DrawPanel, DC, GR_XOR ); drawitem->Draw( DrawPanel, DC, GR_XOR );
drawitem->m_Flags |= IS_MOVED; drawitem->m_Flags |= IS_MOVED;
s_InitialPosition = s_LastPosition = GetScreen()->m_Curseur; s_InitialPosition = s_LastPosition = GetScreen()->GetCrossHairPosition();
drawitem->DisplayInfo( this ); drawitem->DisplayInfo( this );
DrawPanel->ManageCurseur = Move_Segment; DrawPanel->SetMouseCapture( Move_Segment, Exit_EditEdge );
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge;
SetCurItem( drawitem ); SetCurItem( drawitem );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
} }
@ -51,8 +50,7 @@ void WinEDA_PcbFrame::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
SaveCopyInUndoList(drawitem, UR_MOVED, s_LastPosition - s_InitialPosition); SaveCopyInUndoList(drawitem, UR_MOVED, s_LastPosition - s_InitialPosition);
drawitem->Draw( DrawPanel, DC, GR_OR ); drawitem->Draw( DrawPanel, DC, GR_OR );
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
OnModify(); OnModify();
drawitem->m_Flags = 0; drawitem->m_Flags = 0;
@ -76,10 +74,10 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
Segment->Draw( aPanel, aDC, GR_XOR ); Segment->Draw( aPanel, aDC, GR_XOR );
wxPoint delta; wxPoint delta;
delta = aPanel->GetScreen()->m_Curseur - s_LastPosition; delta = aPanel->GetScreen()->GetCrossHairPosition() - s_LastPosition;
Segment->m_Start += delta; Segment->m_Start += delta;
Segment->m_End += delta; Segment->m_End += delta;
s_LastPosition = aPanel->GetScreen()->m_Curseur; s_LastPosition = aPanel->GetScreen()->GetCrossHairPosition();
Segment->Draw( aPanel, aDC, GR_XOR ); Segment->Draw( aPanel, aDC, GR_XOR );
DisplayOpt.DisplayDrawItems = t_fill; DisplayOpt.DisplayDrawItems = t_fill;
@ -180,21 +178,20 @@ static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Segment->m_Flags & IS_NEW ) if( Segment->m_Flags & IS_NEW )
{ {
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, false ); Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false );
Segment ->DeleteStructure(); Segment ->DeleteStructure();
Segment = NULL; Segment = NULL;
} }
else else
{ {
wxPoint pos = Panel->GetScreen()->m_Curseur; wxPoint pos = Panel->GetScreen()->GetCrossHairPosition();
Panel->GetScreen()->m_Curseur = s_InitialPosition; Panel->GetScreen()->SetCrossHairPosition( s_InitialPosition );
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, true ); Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->m_Curseur = pos; Panel->GetScreen()->SetCrossHairPosition( pos );
Segment->m_Flags = 0; Segment->m_Flags = 0;
Segment->Draw( Panel, DC, GR_OR ); Segment->Draw( Panel, DC, GR_OR );
} }
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL ); ( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL );
} }
@ -225,9 +222,8 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
Segment->m_Width = s_large; Segment->m_Width = s_large;
Segment->m_Shape = shape; Segment->m_Shape = shape;
Segment->m_Angle = 900; Segment->m_Angle = 900;
Segment->m_Start = Segment->m_End = GetScreen()->m_Curseur; Segment->m_Start = Segment->m_End = GetScreen()->GetCrossHairPosition();
DrawPanel->ManageCurseur = Montre_Position_NewSegment; DrawPanel->SetMouseCapture( Montre_Position_NewSegment, Exit_EditEdge );
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge;
} }
else /* The ending point ccordinate Segment->m_End was updated by he function else /* The ending point ccordinate Segment->m_End was updated by he function
* Montre_Position_NewSegment() called on a move mouse event * Montre_Position_NewSegment() called on a move mouse event
@ -288,8 +284,7 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
SaveCopyInUndoList( Segment, UR_NEW ); SaveCopyInUndoList( Segment, UR_NEW );
} }
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
} }
@ -312,13 +307,13 @@ static void Montre_Position_NewSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( Segments_45_Only && ( Segment->m_Shape == S_SEGMENT ) ) if( Segments_45_Only && ( Segment->m_Shape == S_SEGMENT ) )
{ {
Calcule_Coord_Extremite_45( aPanel->GetScreen()->m_Curseur, Calcule_Coord_Extremite_45( aPanel->GetScreen()->GetCrossHairPosition(),
Segment->m_Start.x, Segment->m_Start.y, Segment->m_Start.x, Segment->m_Start.y,
&Segment->m_End.x, &Segment->m_End.y ); &Segment->m_End.x, &Segment->m_End.y );
} }
else /* here the angle is arbitrary */ else /* here the angle is arbitrary */
{ {
Segment->m_End = aPanel->GetScreen()->m_Curseur; Segment->m_End = aPanel->GetScreen()->GetCrossHairPosition();
} }
Segment->Draw( aPanel, aDC, GR_XOR ); Segment->Draw( aPanel, aDC, GR_XOR );

View File

@ -66,9 +66,9 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod )
if( pt_mod == NULL ) if( pt_mod == NULL )
return; return;
moveVector = pt_mod->m_Pos - GetScreen()->m_Curseur; moveVector = pt_mod->m_Pos - GetScreen()->GetCrossHairPosition();
pt_mod->m_Pos = GetScreen()->m_Curseur; pt_mod->m_Pos = GetScreen()->GetCrossHairPosition();
/* Update the relative coordinates: /* Update the relative coordinates:
* The coordinates are relative to the anchor point. * The coordinates are relative to the anchor point.

View File

@ -142,7 +142,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
itmp = g_CurrentTrackList.GetCount(); itmp = g_CurrentTrackList.GetCount();
Begin_Route( g_CurrentTrackSegment, DC ); Begin_Route( g_CurrentTrackSegment, DC );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
/* create the via */ /* create the via */
SEGVIA* via = new SEGVIA( GetBoard() ); SEGVIA* via = new SEGVIA( GetBoard() );
@ -200,7 +200,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
/* DRC fault: the Via cannot be placed here ... */ /* DRC fault: the Via cannot be placed here ... */
delete via; delete via;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
// delete the track(s) added in Begin_Route() // delete the track(s) added in Begin_Route()
while( g_CurrentTrackList.GetCount() > itmp ) while( g_CurrentTrackList.GetCount() > itmp )
@ -253,7 +253,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() ); g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() );
} }
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
via->DisplayInfo( this ); via->DisplayInfo( this );
UpdateStatusBar(); UpdateStatusBar();

View File

@ -61,8 +61,6 @@ static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
g_CurrentTrackList.DeleteAll(); g_CurrentTrackList.DeleteAll();
} }
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
frame->SetCurItem( NULL ); frame->SetCurItem( NULL );
} }
@ -86,10 +84,9 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
int masquelayer = int masquelayer =
g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer]; g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
BOARD_ITEM* LockPoint; BOARD_ITEM* LockPoint;
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->GetCrossHairPosition();
DrawPanel->ManageCurseur = ShowNewTrackWhenMovingCursor; DrawPanel->SetMouseCapture( ShowNewTrackWhenMovingCursor, Exit_Editrack );
DrawPanel->ForceCloseManageCurseur = Exit_Editrack;
if( aTrack == NULL ) /* Starting a new track */ if( aTrack == NULL ) /* Starting a new track */
{ {
@ -193,7 +190,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackSegment->DisplayInfoBase( this ); g_CurrentTrackSegment->DisplayInfoBase( this );
SetCurItem( g_CurrentTrackSegment, false ); SetCurItem( g_CurrentTrackSegment, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
if( Drc_On ) if( Drc_On )
{ {
@ -539,11 +536,11 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
High_Light( DC ); High_Light( DC );
g_HighLight_NetCode = OldNetCodeSurbrillance; g_HighLight_NetCode = OldNetCodeSurbrillance;
if( OldEtatSurbrillance ) if( OldEtatSurbrillance )
High_Light( DC ); High_Light( DC );
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
} }
@ -611,7 +608,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
{ {
PCB_SCREEN* screen = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetScreen(); PCB_SCREEN* screen = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetScreen();
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetBoard(); BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetBoard();
wxPoint cursor = screen->m_Curseur; wxPoint cursor = screen->GetCrossHairPosition();
wxPoint cv, vec, n; wxPoint cv, vec, n;
TRACK* track = g_CurrentTrackSegment; TRACK* track = g_CurrentTrackSegment;
TRACK* other; TRACK* other;
@ -734,7 +731,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
{ {
if( g_TwoSegmentTrackBuild ) if( g_TwoSegmentTrackBuild )
{ {
g_CurrentTrackSegment->m_End = screen->m_Curseur; g_CurrentTrackSegment->m_End = screen->GetCrossHairPosition();
if( Drc_On ) if( Drc_On )
PushTrack( aPanel ); PushTrack( aPanel );
@ -748,7 +745,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
/* Calculate of the end of the path for the permitted directions: /* Calculate of the end of the path for the permitted directions:
* horizontal, vertical or 45 degrees. * horizontal, vertical or 45 degrees.
*/ */
Calcule_Coord_Extremite_45( screen->m_Curseur, Calcule_Coord_Extremite_45( screen->GetCrossHairPosition(),
g_CurrentTrackSegment->m_Start.x, g_CurrentTrackSegment->m_Start.x,
g_CurrentTrackSegment->m_Start.y, g_CurrentTrackSegment->m_Start.y,
&g_CurrentTrackSegment->m_End.x, &g_CurrentTrackSegment->m_End.x,
@ -757,7 +754,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
} }
else /* Here the angle is arbitrary */ else /* Here the angle is arbitrary */
{ {
g_CurrentTrackSegment->m_End = screen->m_Curseur; g_CurrentTrackSegment->m_End = screen->GetCrossHairPosition();
} }
/* Redraw the new track */ /* Redraw the new track */

View File

@ -49,11 +49,11 @@ TEXTE_MODULE* WinEDA_BasePcbFrame::CreateTextModule( MODULE* Module, wxDC* DC )
g_ModuleTextSize.y ), true ); g_ModuleTextSize.y ), true );
Text->m_Size = g_ModuleTextSize; Text->m_Size = g_ModuleTextSize;
Text->m_Thickness = g_ModuleTextWidth; Text->m_Thickness = g_ModuleTextWidth;
Text->m_Pos = GetScreen()->m_Curseur; Text->m_Pos = GetScreen()->GetCrossHairPosition();
Text->SetLocalCoord(); Text->SetLocalCoord();
InstallTextModOptionsFrame( Text, NULL ); InstallTextModOptionsFrame( Text, NULL );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Text->m_Flags = 0; Text->m_Flags = 0;
if( DC ) if( DC )
@ -130,9 +130,6 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
TEXTE_MODULE* Text = (TEXTE_MODULE*) screen->GetCurItem(); TEXTE_MODULE* Text = (TEXTE_MODULE*) screen->GetCurItem();
MODULE* Module; MODULE* Module;
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
if( Text == NULL ) if( Text == NULL )
return; return;
@ -175,23 +172,21 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
MoveVector.x = MoveVector.y = 0; MoveVector.x = MoveVector.y = 0;
DrawPanel->CursorOff( DC ); DrawPanel->CrossHairOff( DC );
TextInitialPosition = Text->m_Pos; TextInitialPosition = Text->m_Pos;
TextInitialOrientation = Text->m_Orient; TextInitialOrientation = Text->m_Orient;
// Center cursor on initial position of text // Center cursor on initial position of text
GetScreen()->m_Curseur = TextInitialPosition; GetScreen()->SetCrossHairPosition( TextInitialPosition );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->CursorOn( DC ); DrawPanel->CrossHairOn( DC );
Text->DisplayInfo( this ); Text->DisplayInfo( this );
SetCurItem( Text ); SetCurItem( Text );
DrawPanel->ManageCurseur = Show_MoveTexte_Module; DrawPanel->SetMouseCapture( Show_MoveTexte_Module, AbortMoveTextModule );
DrawPanel->ForceCloseManageCurseur = AbortMoveTextModule; DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, TRUE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, TRUE );
} }
@ -217,7 +212,7 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
EXCHG( Text->m_Orient, TextInitialOrientation ); EXCHG( Text->m_Orient, TextInitialOrientation );
// Set the new position for text. // Set the new position for text.
Text->m_Pos = GetScreen()->m_Curseur; Text->m_Pos = GetScreen()->GetCrossHairPosition();
wxPoint textRelPos = Text->m_Pos - Module->m_Pos; wxPoint textRelPos = Text->m_Pos - Module->m_Pos;
RotatePoint( &textRelPos, -Module->m_Orient ); RotatePoint( &textRelPos, -Module->m_Orient );
Text->m_Pos0 = textRelPos; Text->m_Pos0 = textRelPos;
@ -230,14 +225,13 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() ); DrawPanel->RefreshDrawingRect( Text->GetBoundingBox() );
} }
else else
Text->m_Pos = GetScreen()->m_Curseur; Text->m_Pos = GetScreen()->GetCrossHairPosition();
} }
// leave it at (0,0) so we can use it Rotate when not moving. // leave it at (0,0) so we can use it Rotate when not moving.
MoveVector.x = MoveVector.y = 0; MoveVector.x = MoveVector.y = 0;
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
} }
@ -257,7 +251,7 @@ static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
Text->Draw( aPanel, aDC, GR_XOR, MoveVector ); Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
} }
MoveVector = TextInitialPosition - screen->m_Curseur; MoveVector = TextInitialPosition - screen->GetCrossHairPosition();
// Draw umbilical if text moved // Draw umbilical if text moved
if( MoveVector.x || MoveVector.y ) if( MoveVector.x || MoveVector.y )

View File

@ -30,12 +30,13 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
/* Note: none of these events require aborting the current command (if any) /* Note: none of these events require aborting the current command (if any)
* (like move, edit or block command) * (like move, edit or block command)
* so we do not test for a current command in progress and call * so we do not test for a current command in progress and call
* DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); * DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
*/ */
switch( id ) switch( id )
{ {
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH: case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = not GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth =
not GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth;
AuxiliaryToolBar_Update_UI( ); AuxiliaryToolBar_Update_UI( );
break; break;
@ -47,7 +48,7 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH: case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = true; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = true;
AuxiliaryToolBar_Update_UI( ); AuxiliaryToolBar_Update_UI( );
break; break;
@ -60,7 +61,7 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_WIDTH6: case ID_POPUP_PCB_SELECT_WIDTH6:
case ID_POPUP_PCB_SELECT_WIDTH7: case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_WIDTH8: case ID_POPUP_PCB_SELECT_WIDTH8:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false; GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1; ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii; GetBoard()->m_TrackWidthSelector = ii;
@ -75,7 +76,7 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_VIASIZE6: case ID_POPUP_PCB_SELECT_VIASIZE6:
case ID_POPUP_PCB_SELECT_VIASIZE7: case ID_POPUP_PCB_SELECT_VIASIZE7:
case ID_POPUP_PCB_SELECT_VIASIZE8: // select the new current value for via size (via diameter) case ID_POPUP_PCB_SELECT_VIASIZE8: // select the new current value for via size (via diameter)
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1; ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
GetBoard()->m_ViaSizeSelector = ii; GetBoard()->m_ViaSizeSelector = ii;
AuxiliaryToolBar_Update_UI( ); AuxiliaryToolBar_Update_UI( );

View File

@ -27,12 +27,12 @@ void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
if( fn != wxEmptyString ) if( fn != wxEmptyString )
{ {
DrawPanel->UnManageCursor( 0, DrawPanel->GetDefaultCursor() ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
::wxSetWorkingDirectory( ::wxPathOnly( fn ) ); ::wxSetWorkingDirectory( ::wxPathOnly( fn ) );
LoadOnePcbFile( fn ); LoadOnePcbFile( fn );
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
SetToolbars(); SetToolbars();
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
} }
} }
@ -47,9 +47,9 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
// If an edition is in progress, stop it. // If an edition is in progress, stop it.
// For something else than save, get rid of current tool. // For something else than save, get rid of current tool.
if( id == ID_SAVE_BOARD ) if( id == ID_SAVE_BOARD )
DrawPanel->UnManageCursor( -1, DrawPanel->GetDefaultCursor() ); DrawPanel->EndMouseCapture( -1, DrawPanel->GetDefaultCursor() );
else else
DrawPanel->UnManageCursor( 0, DrawPanel->GetDefaultCursor() ); DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
switch( id ) switch( id )
{ {

View File

@ -113,7 +113,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
else else
msg.Printf( _( "<%s> Found" ), GetChars( s_OldStringFound ) ); msg.Printf( _( "<%s> Found" ), GetChars( s_OldStringFound ) );
m_Parent->Affiche_Message( msg ); m_Parent->SetStatusText( msg );
m_Parent->CursorGoto( locate_pos ); m_Parent->CursorGoto( locate_pos );
@ -121,7 +121,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event )
} }
else else
{ {
m_Parent->Affiche_Message( wxEmptyString ); m_Parent->SetStatusText( wxEmptyString );
if( FindMarker ) if( FindMarker )
msg = _( "Marker not found" ); msg = _( "Marker not found" );

View File

@ -165,7 +165,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
break; break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */ case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:
@ -218,7 +218,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosi
&& ( (GetCurItem()->m_Flags & IS_NEW) != 0 ) ) && ( (GetCurItem()->m_Flags & IS_NEW) != 0 ) )
{ {
// A new track is in progress: call to End_Route() // A new track is in progress: call to End_Route()
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
End_Route( (TRACK*) GetCurItem(), aDC ); End_Route( (TRACK*) GetCurItem(), aDC );
} }
break; break;

View File

@ -60,7 +60,7 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */ case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
if( !blockActive ) if( !blockActive )
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
break; break;
case HK_SWITCH_UNITS: case HK_SWITCH_UNITS:

View File

@ -1119,7 +1119,7 @@ int WinEDA_PcbFrame::ReadPcbFile( LINE_READER* aReader, bool Append )
board->SynchronizeNetsAndNetClasses(); board->SynchronizeNetsAndNetClasses();
m_TrackAndViasSizesList_Changed = true; m_TrackAndViasSizesList_Changed = true;
Affiche_Message( wxEmptyString ); SetStatusText( wxEmptyString );
BestZoom(); BestZoom();
SetToolbars(); SetToolbars();
return 1; return 1;
@ -1173,7 +1173,7 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile )
if( !rc ) if( !rc )
DisplayError( this, wxT( "Unable to save PCB file" ) ); DisplayError( this, wxT( "Unable to save PCB file" ) );
else else
Affiche_Message( wxEmptyString ); SetStatusText( wxEmptyString );
return rc; return rc;
} }

View File

@ -388,7 +388,7 @@ void WinEDA_ModuleEditFrame::Delete_Module_In_Library( const wxString& aLibname
msg.Printf( _( "Component %s deleted in library %s" ), GetChars( CmpName ), msg.Printf( _( "Component %s deleted in library %s" ), GetChars( CmpName ),
GetChars( oldFileName.GetFullPath() ) ); GetChars( oldFileName.GetFullPath() ) );
Affiche_Message( msg ); SetStatusText( msg );
CreateDocLibrary( oldFileName.GetFullPath() ); CreateDocLibrary( oldFileName.GetFullPath() );
} }
@ -583,7 +583,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
{ {
msg = _( "Module exists\n Line: " ); msg = _( "Module exists\n Line: " );
msg << LineNum; msg << LineNum;
Affiche_Message( msg ); SetStatusText( msg );
} }
if( !aOverwrite ) /* Do not save the given footprint: an old if( !aOverwrite ) /* Do not save the given footprint: an old
* one exists */ * one exists */
@ -714,7 +714,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
msg = _( "Component " ); msg += Name_Cmp; msg = _( "Component " ); msg += Name_Cmp;
msg += added ? _( " added in " ) : _( " replaced in " ); msg += added ? _( " added in " ) : _( " replaced in " );
msg += aLibName; msg += aLibName;
Affiche_Message( msg ); SetStatusText( msg );
} }
return 1; return 1;
@ -763,7 +763,7 @@ MODULE* WinEDA_BasePcbFrame::Create_1_Module( const wxString& aModuleName )
GetBoard()->Add( Module ); GetBoard()->Add( Module );
/* Update parameters: position, timestamp ... */ /* Update parameters: position, timestamp ... */
newpos = GetScreen()->m_Curseur; newpos = GetScreen()->GetCrossHairPosition();
Module->SetPosition( newpos ); Module->SetPosition( newpos );
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );

View File

@ -83,10 +83,12 @@ bool WinEDA_ModuleEditFrame::Load_Module_From_BOARD( MODULE* Module )
GetBoard()->m_NetInfo->BuildListOfNets(); GetBoard()->m_NetInfo->BuildListOfNets();
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0; GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
Place_Module( Module, NULL ); Place_Module( Module, NULL );
if( Module->GetLayer() != LAYER_N_FRONT ) if( Module->GetLayer() != LAYER_N_FRONT )
Module->Flip( Module->m_Pos ); Module->Flip( Module->m_Pos );
Rotate_Module( NULL, Module, 0, false ); Rotate_Module( NULL, Module, 0, false );
GetScreen()->ClrModify(); GetScreen()->ClrModify();
Zoom_Automatique( TRUE ); Zoom_Automatique( TRUE );
@ -99,7 +101,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
wxDC* DC ) wxDC* DC )
{ {
MODULE* module; MODULE* module;
wxPoint curspos = GetScreen()->m_Curseur; wxPoint curspos = GetScreen()->GetCrossHairPosition();
wxString ModuleName, keys; wxString ModuleName, keys;
static wxArrayString HistoryList; static wxArrayString HistoryList;
static wxString lastCommponentName; static wxString lastCommponentName;
@ -118,7 +120,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
if( ModuleName.IsEmpty() ) /* Cancel command */ if( ModuleName.IsEmpty() ) /* Cancel command */
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; return NULL;
} }
@ -132,7 +134,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
keys ); keys );
if( ModuleName.IsEmpty() ) /* Cancel command */ if( ModuleName.IsEmpty() ) /* Cancel command */
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; return NULL;
} }
} }
@ -144,7 +146,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
wxEmptyString ); wxEmptyString );
if( ModuleName.IsEmpty() ) if( ModuleName.IsEmpty() )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; /* Cancel command. */ return NULL; /* Cancel command. */
} }
} }
@ -160,15 +162,15 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
wxEmptyString ); wxEmptyString );
if( ModuleName.IsEmpty() ) if( ModuleName.IsEmpty() )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; /* Cancel command. */ return NULL; /* Cancel command. */
} }
else else
module = Get_Librairie_Module( library, ModuleName, TRUE ); module = Get_Librairie_Module( library, ModuleName, TRUE );
} }
GetScreen()->m_Curseur = curspos; GetScreen()->SetCrossHairPosition( curspos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( module ) if( module )
{ {
@ -263,7 +265,7 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module(
FILTER_READER reader( fileReader ); FILTER_READER reader( fileReader );
msg.Printf( _( "Scan Lib: %s" ), GetChars( tmp ) ); msg.Printf( _( "Scan Lib: %s" ), GetChars( tmp ) );
Affiche_Message( msg ); SetStatusText( msg );
/* Reading header ENTETE_LIBRAIRIE */ /* Reading header ENTETE_LIBRAIRIE */
reader.ReadLine(); reader.ReadLine();
@ -331,7 +333,7 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module(
NewModule->ReadDescr( &reader ); NewModule->ReadDescr( &reader );
SetLocaleTo_Default(); // revert to the current locale SetLocaleTo_Default(); // revert to the current locale
GetBoard()->Add( NewModule, ADD_APPEND ); GetBoard()->Add( NewModule, ADD_APPEND );
Affiche_Message( wxEmptyString ); SetStatusText( wxEmptyString );
return NewModule; return NewModule;
} }
} }
@ -429,7 +431,7 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
// Statusbar library loaded message // Statusbar library loaded message
msg = _( "Library " ) + fn.GetFullPath() + _( " loaded" ); msg = _( "Library " ) + fn.GetFullPath() + _( " loaded" );
Affiche_Message( msg ); SetStatusText( msg );
/* Read header. */ /* Read header. */
reader.ReadLine(); reader.ReadLine();

View File

@ -175,8 +175,6 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
BASE_SCREEN* screen = Panel->GetScreen(); BASE_SCREEN* screen = Panel->GetScreen();
MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem(); MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem();
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL ); ( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL );
if( MirePcb == NULL ) if( MirePcb == NULL )
@ -218,7 +216,7 @@ MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
MirePcb->SetLayer( EDGE_N ); MirePcb->SetLayer( EDGE_N );
MirePcb->m_Width = GetBoard()->GetBoardDesignSettings()->m_EdgeSegmentWidth; MirePcb->m_Width = GetBoard()->GetBoardDesignSettings()->m_EdgeSegmentWidth;
MirePcb->m_Size = MireDefaultSize; MirePcb->m_Size = MireDefaultSize;
MirePcb->m_Pos = DrawPanel->GetScreen()->m_Curseur; MirePcb->m_Pos = DrawPanel->GetScreen()->GetCrossHairPosition();
Place_Mire( MirePcb, DC ); Place_Mire( MirePcb, DC );
@ -235,8 +233,7 @@ void WinEDA_PcbFrame::StartMove_Mire( MIREPCB* MirePcb, wxDC* DC )
s_TargetCopy = *MirePcb; s_TargetCopy = *MirePcb;
MirePcb->m_Flags |= IS_MOVED; MirePcb->m_Flags |= IS_MOVED;
DrawPanel->ManageCurseur = ShowTargetShapeWhileMovingMouse; DrawPanel->SetMouseCapture( ShowTargetShapeWhileMovingMouse, AbortMoveAndEditTarget );
DrawPanel->ForceCloseManageCurseur = AbortMoveAndEditTarget;
SetCurItem( MirePcb ); SetCurItem( MirePcb );
} }
@ -247,8 +244,7 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
return; return;
MirePcb->Draw( DrawPanel, DC, GR_OR ); MirePcb->Draw( DrawPanel, DC, GR_OR );
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
OnModify(); OnModify();
@ -259,12 +255,9 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
return; return;
} }
if( MirePcb->m_Flags == IS_MOVED ) if( MirePcb->m_Flags == IS_MOVED )
{ {
SaveCopyInUndoList( MirePcb, SaveCopyInUndoList( MirePcb, UR_MOVED, MirePcb->m_Pos - s_TargetCopy.m_Pos );
UR_MOVED,
MirePcb->m_Pos - s_TargetCopy.m_Pos );
MirePcb->m_Flags = 0; MirePcb->m_Flags = 0;
return; return;
} }
@ -275,6 +268,7 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
SaveCopyInUndoList( MirePcb, UR_CHANGED ); SaveCopyInUndoList( MirePcb, UR_CHANGED );
SwapData( MirePcb, &s_TargetCopy ); SwapData( MirePcb, &s_TargetCopy );
} }
MirePcb->m_Flags = 0; MirePcb->m_Flags = 0;
} }
@ -292,7 +286,7 @@ static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( aErase ) if( aErase )
MirePcb->Draw( aPanel, aDC, GR_XOR ); MirePcb->Draw( aPanel, aDC, GR_XOR );
MirePcb->m_Pos = screen->m_Curseur; MirePcb->m_Pos = screen->GetCrossHairPosition();
MirePcb->Draw( aPanel, aDC, GR_XOR ); MirePcb->Draw( aPanel, aDC, GR_XOR );
} }

View File

@ -116,7 +116,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
PopupMenu( &itemMenu ); // m_AbortRequest = false if an PopupMenu( &itemMenu ); // m_AbortRequest = false if an
// item is selected // item is selected
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
@ -203,13 +203,15 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
default: default:
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->IsMouseCaptured() )
{ {
// for all other commands: stop the move in progress // for all other commands: stop the move in progress
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
} }
if( id != ID_POPUP_CANCEL_CURRENT_COMMAND ) if( id != ID_POPUP_CANCEL_CURRENT_COMMAND )
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
} }
@ -238,9 +240,10 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
Clear_Pcb( true ); Clear_Pcb( true );
GetScreen()->ClearUndoRedoList(); GetScreen()->ClearUndoRedoList();
SetCurItem( NULL ); SetCurItem( NULL );
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
MODULE* module = Create_1_Module( wxEmptyString ); MODULE* module = Create_1_Module( wxEmptyString );
if( module ) // i.e. if create module command not aborted if( module ) // i.e. if create module command not aborted
{ {
// Initialize data relative to nets and netclasses (for a new // Initialize data relative to nets and netclasses (for a new
@ -332,10 +335,10 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
} }
else // This is an insert command else // This is an insert command
{ {
wxPoint cursor_pos = pcbframe->GetScreen()->m_Curseur; wxPoint cursor_pos = pcbframe->GetScreen()->GetCrossHairPosition();
pcbframe->GetScreen()->m_Curseur = wxPoint( 0, 0 ); pcbframe->GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
pcbframe->Place_Module( newmodule, NULL ); pcbframe->Place_Module( newmodule, NULL );
pcbframe->GetScreen()->m_Curseur = cursor_pos; pcbframe->GetScreen()->SetCrossHairPosition( cursor_pos );
newmodule->m_TimeStamp = GetTimeStamp(); newmodule->m_TimeStamp = GetTimeStamp();
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW ); pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
} }
@ -352,7 +355,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; // //this command is aborted break; // //this command is aborted
GetScreen()->ClearUndoRedoList(); GetScreen()->ClearUndoRedoList();
SetCurItem( NULL ); SetCurItem( NULL );
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
Import_Module( ); Import_Module( );
redraw = true; redraw = true;
if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules )
@ -379,20 +382,21 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_LOAD_MODULE: case ID_MODEDIT_LOAD_MODULE:
{ {
wxString full_libraryfilename; wxString full_libraryfilename;
if( !m_CurrentLib.IsEmpty() ) if( !m_CurrentLib.IsEmpty() )
{ {
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
ModuleFileExtension );
full_libraryfilename = wxGetApp().FindLibraryPath( fn ); full_libraryfilename = wxGetApp().FindLibraryPath( fn );
} }
GetScreen()->ClearUndoRedoList(); GetScreen()->ClearUndoRedoList();
SetCurItem( NULL ); SetCurItem( NULL );
Clear_Pcb( true ); Clear_Pcb( true );
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
Load_Module_From_Library( full_libraryfilename, NULL ); Load_Module_From_Library( full_libraryfilename, NULL );
redraw = true; redraw = true;
} }
if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules )
GetBoard()->m_Modules->m_Flags = 0; GetBoard()->m_Modules->m_Flags = 0;
@ -480,13 +484,13 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE: case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true ); Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true );
redraw = true; redraw = true;
break; break;
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE: case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), -900, true ); Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), -900, true );
redraw = true; redraw = true;
break; break;
@ -498,7 +502,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->m_Flags = 0; GetScreen()->GetCurItem()->m_Flags = 0;
GetScreen()->GetCurItem()->m_Flags = 0; GetScreen()->GetCurItem()->m_Flags = 0;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( ret > 0 ) if( ret > 0 )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
@ -506,7 +510,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_PAD_REQUEST: case ID_POPUP_PCB_MOVE_PAD_REQUEST:
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc ); StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc );
} }
break; break;
@ -514,7 +518,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_PAD: case ID_POPUP_PCB_EDIT_PAD:
{ {
InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem() ); InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem() );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
} }
break; break;
@ -522,23 +526,23 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
DeletePad( (D_PAD*) GetScreen()->GetCurItem(), false ); DeletePad( (D_PAD*) GetScreen()->GetCurItem(), false );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true ); Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true );
break; break;
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
Global_Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true ); Global_Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS: case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Export_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem() ); Export_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem() );
break; break;
@ -546,13 +550,13 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
InstallTextModOptionsFrame( InstallTextModOptionsFrame(
(TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
} }
break; break;
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST: case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
} }
break; break;
@ -560,7 +564,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_ROTATE_TEXTMODULE: case ID_POPUP_PCB_ROTATE_TEXTMODULE:
{ {
RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
} }
break; break;
@ -568,18 +572,18 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
DeleteTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem() ); DeleteTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem() );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_MOVE_EDGE: case ID_POPUP_PCB_MOVE_EDGE:
{ {
Start_Move_EdgeMod( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc ); Start_Move_EdgeMod( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
} }
break; break;
case ID_POPUP_PCB_STOP_CURRENT_DRAWING: case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) ) if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) )
{ {
End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem() ); End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem() );
@ -596,7 +600,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
edge = (EDGE_MODULE*) GetScreen()->GetCurItem(); edge = (EDGE_MODULE*) GetScreen()->GetCurItem();
} }
Enter_Edge_Width( edge ); Enter_Edge_Width( edge );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( edge ) if( edge )
DrawPanel->Refresh(); DrawPanel->Refresh();
@ -604,32 +608,32 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE: case ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem() ); Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem() );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE: case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Edit_Edge_Width( NULL ); Edit_Edge_Width( NULL );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE: case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem() ); Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem() );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE: case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
Edit_Edge_Layer( NULL ); Edit_Edge_Layer( NULL );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
case ID_POPUP_PCB_DELETE_EDGE: case ID_POPUP_PCB_DELETE_EDGE:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
RemoveStruct( GetScreen()->GetCurItem() ); RemoveStruct( GetScreen()->GetCurItem() );
SetCurItem( NULL ); SetCurItem( NULL );
break; break;

View File

@ -25,7 +25,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
DrawPanel->CursorOff( DC ); DrawPanel->CrossHairOff( DC );
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
{ {
if( item && item->m_Flags ) // Command in progress if( item && item->m_Flags ) // Command in progress
@ -135,13 +135,10 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
break; break;
module->m_Flags = 0; module->m_Flags = 0;
SaveCopyInUndoList( module, UR_MODEDIT ); SaveCopyInUndoList( module, UR_MODEDIT );
Place_Ancre( module ); // set the new relatives internal Place_Ancre( module ); // set the new relatives internal coordinates of items
// coordinates of items RedrawScreen( wxPoint( 0, 0 ), true );
GetScreen()->m_Curseur = wxPoint( 0, 0 );
RedrawScreen( TRUE );
// Replace the module in position 0, to recalculate absolutes // Replace the module in position 0, to recalculate absolutes coordinates of items
// coordinates of items
module->SetPosition( wxPoint( 0, 0 ) ); module->SetPosition( wxPoint( 0, 0 ) );
SetToolID( 0, 0, wxEmptyString ); SetToolID( 0, 0, wxEmptyString );
SetCurItem( NULL ); SetCurItem( NULL );
@ -151,7 +148,7 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
case ID_PCB_PLACE_GRID_COORD_BUTT: case ID_PCB_PLACE_GRID_COORD_BUTT:
DrawPanel->DrawGridAxis( DC, GR_XOR ); DrawPanel->DrawGridAxis( DC, GR_XOR );
GetScreen()->m_GridOrigin = GetScreen()->m_Curseur; GetScreen()->m_GridOrigin = GetScreen()->GetCrossHairPosition();
DrawPanel->DrawGridAxis( DC, GR_COPY ); DrawPanel->DrawGridAxis( DC, GR_COPY );
GetScreen()->SetModify(); GetScreen()->SetModify();
break; break;
@ -172,13 +169,12 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
break; break;
default: default:
DisplayError( this, DisplayError( this, wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) );
wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) );
SetToolID( 0, 0, wxEmptyString ); SetToolID( 0, 0, wxEmptyString );
break; break;
} }
DrawPanel->CursorOn( DC ); DrawPanel->CrossHairOn( DC );
} }
@ -186,8 +182,7 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
* Create the pull up menu * Create the pull up menu
* After this menu is built, the standard ZOOM menu is added * After this menu is built, the standard ZOOM menu is added
*/ */
bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
wxMenu* PopMenu )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
wxString msg; wxString msg;
@ -432,7 +427,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{ {
case TYPE_PAD: case TYPE_PAD:
InstallPadOptionsFrame( (D_PAD*) item ); InstallPadOptionsFrame( (D_PAD*) item );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
case TYPE_MODULE: case TYPE_MODULE:
@ -440,7 +435,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item ); DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->m_Flags = 0; GetScreen()->GetCurItem()->m_Flags = 0;
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( ret > 0 ) if( ret > 0 )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
@ -448,7 +443,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC ); InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC );
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
break; break;
default: default:

View File

@ -38,7 +38,7 @@ void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD: case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message( wxEmptyString ); SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id ); DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
UpdateStatusBar(); UpdateStatusBar();
break; break;

View File

@ -475,8 +475,8 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio
return; return;
} }
PutOnGrid( &pos ); pos = GetScreen()->GetNearestGridPosition( aPosition );
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize(); gridSize = GetScreen()->GetGridSize();
switch( g_KeyPressed ) switch( g_KeyPressed )
@ -510,19 +510,19 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio
break; break;
} }
GetScreen()->m_Curseur = pos; GetScreen()->SetCrossHairPosition( pos );
if( oldpos != GetScreen()->m_Curseur ) if( oldpos != GetScreen()->GetCrossHairPosition() )
{ {
pos = GetScreen()->m_Curseur; pos = GetScreen()->GetCrossHairPosition();
GetScreen()->m_Curseur = oldpos; GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->CursorOff( aDC ); DrawPanel->CrossHairOff( aDC );
GetScreen()->m_Curseur = pos; GetScreen()->SetCrossHairPosition( pos );
DrawPanel->CursorOn( aDC ); DrawPanel->CrossHairOn( aDC );
if( DrawPanel->ManageCurseur ) if( DrawPanel->IsMouseCaptured() )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, true ); DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true );
} }
} }

View File

@ -95,8 +95,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
} }
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
DrawPanel->ManageCurseur = Montre_Position_Empreinte; DrawPanel->SetMouseCapture( Montre_Position_Empreinte, Abort_MoveOrCopyModule );
DrawPanel->ForceCloseManageCurseur = Abort_MoveOrCopyModule;
DrawPanel->m_AutoPAN_Request = true; DrawPanel->m_AutoPAN_Request = true;
// Erase the module. // Erase the module.
@ -108,7 +107,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
module->m_Flags = tmp; module->m_Flags = tmp;
} }
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
} }
@ -173,13 +172,14 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
module, module,
s_ModuleInitialCopy->m_Orient, s_ModuleInitialCopy->m_Orient,
FALSE ); FALSE );
if( s_ModuleInitialCopy->GetLayer() != module->GetLayer() ) if( s_ModuleInitialCopy->GetLayer() != module->GetLayer() )
pcbframe->Change_Side_Module( module, NULL ); pcbframe->Change_Side_Module( module, NULL );
module->Draw( Panel, DC, GR_OR ); module->Draw( Panel, DC, GR_OR );
} }
g_Drag_Pistes_On = FALSE; g_Drag_Pistes_On = FALSE;
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
pcbframe->SetCurItem( NULL ); pcbframe->SetCurItem( NULL );
delete s_ModuleInitialCopy; delete s_ModuleInitialCopy;
@ -188,6 +188,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
// Display ratsnest is allowed // Display ratsnest is allowed
pcbframe->GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST; pcbframe->GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST;
if( pcbframe->GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) if( pcbframe->GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
pcbframe->DrawGeneralRatsnest( DC ); pcbframe->DrawGeneralRatsnest( DC );
@ -246,7 +247,7 @@ void Montre_Position_Empreinte( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint
} }
/* Redraw the module at the new position. */ /* Redraw the module at the new position. */
g_Offset_Module = module->m_Pos - aPanel->GetScreen()->m_Curseur; g_Offset_Module = module->m_Pos - aPanel->GetScreen()->GetCrossHairPosition();
DrawModuleOutlines( aPanel, aDC, module ); DrawModuleOutlines( aPanel, aDC, module );
Dessine_Segments_Dragges( aPanel, aDC ); Dessine_Segments_Dragges( aPanel, aDC );
@ -421,7 +422,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
&& DC ) && DC )
trace_ratsnest_module( DC ); trace_ratsnest_module( DC );
newpos = GetScreen()->m_Curseur; newpos = GetScreen()->GetCrossHairPosition();
module->SetPosition( newpos ); module->SetPosition( newpos );
module->m_Flags = 0; module->m_Flags = 0;
@ -438,6 +439,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
{ {
pt_segm = g_DragSegmentList[ii].m_Segm; pt_segm = g_DragSegmentList[ii].m_Segm;
pt_segm->SetState( EDIT, OFF ); pt_segm->SetState( EDIT, OFF );
if( DC ) if( DC )
pt_segm->Draw( DrawPanel, DC, GR_OR ); pt_segm->Draw( DrawPanel, DC, GR_OR );
} }
@ -446,13 +448,11 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
EraseDragList(); EraseDragList();
} }
g_Drag_Pistes_On = FALSE; g_Drag_Pistes_On = false;
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) && !aDoNotRecreateRatsnest )
if( !aDoNotRecreateRatsnest ) Compile_Ratsnest( DC, true );
Compile_Ratsnest( DC, true );
if( DC ) if( DC )
DrawPanel->Refresh(); DrawPanel->Refresh();

View File

@ -26,8 +26,6 @@ static void Exit_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC )
{ {
D_PAD* pad = s_CurrentSelectedPad; D_PAD* pad = s_CurrentSelectedPad;
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
if( pad == NULL ) if( pad == NULL )
return; return;
@ -67,7 +65,7 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
if( aErase ) if( aErase )
pad->Draw( aPanel, aDC, GR_XOR ); pad->Draw( aPanel, aDC, GR_XOR );
pad->m_Pos = screen->m_Curseur; pad->m_Pos = screen->GetCrossHairPosition();
pad->Draw( aPanel, aDC, GR_XOR ); pad->Draw( aPanel, aDC, GR_XOR );
if( !g_Drag_Pistes_On ) if( !g_Drag_Pistes_On )
@ -196,7 +194,7 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
Import_Pad_Settings( Pad, false ); Import_Pad_Settings( Pad, false );
Pad->SetNetname( wxEmptyString ); Pad->SetNetname( wxEmptyString );
Pad->m_Pos = GetScreen()->m_Curseur; Pad->m_Pos = GetScreen()->GetCrossHairPosition();
rX = Pad->m_Pos.x - Module->m_Pos.x; rX = Pad->m_Pos.x - Module->m_Pos.x;
rY = Pad->m_Pos.y - Module->m_Pos.y; rY = Pad->m_Pos.y - Module->m_Pos.y;
@ -279,8 +277,7 @@ void WinEDA_BasePcbFrame::StartMovePad( D_PAD* Pad, wxDC* DC )
s_CurrentSelectedPad = Pad; s_CurrentSelectedPad = Pad;
Pad_OldPos = Pad->m_Pos; Pad_OldPos = Pad->m_Pos;
Pad->DisplayInfo( this ); Pad->DisplayInfo( this );
DrawPanel->ManageCurseur = Show_Pad_Move; DrawPanel->SetMouseCapture( Show_Pad_Move, Exit_Move_Pad );
DrawPanel->ForceCloseManageCurseur = Exit_Move_Pad;
/* Draw the pad (SKETCH mode) */ /* Draw the pad (SKETCH mode) */
Pad->Draw( DrawPanel, DC, GR_XOR ); Pad->Draw( DrawPanel, DC, GR_XOR );
@ -379,8 +376,7 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
EraseDragList(); EraseDragList();
OnModify(); OnModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
m_Pcb->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK ); m_Pcb->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK );
} }

View File

@ -56,19 +56,18 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
int ii; int ii;
/* Erase the current drawings */ /* Erase the current drawings */
wxPoint oldpos = Panel->GetScreen()->m_Curseur; wxPoint oldpos = Panel->GetScreen()->GetCrossHairPosition();
Panel->GetScreen()->m_Curseur = PosInit; Panel->GetScreen()->SetCrossHairPosition( PosInit );
if( Panel->ManageCurseur ) if( Panel->IsMouseCaptured() )
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, true ); Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->m_Curseur = oldpos; Panel->GetScreen()->SetCrossHairPosition( oldpos );
g_HighLight_Status = false; g_HighLight_Status = false;
( (WinEDA_PcbFrame*) Panel->GetParent() )->GetBoard()->DrawHighLight( ( (WinEDA_PcbFrame*) Panel->GetParent() )->GetBoard()->DrawHighLight( Panel,
Panel, DC,
DC, g_HighLight_NetCode );
g_HighLight_NetCode );
if( NewTrack ) if( NewTrack )
{ {
@ -108,8 +107,6 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
NewTrack = NULL; NewTrack = NULL;
} }
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL ); ( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL );
/* Undo move and redraw trace segments. */ /* Undo move and redraw trace segments. */
@ -158,7 +155,7 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
} }
/* set the new track coordinates */ /* set the new track coordinates */
wxPoint Pos = screen->m_Curseur; wxPoint Pos = screen->GetCrossHairPosition();
moveVector = Pos - s_LastPos; moveVector = Pos - s_LastPos;
s_LastPos = Pos; s_LastPos = Pos;
@ -305,7 +302,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
} }
/* Compute the new track segment position */ /* Compute the new track segment position */
wxPoint Pos = screen->m_Curseur; wxPoint Pos = screen->GetCrossHairPosition();
dx = Pos.x - s_LastPos.x; dx = Pos.x - s_LastPos.x;
dy = Pos.y - s_LastPos.y; dy = Pos.y - s_LastPos.y;
@ -673,7 +670,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
Old_HighLigth_NetCode = g_HighLight_NetCode; Old_HighLigth_NetCode = g_HighLight_NetCode;
if( g_HighLight_Status ) if( g_HighLight_Status )
High_Light( DC ); High_Light( DC );
PosInit = GetScreen()->m_Curseur; PosInit = GetScreen()->GetCrossHairPosition();
if( track->Type() == TYPE_VIA ) // For a via: always drag it if( track->Type() == TYPE_VIA ) // For a via: always drag it
{ {
@ -690,7 +687,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
} }
else else
{ {
int diag = track->IsPointOnEnds( GetScreen()->m_Curseur, -1 ); int diag = track->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 );
wxPoint pos; wxPoint pos;
switch( command ) switch( command )
@ -740,14 +737,13 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
} }
s_LastPos = PosInit; s_LastPos = PosInit;
DrawPanel->ManageCurseur = Show_MoveNode; DrawPanel->SetMouseCapture( Show_MoveNode, Abort_MoveTrack );
DrawPanel->ForceCloseManageCurseur = Abort_MoveTrack;
g_HighLight_NetCode = track->GetNet(); g_HighLight_NetCode = track->GetNet();
g_HighLight_Status = true; g_HighLight_Status = true;
GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode ); GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
} }
@ -940,10 +936,9 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
AddSegmentToDragList( DrawPanel, DC, track->m_Flags, track ); AddSegmentToDragList( DrawPanel, DC, track->m_Flags, track );
PosInit = GetScreen()->m_Curseur; PosInit = GetScreen()->GetCrossHairPosition();
s_LastPos = GetScreen()->m_Curseur; s_LastPos = GetScreen()->GetCrossHairPosition();
DrawPanel->ManageCurseur = Show_Drag_Track_Segment_With_Cte_Slope; DrawPanel->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack );
DrawPanel->ForceCloseManageCurseur = Abort_MoveTrack;
g_HighLight_NetCode = track->GetNet(); g_HighLight_NetCode = track->GetNet();
g_HighLight_Status = true; g_HighLight_Status = true;
@ -964,9 +959,8 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
if( !InitialiseDragParameters() ) if( !InitialiseDragParameters() )
{ {
DisplayError( this, DisplayError( this, _( "Unable to drag this segment: two collinear segments" ) );
_( "Unable to drag this segment: two collinear segments" ) ); DrawPanel->m_mouseCaptureCallback = NULL;
DrawPanel->ManageCurseur = NULL;
Abort_MoveTrack( DrawPanel, DC ); Abort_MoveTrack( DrawPanel, DC );
return; return;
} }
@ -1017,10 +1011,8 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
* (only pad connection must be tested, track connection will be * (only pad connection must be tested, track connection will be
* tested by test_1_net_connexion() ) */ * tested by test_1_net_connexion() ) */
int masque_layer = g_TabOneLayerMask[Track->GetLayer()]; int masque_layer = g_TabOneLayerMask[Track->GetLayer()];
Track->start = Fast_Locate_Pad_Connecte( Track->start = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_Start, masque_layer );
GetBoard(), Track->m_Start, masque_layer ); Track->end = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_End, masque_layer );
Track->end = Fast_Locate_Pad_Connecte(
GetBoard(), Track->m_End, masque_layer );
} }
EraseDragList(); EraseDragList();
@ -1030,8 +1022,7 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
// of picked items // of picked items
OnModify(); OnModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
if( current_net_code > 0 ) if( current_net_code > 0 )
test_1_net_connexion( DC, current_net_code ); test_1_net_connexion( DC, current_net_code );

View File

@ -88,7 +88,7 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GRPoly( &aPanel->m_ClipBox, aDC, 5, poly, false, 0, YELLOW, YELLOW ); GRPoly( &aPanel->m_ClipBox, aDC, 5, poly, false, 0, YELLOW, YELLOW );
} }
Mself.m_End = aPanel->GetScreen()->m_Curseur; Mself.m_End = aPanel->GetScreen()->GetCrossHairPosition();
pt = Mself.m_End - Mself.m_Start; pt = Mself.m_End - Mself.m_Start;
angle = -wxRound( atan2( (double) pt.y, (double) pt.x ) * 1800.0 / M_PI ); angle = -wxRound( atan2( (double) pt.y, (double) pt.x ) * 1800.0 / M_PI );
len = wxRound( sqrt( (double) pt.x * pt.x + (double) pt.y * pt.y ) ); len = wxRound( sqrt( (double) pt.x * pt.x + (double) pt.y * pt.y ) );
@ -113,9 +113,7 @@ void Exit_Self( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Self_On ) if( Self_On )
{ {
Self_On = 0; Self_On = 0;
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, 0 ); Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, 0 );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
} }
} }
@ -128,18 +126,17 @@ void WinEDA_PcbFrame::Begin_Self( wxDC* DC )
return; return;
} }
Mself.m_Start = GetScreen()->m_Curseur; Mself.m_Start = GetScreen()->GetCrossHairPosition();
Mself.m_End = Mself.m_Start; Mself.m_End = Mself.m_Start;
Self_On = 1; Self_On = 1;
/* Update the initial coordinates. */ /* Update the initial coordinates. */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
UpdateStatusBar(); UpdateStatusBar();
DrawPanel->ManageCurseur = ShowBoundingBoxMicroWaveInductor; DrawPanel->SetMouseCapture( ShowBoundingBoxMicroWaveInductor, Exit_Self );
DrawPanel->ForceCloseManageCurseur = Exit_Self; DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
} }
@ -183,9 +180,8 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
int ll; int ll;
wxString msg; wxString msg;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE ); DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = NULL; DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->ForceCloseManageCurseur = NULL;
if( Self_On == 0 ) if( Self_On == 0 )
{ {
@ -195,7 +191,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
Self_On = 0; Self_On = 0;
Mself.m_End = GetScreen()->m_Curseur; Mself.m_End = GetScreen()->GetCrossHairPosition();
wxPoint pt = Mself.m_End - Mself.m_Start; wxPoint pt = Mself.m_End - Mself.m_Start;
int min_len = wxRound( sqrt( (double) pt.x * pt.x + (double) pt.y * pt.y ) ); int min_len = wxRound( sqrt( (double) pt.x * pt.x + (double) pt.y * pt.y ) );
@ -613,7 +609,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
wxTextEntryDialog dlg( this, msg, _( "Create microwave module" ), value ); wxTextEntryDialog dlg( this, msg, _( "Create microwave module" ), value );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; // cancelled by user return NULL; // cancelled by user
} }
@ -629,7 +625,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
"Create microwave module" ), msg ); "Create microwave module" ), msg );
if( angledlg.ShowModal() != wxID_OK ) if( angledlg.ShowModal() != wxID_OK )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; // cancelled by user return NULL; // cancelled by user
} }
msg = angledlg.GetValue(); msg = angledlg.GetValue();
@ -645,7 +641,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
if( abort ) if( abort )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
return NULL; return NULL;
} }
@ -953,7 +949,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape()
frame->Destroy(); frame->Destroy();
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
if( ok != 1 ) if( ok != 1 )
{ {

Some files were not shown because too many files have changed in this diff Show More