Commit 7b8b51b2 authored by Wayne Stambaugh's avatar Wayne Stambaugh

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.
parent 25fe4920
...@@ -47,15 +47,15 @@ void BASE_SCREEN::InitDatas() ...@@ -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 ...@@ -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 ...@@ -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
*/ */
......
...@@ -124,8 +124,7 @@ void BLOCK_SELECTOR::InitData( EDA_DRAW_PANEL* aPanel, const wxPoint& startpos ) ...@@ -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() ...@@ -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 ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
......
...@@ -33,7 +33,7 @@ void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event ) ...@@ -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();
} }
} }
......
...@@ -127,15 +127,6 @@ EDA_DRAW_FRAME::~EDA_DRAW_FRAME() ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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() ...@@ -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 ) ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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.
* *
......
This diff is collapsed.
...@@ -56,7 +56,7 @@ void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC ) ...@@ -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 ) ...@@ -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
} }
} }
......
...@@ -18,15 +18,13 @@ ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
......
...@@ -351,7 +351,7 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
} }
} }
......
...@@ -492,8 +492,7 @@ void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event ) ...@@ -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 );
} }
......
...@@ -100,7 +100,7 @@ void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -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 );
} }
......
This diff is collapsed.
...@@ -80,14 +80,13 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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& ...@@ -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 );
......
...@@ -61,7 +61,7 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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, ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
......
...@@ -45,8 +45,6 @@ static void ExitBusEntry( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -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 ...@@ -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 ...@@ -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 ) ...@@ -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 );
} }
......
...@@ -70,7 +70,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, bool aInc ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
} }
} }
......
...@@ -79,7 +79,7 @@ static bool MarkConnected( SCH_EDIT_FRAME* frame, SCH_ITEM* ListStruct, SCH_LINE ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 )
{ {
......
...@@ -65,7 +65,7 @@ void InstallCmpeditFrame( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aComponent ) ...@@ -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;
} }
......
...@@ -183,7 +183,7 @@ void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent ) ...@@ -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 ) ...@@ -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 );
} }
...@@ -109,7 +109,7 @@ void LIB_EDIT_FRAME::InstallFieldsEditorDialog( wxCommandEvent& event ) ...@@ -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 );
......
...@@ -175,8 +175,7 @@ void DIALOG_ERC::OnLeftDClickMarkersList( wxCommandEvent& event ) ...@@ -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 );
} }
......
...@@ -52,9 +52,9 @@ void SCH_EDIT_FRAME::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC ) ...@@ -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 ) ...@@ -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" ) ); ...@@ -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 ...@@ -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 ...@@ -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();
......
...@@ -62,24 +62,23 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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
} }
...@@ -58,10 +58,10 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -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 )
......
...@@ -65,9 +65,9 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event ) ...@@ -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 ...@@ -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 ...@@ -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 ) ...@@ -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 );
......
...@@ -34,8 +34,7 @@ wxString SCH_EDIT_FRAME::SelectFromLibBrowser( void ) ...@@ -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 ) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 ...@@ -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, ...@@ -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, ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
} }
...@@ -270,7 +270,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet() ...@@ -270,7 +270,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
} }
else else
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MoveCursorToCrossHair();
RedrawScreen( true ); RedrawScreen( screen->GetScrollCenterPosition(), true );
} }
} }
...@@ -299,7 +299,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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:
......
...@@ -66,7 +66,7 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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;
......
...@@ -49,7 +49,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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;
} }
...@@ -347,13 +347,13 @@ int LIB_EDIT_FRAME::BestZoom() ...@@ -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() ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
} }
...@@ -166,7 +166,7 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor() ...@@ -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;
......
...@@ -47,7 +47,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ) ...@@ -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;
} }
......
...@@ -352,7 +352,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -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 ) ...@@ -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:
......
...@@ -71,7 +71,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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 )
{ {
......
...@@ -123,7 +123,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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?" ) ); ...@@ -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?" ) ); ...@@ -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 ) ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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( );
......
...@@ -366,8 +366,7 @@ void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) ...@@ -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();
......
...@@ -417,9 +417,9 @@ void SCH_SHEET::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) ...@@ -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 );
......
This diff is collapsed.
...@@ -398,8 +398,7 @@ int SCH_EDIT_FRAME::BestZoom() ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) );
} }
} }
......
...@@ -210,7 +210,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -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 ) ...@@ -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& ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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
{ {
......
...@@ -57,8 +57,6 @@ static void ExitPinSheet( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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;
......
...@@ -107,11 +107,8 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -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 ) ...@@ -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* ...@@ -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* ...@@ -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 ) ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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& ...@@ -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 ) ...@@ -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();
} }
...@@ -52,8 +52,8 @@ void LIB_EDIT_FRAME::LoadOneSymbol( void ) ...@@ -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() ...@@ -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();
} }
...@@ -301,7 +301,7 @@ void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv ) ...@@ -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() ...@@ -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() ...@@ -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;
} }
......
...@@ -296,7 +296,7 @@ void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -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 );
......
...@@ -89,11 +89,11 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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();
......
...@@ -20,7 +20,7 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
} }
} }
......
...@@ -97,10 +97,10 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -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
......
...@@ -97,7 +97,8 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -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 ) ...@@ -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;
} }
......
...@@ -247,7 +247,7 @@ int WinEDA_GerberFrame::BestZoom() ...@@ -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;
......
...@@ -126,7 +126,7 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -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:
......
...@@ -15,8 +15,9 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc ) ...@@ -15,8 +15,9 @@ 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;
......
...@@ -54,7 +54,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -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;
......
...@@ -62,10 +62,18 @@ class BASE_SCREEN : public EDA_ITEM ...@@ -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: ...@@ -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.
*/
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.
* *
* @return - The cursor position in drawing coordinates.
*/ */
wxPoint GetCursorDrawPosition() { return wxPoint( m_Curseur.x, -m_Curseur.y ); } void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
/* general Undo/Redo command control */ /* general Undo/Redo command control */
...@@ -352,7 +374,7 @@ public: ...@@ -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: ...@@ -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)
/** /**
......
...@@ -15,6 +15,18 @@ class BASE_SCREEN; ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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: ...@@ -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 */
...@@ -281,7 +281,6 @@ public: ...@@ -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: ...@@ -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: ...@@ -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 );
/** 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 PutOnGrid( wxPoint* aCoord , wxRealPoint* aGridSize = NULL ); void RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer );
void Zoom_Automatique( bool move_mouse_cursor ); void Zoom_Automatique( bool aWarpPointer );
/* 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: ...@@ -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: ...@@ -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()
}; };
......
...@@ -22,10 +22,10 @@ void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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();
} }
...@@ -90,15 +90,14 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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;
......
...@@ -276,10 +276,10 @@ end_of_tst: ...@@ -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 ) ...@@ -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 ) ...@@ -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 )
......
...@@ -158,7 +158,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) ...@@ -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 ) ...@@ -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 );
} }
......
...@@ -112,7 +112,7 @@ int WinEDA_BasePcbFrame::BestZoom( void ) ...@@ -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 ) ...@@ -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() ...@@ -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;
......
...@@ -85,15 +85,15 @@ private: ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ...@@ -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() ...@@ -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() ...@@ -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();
......
...@@ -103,14 +103,13 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -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 ) ...@@ -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 ) ...@@ -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,17 +190,14 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -189,17 +190,14 @@ 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()->ClearBlockCommand();
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); 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;
} }
...@@ -217,10 +215,10 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC ) ...@@ -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 ) ...@@ -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 ...@@ -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 );
......
...@@ -74,7 +74,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC, ...@@ -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, ...@@ -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, ...@@ -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 );
......
...@@ -370,7 +370,7 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code ) ...@@ -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;
} }
......
...@@ -214,7 +214,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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
......
...@@ -41,6 +41,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
} }
......
...@@ -85,8 +85,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -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 ) ...@@ -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;
} }
......
...@@ -452,20 +452,17 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -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 ) ...@@ -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 );
} }
...@@ -426,10 +426,10 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -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) ...@@ -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);
} }
...@@ -144,7 +144,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -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;
......
...@@ -68,7 +68,7 @@ void WinEDA_PcbFrame::InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wx ...@@ -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;
} }
......
...@@ -64,7 +64,7 @@ void WinEDA_PcbFrame::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC ) ...@@ -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;
} }
......
...@@ -211,9 +211,7 @@ static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -211,9 +211,7 @@ 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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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, ...@@ -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;
......
...@@ -38,14 +38,14 @@ void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -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 ) ...@@ -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 ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 ) ...@@ -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;
} }
This diff is collapsed.
...@@ -32,9 +32,6 @@ static TEXTE_PCB s_TextCopy( (BOARD_ITEM*) NULL ); /* copy of the edited text ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
......
...@@ -126,10 +126,10 @@ void WinEDA_PcbFrame::Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 );
......
...@@ -32,12 +32,11 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) ...@@ -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 ) ...@@ -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 ...@@ -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 ) ...@@ -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, ...@@ -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 ) ...@@ -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, ...@@ -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 );
......
...@@ -66,9 +66,9 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod ) ...@@ -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.
......
...@@ -142,7 +142,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -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 ) ...@@ -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 ) ...@@ -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();
......
...@@ -61,8 +61,6 @@ static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -60,7 +60,7 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aP ...@@ -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:
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment