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()
{
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.y = -ReturnPageSize().y / 2;
}
else
{
m_DrawOrg.x = m_DrawOrg.y = 0;
m_Curseur.x = ReturnPageSize().x / 2;
m_Curseur.y = ReturnPageSize().y / 2;
m_crossHairPosition.x = ReturnPageSize().x / 2;
m_crossHairPosition.y = ReturnPageSize().y / 2;
}
m_O_Curseur.x = m_O_Curseur.y = 0;
......@@ -417,15 +417,15 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoi
wxPoint BASE_SCREEN::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize )
{
if( aOnGrid )
return GetNearestGridPosition( m_Curseur, aGridSize );
return GetNearestGridPosition( m_crossHairPosition, aGridSize );
return m_Curseur;
return m_crossHairPosition;
}
wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const
{
wxPoint pos = m_Curseur - m_DrawOrg;
wxPoint pos = m_crossHairPosition - m_DrawOrg;
double scalar = GetScalingFactor();
pos.x = wxRound( (double) pos.x * scalar );
......@@ -434,6 +434,14 @@ wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const
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
*/
......
......@@ -124,8 +124,7 @@ void BLOCK_SELECTOR::InitData( EDA_DRAW_PANEL* aPanel, const wxPoint& startpos )
SetOrigin( startpos );
SetSize( wxSize( 0, 0 ) );
m_ItemsSelection.ClearItemsList();
aPanel->ManageCurseur = DrawAndSizingBlockOutlines;
aPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
aPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
}
......@@ -164,6 +163,7 @@ void BLOCK_SELECTOR::Clear()
{
if( m_Command != BLOCK_IDLE )
{
m_Flags = 0;
m_Command = BLOCK_IDLE;
m_State = STATE_NO_BLOCK;
ClearItemsList();
......@@ -216,20 +216,20 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
{
DisplayError( this, wxT( "No Block to paste" ), 20 );
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL;
DrawPanel->m_mouseCaptureCallback = NULL;
return true;
}
if( DrawPanel->ManageCurseur == NULL )
if( !DrawPanel->IsMouseCaptured() )
{
Block->m_ItemsSelection.ClearItemsList();
DisplayError( this,
wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: ManageCurseur NULL" ) );
wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
return true;
}
Block->m_State = STATE_BLOCK_MOVE;
DrawPanel->ManageCurseur( DrawPanel, DC, startpos, false );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, startpos, false );
break;
default:
......@@ -265,8 +265,8 @@ void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoin
if( aErase )
PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
PtBlock->m_BlockLastCursorPosition = aPanel->GetScreen()->m_Curseur;
PtBlock->SetEnd( aPanel->GetScreen()->m_Curseur );
PtBlock->m_BlockLastCursorPosition = aPanel->GetScreen()->GetCrossHairPosition();
PtBlock->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() );
PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
......@@ -286,12 +286,11 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
BASE_SCREEN* screen = Panel->GetScreen();
if( Panel->ManageCurseur ) /* Erase current drawing
* on screen */
if( Panel->IsMouseCaptured() ) /* Erase current drawing on screen */
{
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, false ); /* Clear block outline. */
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
/* Clear block outline. */
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false );
Panel->SetMouseCapture( NULL, NULL );
screen->SetCurItem( NULL );
/* Delete the picked wrapper if this is a picked list. */
......@@ -301,7 +300,6 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
screen->m_BlockLocate.m_Flags = 0;
screen->m_BlockLocate.m_State = STATE_NO_BLOCK;
screen->m_BlockLocate.m_Command = BLOCK_ABORT;
Panel->GetParent()->HandleBlockEnd( DC );
......
......@@ -33,7 +33,7 @@ void EDA_DRAW_FRAME::CopyToClipboard( wxCommandEvent& event )
if( GetScreen()->IsBlockActive() )
DrawPanel->SetCursor( wxCursor( DrawPanel->GetDefaultCursor() ) );
DrawPanel->UnManageCursor();
DrawPanel->EndMouseCapture();
}
}
......
......@@ -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()
{
if( MsgPanel )
......@@ -193,10 +184,9 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
* because EDA_DRAW_FRAME does not know how to print a page
* This is the reason it is a virtual function
*/
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,int aPrintMask,
bool aPrintMirrorMode, void* aData )
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,int aPrintMask, bool aPrintMirrorMode, void* aData )
{
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error"));
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
}
......@@ -256,7 +246,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
* index returned by GetSelection().
*/
m_LastGridSizeId = id - ID_POPUP_GRID_LEVEL_1000;
screen->m_Curseur = DrawPanel->GetScreenCenterLogicalPosition();
screen->SetCrossHairPosition( DrawPanel->GetScreenCenterLogicalPosition() );
screen->SetGrid( id );
Refresh();
}
......@@ -292,15 +282,14 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
if( GetScreen()->GetZoom() == selectedZoom )
return;
GetScreen()->m_Curseur = DrawPanel->GetScreenCenterLogicalPosition();
GetScreen()->SetZoom( selectedZoom );
RedrawScreen( false );
RedrawScreen( GetScreen()->GetScrollCenterPosition(), false );
}
}
/* Return the current zoom level */
int EDA_DRAW_FRAME::GetZoom(void)
int EDA_DRAW_FRAME::GetZoom( void )
{
return GetScreen()->GetZoom();
}
......@@ -469,7 +458,7 @@ int EDA_DRAW_FRAME::ReturnBlockCommand( int key )
void EDA_DRAW_FRAME::InitBlockPasteInfos()
{
GetScreen()->m_BlockLocate.ClearItemsList();
DrawPanel->ManageCurseur = NULL;
DrawPanel->m_mouseCaptureCallback = NULL;
}
......@@ -484,7 +473,7 @@ bool EDA_DRAW_FRAME::HandleBlockEnd( wxDC* DC )
}
void EDA_DRAW_FRAME::AdjustScrollBars()
void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPosition )
{
int unitsX, unitsY, posX, posY;
wxSize drawingSize, clientSize;
......@@ -537,8 +526,9 @@ void EDA_DRAW_FRAME::AdjustScrollBars()
unitsY = wxRound( (double) drawingSize.y * scalar );
// Calculate the position, place the cursor at the center of screen.
posX = screen->m_Curseur.x - screen->m_DrawOrg.x;
posY = screen->m_Curseur.y - screen->m_DrawOrg.y;
screen->SetScrollCenterPosition( aCenterPosition );
posX = aCenterPosition.x - screen->m_DrawOrg.x;
posY = aCenterPosition.y - screen->m_DrawOrg.y;
posX -= wxRound( (double) clientSize.x / 2.0 );
posY -= wxRound( (double) clientSize.y / 2.0 );
......@@ -612,6 +602,7 @@ double RoundTo0( double x, double precision )
return (double) ix / precision;
}
/**
* Function UpdateStatusBar
* Displays in the bottom of the main window a stust:
......@@ -639,8 +630,8 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
SetStatusText( Line, 1 );
/* Display absolute coordinates: */
double dXpos = To_User_Unit( g_UserUnit, screen->m_Curseur.x, m_InternalUnits );
double dYpos = To_User_Unit( g_UserUnit, screen->m_Curseur.y, m_InternalUnits );
double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x, 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
......@@ -694,8 +685,8 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
SetStatusText( Line, 2 );
/* Display relative coordinates: */
dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx, m_InternalUnits );
dYpos = To_User_Unit( g_UserUnit, dy, m_InternalUnits );
......@@ -710,6 +701,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
SetStatusText( Line, 3 );
}
/**
* Load draw frame specific configuration settings.
*
......
This diff is collapsed.
......@@ -56,7 +56,7 @@ void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC )
{
SCH_SCREEN* screen = aFrame->GetScreen();
if( m_Flags & IS_NEW )
if( IsNew() )
{
if( !screen->CheckIfOnDrawList( this ) ) // don't want a loop!
screen->AddToDrawList( this );
......@@ -68,14 +68,12 @@ void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC )
m_Flags = 0;
screen->SetModify();
screen->SetCurItem( NULL );
aFrame->DrawPanel->ManageCurseur = NULL;
aFrame->DrawPanel->ForceCloseManageCurseur = NULL;
aFrame->DrawPanel->SetMouseCapture( NULL, NULL );
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 );
aFrame->DrawPanel->CursorOn( aDC ); // Display schematic cursor
}
}
......
......@@ -18,15 +18,13 @@
#include "hotkeys_basic.h"
void EDA_DRAW_FRAME::RedrawScreen( bool aWarpPointer )
void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer )
{
PutOnGrid( &(GetScreen()->m_Curseur) );
AdjustScrollBars();
AdjustScrollBars( aCenterPoint );
#if !defined(__WXMAC__)
/* 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
* creates problems when moving during refresh use Refresh() and update() do not change
* problems
......@@ -41,29 +39,17 @@ void EDA_DRAW_FRAME::RedrawScreen( bool aWarpPointer )
/* Move the mouse cursor to the on grid graphic cursor position */
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
* 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
RedrawScreen( move_mouse_cursor ); // Set the best centering and refresh the screen
GetScreen()->SetZoom( BestZoom() ); // Set the best zoom and get center point.
RedrawScreen( GetScreen()->GetScrollCenterPosition(), aWarpPointer );
}
......@@ -86,8 +72,7 @@ void EDA_DRAW_FRAME::Window_Zoom( EDA_Rect& Rect )
bestscale = MAX( bestscale, scalex );
GetScreen()->SetScalingFactor( bestscale );
GetScreen()->m_Curseur = Rect.Centre();
RedrawScreen( TRUE );
RedrawScreen( Rect.Centre(), true );
}
......@@ -104,31 +89,29 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
int id = event.GetId();
bool zoom_at_cursor = false;
BASE_SCREEN* screen = GetScreen();
wxPoint center = screen->GetScrollCenterPosition();
switch( id )
{
case ID_POPUP_ZOOM_IN:
zoom_at_cursor = true;
center = screen->GetCrossHairPosition();
// fall thru
case ID_ZOOM_IN:
if( id == ID_ZOOM_IN )
screen->m_Curseur = DrawPanel->GetScreenCenterLogicalPosition();
if( screen->SetPreviousZoom() )
RedrawScreen( zoom_at_cursor );
RedrawScreen( center, zoom_at_cursor );
break;
case ID_POPUP_ZOOM_OUT:
zoom_at_cursor = true;
center = screen->GetCrossHairPosition();
// fall thru
case ID_ZOOM_OUT:
if( id == ID_ZOOM_OUT )
screen->m_Curseur = DrawPanel->GetScreenCenterLogicalPosition();
if( screen->SetNextZoom() )
RedrawScreen( zoom_at_cursor );
RedrawScreen( center, zoom_at_cursor );
break;
case ID_ZOOM_REDRAW:
......@@ -136,7 +119,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
break;
case ID_POPUP_ZOOM_CENTER:
RedrawScreen( true );
RedrawScreen( center, true );
break;
case ID_ZOOM_PAGE:
......@@ -147,7 +130,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
break;
case ID_POPUP_CANCEL:
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
break;
default:
......@@ -160,7 +143,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
return;
}
if( screen->SetZoom( screen->m_ZoomList[i] ) )
RedrawScreen( true );
RedrawScreen( center, true );
}
UpdateStatusBar();
......@@ -207,8 +190,7 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
screen->m_ZoomList[i] / screen->m_ZoomScalar );
else
msg.Printf( wxT( "%.1f" ),
(float) screen->m_ZoomList[i] /
screen->m_ZoomScalar );
(float) screen->m_ZoomList[i] / screen->m_ZoomScalar );
zoom_choice->Append( ID_POPUP_ZOOM_LEVEL_START + i, _( "Zoom: " ) + msg,
wxEmptyString, wxITEM_CHECK );
......
......@@ -351,7 +351,7 @@ void DISPLAY_FOOTPRINTS_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message( wxEmptyString );
SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
UpdateStatusBar();
break;
......@@ -399,8 +399,8 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
PutOnGrid( &pos );
oldpos = GetScreen()->m_Curseur;
GetScreen()->SetCrossHairPosition( pos );
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
switch( g_KeyPressed )
......@@ -409,14 +409,14 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
pos = GetScreen()->m_Curseur;
pos = GetScreen()->GetCrossHairPosition();
break;
case WXK_F2:
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
pos = GetScreen()->m_Curseur;
pos = GetScreen()->GetCrossHairPosition();
break;
case WXK_F3:
......@@ -429,18 +429,18 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
pos = GetScreen()->m_Curseur;
pos = GetScreen()->GetCrossHairPosition();
break;
case WXK_HOME:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
flagcurseur = 2;
pos = GetScreen()->m_Curseur;
pos = GetScreen()->GetCrossHairPosition();
break;
case ' ':
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
break;
case WXK_NUMPAD8: /* cursor moved up */
......@@ -468,7 +468,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
break;
}
GetScreen()->m_Curseur = pos;
GetScreen()->SetCrossHairPosition( pos );
if( GetScreen()->IsRefreshReq() )
{
......@@ -476,20 +476,20 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
Refresh();
}
if( oldpos != GetScreen()->m_Curseur )
if( oldpos != GetScreen()->GetCrossHairPosition() )
{
if( flagcurseur != 2 )
{
pos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = oldpos;
DrawPanel->CursorOff( aDC );
GetScreen()->m_Curseur = pos;
DrawPanel->CursorOn( aDC );
pos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos );
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 )
void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
{
CreateScreenCmp();
DrawFrame->AdjustScrollBars();
DrawFrame->RedrawScreen( FALSE );
DrawFrame->RedrawScreen( wxPoint( 0, 0 ), false );
}
......
......@@ -100,7 +100,7 @@ void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if ( Module )
Module->DisplayInfo( this );
DrawPanel->DrawCursor( DC );
DrawPanel->DrawCrossHair( DC );
}
......
This diff is collapsed.
......@@ -80,14 +80,13 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{
BlockState state = GetScreen()->m_BlockLocate.m_State;
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_Command = command;
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines;
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
GetScreen()->m_Curseur.x = GetScreen()->m_BlockLocate.GetRight();
GetScreen()->m_Curseur.y = GetScreen()->m_BlockLocate.GetBottom();
DrawPanel->MouseToCursorSchema();
DrawPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
GetScreen()->m_BlockLocate.GetBottom() ) );
DrawPanel->MoveCursorToCrossHair();
}
switch( GetScreen()->m_BlockLocate.m_Command )
......@@ -106,12 +105,14 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( ItemCount )
{
nextCmd = true;
if( DrawPanel->ManageCurseur != NULL )
if( DrawPanel->IsMouseCaptured() )
{
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( true );
}
......@@ -119,7 +120,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
nextCmd = true;
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
break;
......@@ -174,21 +175,18 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( ! nextCmd )
{
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY )
if ( m_component )
m_component->ClearSelectedItems();
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY && m_component )
m_component->ClearSelectedItems();
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL );
DrawPanel->SetMouseCapture( NULL, NULL );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
DrawPanel->Refresh( true );
}
return nextCmd;
}
......@@ -204,10 +202,10 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
bool err = false;
wxPoint pt;
if( DrawPanel->ManageCurseur == NULL )
if( !DrawPanel->IsMouseCaptured() )
{
err = true;
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) );
DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
......@@ -265,14 +263,12 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
OnModify();
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;
GetScreen()->SetCurItem( NULL );
DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->Refresh( true );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
}
......@@ -309,8 +305,7 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
}
/* Repaint new view */
PtBlock->m_MoveVector.x = screen->m_Curseur.x - PtBlock->m_BlockLastCursorPosition.x;
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
PtBlock->m_MoveVector = screen->GetCrossHairPosition() - PtBlock->m_BlockLastCursorPosition;
GRSetDrawMode( aDC, g_XorMode );
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
}
}
wxPoint endpos = aPanel->GetScreen()->m_Curseur;
wxPoint endpos = aPanel->GetScreen()->GetCrossHairPosition();
if( g_HVLines ) /* Coerce the line to vertical or horizontal one: */
ComputeBreakPoint( CurrentLine, endpos );
......@@ -90,7 +90,7 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
{
SCH_LINE* oldsegment, * newsegment, * nextsegment;
wxPoint cursorpos = GetScreen()->m_Curseur;
wxPoint cursorpos = GetScreen()->GetCrossHairPosition();
if( GetScreen()->GetCurItem() && (GetScreen()->GetCurItem()->m_Flags == 0) )
GetScreen()->SetCurItem( NULL );
......@@ -145,8 +145,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
}
GetScreen()->SetCurItem( newsegment );
DrawPanel->ManageCurseur = DrawSegment;
DrawPanel->ForceCloseManageCurseur = AbortCreateNewLine;
DrawPanel->SetMouseCapture( DrawSegment, AbortCreateNewLine );
m_itemToRepeat = NULL;
}
else // A segment is in progress: terminates the current segment and add a new segment.
......@@ -167,7 +166,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
return;
}
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
/* Creates the new segment, or terminates the command
* if the end point is on a pin, junction or an other wire or bus */
......@@ -179,9 +178,9 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
oldsegment->SetNext( GetScreen()->GetDrawItems() );
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 );
DrawPanel->CursorOn( DC ); // Display schematic cursor
DrawPanel->CrossHairOn( DC ); // Display schematic cursor
/* Create a new segment, and chain it after the current new segment */
if( nextsegment )
......@@ -203,7 +202,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
oldsegment->m_Flags = SELECTED;
newsegment->m_Flags = IS_NEW;
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.
* Create a junction if needed. Note: a junction can be needed later,
......@@ -269,8 +268,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
GetScreen()->SetDrawItems( lastsegment );
}
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->SetMouseCapture( NULL, NULL );
GetScreen()->SetCurItem( NULL );
wxPoint end_point, alt_end_point;
......@@ -320,7 +318,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
GetScreen()->TestDanglingEnds( DrawPanel, DC );
/* 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();
while( item )
......@@ -339,7 +337,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
item = item->Next();
}
DrawPanel->CursorOn( DC ); // Display schematic cursor
DrawPanel->CrossHairOn( DC ); // Display schematic cursor
SaveCopyInUndoList( s_OldWiresList, UR_WIRE_IMAGE );
s_OldWiresList = NULL;
......@@ -412,7 +410,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
SCH_POLYLINE* polyLine = (SCH_POLYLINE*) screen->GetCurItem();
wxPoint endpos;
endpos = screen->m_Curseur;
endpos = screen->GetCrossHairPosition();
int idx = polyLine->GetCornerCount() - 1;
......@@ -435,7 +433,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
}
screen->RemoveFromDrawList( screen->GetCurItem() );
DrawPanel->ManageCurseur = NULL;
DrawPanel->m_mouseCaptureCallback = NULL;
screen->SetCurItem( NULL );
}
......@@ -449,9 +447,9 @@ SCH_JUNCTION* SCH_EDIT_FRAME::AddJunction( wxDC* aDC, const wxPoint& aPosition,
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 );
DrawPanel->CursorOn( aDC ); // Display schematic cursor
DrawPanel->CrossHairOn( aDC ); // Display schematic cursor
junction->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( junction );
......@@ -471,9 +469,9 @@ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPositio
NewNoConnect = new SCH_NO_CONNECT( aPosition );
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 );
DrawPanel->CursorOn( aDC ); // Display schematic cursor
DrawPanel->CrossHairOn( aDC ); // Display schematic cursor
NewNoConnect->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( NewNoConnect );
......@@ -491,8 +489,6 @@ static void AbortCreateNewLine( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( screen->GetCurItem() )
{
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
screen->RemoveFromDrawList( (SCH_ITEM*) screen->GetCurItem() );
screen->SetCurItem( NULL );
screen->ReplaceWires( s_OldWiresList );
......@@ -501,7 +497,6 @@ static void AbortCreateNewLine( EDA_DRAW_PANEL* Panel, wxDC* DC )
else
{
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent();
parent->SetRepeatItem( NULL );
}
......@@ -529,7 +524,8 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
if( m_itemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode
{
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;
( (SCH_COMPONENT*) m_itemToRepeat )->m_TimeStamp = GetTimeStamp();
m_itemToRepeat->Move( pos );
......
......@@ -45,8 +45,6 @@ static void ExitBusEntry( EDA_DRAW_PANEL* Panel, wxDC* DC )
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent();
parent->SetRepeatItem( NULL );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
}
......@@ -65,7 +63,7 @@ static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
BusEntry->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
/* 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 );
}
......@@ -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 )
{
// 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->Place( this, DC );;
OnModify();
......@@ -96,15 +95,15 @@ void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC )
ItemInitialPosition = BusEntry->m_Pos;
DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = BusEntry->m_Pos;
DrawPanel->MouseToCursorSchema();
DrawPanel->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( BusEntry->m_Pos );
DrawPanel->MoveCursorToCrossHair();
GetScreen()->SetCurItem( BusEntry );
DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitBusEntry;
DrawPanel->m_mouseCaptureCallback = ShowWhileMoving;
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
break;
case SCH_COMPONENT_T:
Pin = GetScreen()->GetPin( GetScreen()->m_Curseur, &LibItem );
Pin = GetScreen()->GetPin( GetScreen()->GetCrossHairPosition(), &LibItem );
if( Pin )
break; // Priority is probing a pin first
......@@ -80,7 +80,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, bool aInc
break;
default:
Pin = GetScreen()->GetPin( GetScreen()->m_Curseur, &LibItem );
Pin = GetScreen()->GetPin( GetScreen()->GetCrossHairPosition(), &LibItem );
break;
case LIB_PIN_T:
......@@ -240,8 +240,8 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
int hotkey = 0;
wxPoint pos = aPosition;
PutOnGrid( &pos );
oldpos = screen->m_Curseur;
pos = screen->GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( g_KeyPressed )
......@@ -279,7 +279,7 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
}
// Update cursor position.
screen->m_Curseur = pos;
screen->SetCrossHairPosition( pos );
if( screen->IsRefreshReq() )
{
......@@ -287,17 +287,17 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
wxSafeYield();
}
if( oldpos != screen->m_Curseur )
if( oldpos != screen->GetCrossHairPosition() )
{
pos = screen->m_Curseur;
screen->m_Curseur = oldpos;
DrawPanel->CursorOff( aDC );
screen->m_Curseur = pos;
DrawPanel->CursorOn( aDC );
pos = screen->GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos );
DrawPanel->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos );
DrawPanel->CrossHairOn( aDC );
if( DrawPanel->ManageCurseur )
if( DrawPanel->IsMouseCaptured() )
{
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, TRUE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, TRUE );
}
}
......@@ -322,8 +322,8 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
int hotkey = 0;
wxPoint pos = aPosition;
PutOnGrid( &pos );
oldpos = screen->m_Curseur;
pos = screen->GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( g_KeyPressed )
......@@ -361,7 +361,7 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
}
// Update the cursor position.
screen->m_Curseur = pos;
screen->SetCrossHairPosition( pos );
if( screen->IsRefreshReq() )
{
......@@ -369,17 +369,17 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
wxSafeYield();
}
if( oldpos != screen->m_Curseur )
if( oldpos != screen->GetCrossHairPosition() )
{
pos = screen->m_Curseur;
screen->m_Curseur = oldpos;
DrawPanel->CursorOff( aDC );
screen->m_Curseur = pos;
DrawPanel->CursorOn( aDC );
pos = screen->GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos );
DrawPanel->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos );
DrawPanel->CrossHairOn( aDC );
if( DrawPanel->ManageCurseur )
if( DrawPanel->IsMouseCaptured() )
{
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, TRUE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, TRUE );
}
}
......@@ -403,8 +403,8 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
int hotkey = 0;
wxPoint pos = aPosition;
PutOnGrid( &pos );
oldpos = screen->m_Curseur;
pos = screen->GetNearestGridPosition( pos );
oldpos = screen->GetCrossHairPosition();
gridSize = screen->GetGridSize();
switch( g_KeyPressed )
......@@ -442,7 +442,7 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
}
// Update cursor position.
screen->m_Curseur = pos;
screen->SetCrossHairPosition( pos );
if( screen->IsRefreshReq() )
{
......@@ -450,17 +450,17 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
wxSafeYield();
}
if( oldpos != screen->m_Curseur )
if( oldpos != screen->GetCrossHairPosition() )
{
pos = screen->m_Curseur;
screen->m_Curseur = oldpos;
DrawPanel->CursorOff( aDC );
screen->m_Curseur = pos;
DrawPanel->CursorOn( aDC );
pos = screen->GetCrossHairPosition();
screen->SetCrossHairPosition( oldpos );
DrawPanel->CrossHairOff( aDC );
screen->SetCrossHairPosition( pos );
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
void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
{
SCH_SCREEN* screen = GetScreen();
wxPoint refpos = screen->m_Curseur;
wxPoint refpos = screen->GetCrossHairPosition();
SCH_ITEM* DelStruct;
PICKED_ITEMS_LIST pickList;
......@@ -97,7 +97,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
DelStruct = screen->GetDrawItems();
while( DelStruct
&& ( DelStruct = PickStruct( screen->m_Curseur, screen,
&& ( DelStruct = PickStruct( screen->GetCrossHairPosition(), screen,
JUNCTION_T | WIRE_T | BUS_T ) ) != NULL )
{
DelStruct->m_Flags = SELECTEDNODE | STRUCT_DELETED;
......@@ -234,7 +234,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
}
// Delete labels attached to wires
wxPoint pos = screen->m_Curseur;
wxPoint pos = screen->GetCrossHairPosition();
for( DelStruct = screen->GetDrawItems(); DelStruct != NULL;
DelStruct = DelStruct->Next() )
......@@ -245,8 +245,9 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
if( DelStruct->Type() != SCH_LABEL_T )
continue;
GetScreen()->m_Curseur = ( (SCH_TEXT*) DelStruct )->m_Pos;
EDA_ITEM* TstStruct = PickStruct( screen->m_Curseur, GetScreen(), WIRE_T | BUS_T );
GetScreen()->SetCrossHairPosition( ( (SCH_TEXT*) DelStruct )->m_Pos );
EDA_ITEM* TstStruct = PickStruct( screen->GetCrossHairPosition(), GetScreen(),
WIRE_T | BUS_T );
if( TstStruct && TstStruct->m_Flags & STRUCT_DELETED )
{
......@@ -259,7 +260,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool DeleteFullConnection )
}
}
screen->m_Curseur = pos;
screen->SetCrossHairPosition( pos );
}
screen->ClearDrawingState();
......@@ -292,23 +293,23 @@ bool LocateAndDeleteItem( SCH_EDIT_FRAME* frame, wxDC* DC )
SCH_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() );
bool item_deleted = FALSE;
DelStruct = PickStruct( screen->m_Curseur, screen, MARKER_T );
DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, MARKER_T );
if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, JUNCTION_T );
DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, JUNCTION_T );
if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, NO_CONNECT_T );
DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, NO_CONNECT_T );
if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, BUS_ENTRY_T );
DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, BUS_ENTRY_T );
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 )
DelStruct = PickStruct( screen->m_Curseur, screen, DRAW_ITEM_T );
DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, DRAW_ITEM_T );
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 )
DelStruct = PickStruct( screen->m_Curseur, screen, COMPONENT_T );
DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, COMPONENT_T );
if( DelStruct == NULL )
DelStruct = PickStruct( screen->m_Curseur, screen, SHEET_T );
DelStruct = PickStruct( screen->GetCrossHairPosition(), screen, SHEET_T );
if( DelStruct )
{
......
......@@ -65,7 +65,7 @@ void InstallCmpeditFrame( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aComponent )
// so it comes up wide enough next time.
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dialog.GetSize();
aParent->DrawPanel->MouseToCursorSchema();
aParent->DrawPanel->MoveCursorToCrossHair();
aParent->DrawPanel->m_IgnoreMouseEvents = false;
}
......
......@@ -183,7 +183,7 @@ void DialogLabelEditor::OnOkClick( wxCommandEvent& aEvent )
void DialogLabelEditor::OnCancelClick( wxCommandEvent& aEvent )
{
m_Parent->DrawPanel->MouseToCursorSchema();
m_Parent->DrawPanel->MoveCursorToCrossHair();
EndModal( wxID_CANCEL );
}
......@@ -236,6 +236,6 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
g_DefaultTextLabelSize = m_CurrentText->m_Size.x;
m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
m_Parent->DrawPanel->MouseToCursorSchema();
m_Parent->DrawPanel->MoveCursorToCrossHair();
EndModal( wxID_OK );
}
......@@ -109,7 +109,7 @@ void LIB_EDIT_FRAME::InstallFieldsEditorDialog( wxCommandEvent& event )
if( m_component == NULL )
return;
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, m_component );
......
......@@ -175,8 +175,7 @@ void DIALOG_ERC::OnLeftDClickMarkersList( wxCommandEvent& event )
m_Parent->m_CurrentSheet->UpdateAllScreenReferences();
}
sheet->LastScreen()->m_Curseur = pos;
m_Parent->RedrawScreen( true );
m_Parent->RedrawScreen( pos, true );
}
......
......@@ -52,9 +52,9 @@ void SCH_EDIT_FRAME::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )
newpos = comp->GetTransform().TransformCoordinate( newpos ) + pos;
DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = newpos;
DrawPanel->MouseToCursorSchema();
DrawPanel->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( newpos );
DrawPanel->MoveCursorToCrossHair();
m_OldPos = aField->m_Pos;
m_Multiflag = 0;
......@@ -69,11 +69,11 @@ void SCH_EDIT_FRAME::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )
}
}
DrawPanel->ForceCloseManageCurseur = AbortMoveCmpField;
DrawPanel->ManageCurseur = MoveCmpField;
DrawPanel->m_endMouseCaptureCallback = AbortMoveCmpField;
DrawPanel->m_mouseCaptureCallback = MoveCmpField;
aField->m_Flags = IS_MOVED;
DrawPanel->CursorOn( DC );
DrawPanel->CrossHairOn( DC );
}
......@@ -133,7 +133,7 @@ modified!\nYou must create a new power" ) );
newtext.Trim( true );
newtext.Trim( false );
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE;
if ( diag != wxID_OK )
return; // cancelled by user
......@@ -207,7 +207,7 @@ static void MoveCmpField( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
// But here we want the relative position of the moved field
// and we know the actual position.
// 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();
currentField->m_Pos = pos + itrsfm.TransformCoordinate( pt );
......@@ -218,9 +218,6 @@ static void MoveCmpField( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
static void AbortMoveCmpField( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
Panel->ForceCloseManageCurseur = NULL;
Panel->ManageCurseur = NULL;
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) Panel->GetParent();
SCH_FIELD* currentField = frame->GetCurrentField();
......
......@@ -62,24 +62,23 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
break;
}
DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = ItemInitialPosition;
DrawPanel->MouseToCursorSchema();
DrawPanel->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( ItemInitialPosition );
DrawPanel->MoveCursorToCrossHair();
OnModify( );
DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
DrawPanel->SetMouseCapture( ShowWhileMoving,ExitMoveTexte );
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 )
{
if( TextStruct == NULL )
TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur,
TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->GetCrossHairPosition(),
GetScreen(), TEXT_T | LABEL_T );
if( TextStruct == NULL )
return;
......@@ -89,7 +88,7 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
SaveCopyInUndoList( TextStruct, UR_CHANGED );
/* Erase old text */
DrawPanel->CursorOff( DC );
DrawPanel->CrossHairOff( DC );
TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
int orient;
......@@ -111,7 +110,7 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
OnModify( );
TextStruct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
DrawPanel->CursorOn( DC );
DrawPanel->CrossHairOn( DC );
}
......@@ -126,20 +125,20 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
switch( type )
{
case LAYER_NOTES:
NewText = new SCH_TEXT( GetScreen()->m_Curseur );
NewText = new SCH_TEXT( GetScreen()->GetCrossHairPosition() );
break;
case LAYER_LOCLABEL:
NewText = new SCH_LABEL( GetScreen()->m_Curseur );
NewText = new SCH_LABEL( GetScreen()->GetCrossHairPosition() );
break;
case LAYER_HIERLABEL:
NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur );
NewText = new SCH_HIERLABEL( GetScreen()->GetCrossHairPosition() );
NewText->m_Shape = lastGlobalLabelShape;
break;
case LAYER_GLOBLABEL:
NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur );
NewText = new SCH_GLOBALLABEL( GetScreen()->GetCrossHairPosition() );
NewText->m_Shape = lastGlobalLabelShape;
break;
......@@ -173,9 +172,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
}
NewText->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
DrawPanel->SetMouseCapture( ShowWhileMoving, ExitMoveTexte );
GetScreen()->SetCurItem( NewText );
return NewText;
......@@ -201,7 +198,7 @@ static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
case SCH_TEXT_T:
( (SCH_TEXT*) TextStruct )->m_Pos = aPanel->GetScreen()->m_Curseur;
( (SCH_TEXT*) TextStruct )->m_Pos = aPanel->GetScreen()->GetCrossHairPosition();
break;
default:
......@@ -220,8 +217,6 @@ static void ExitMoveTexte( EDA_DRAW_PANEL* Panel, wxDC* DC )
SCH_EDIT_FRAME* parent = ( SCH_EDIT_FRAME* ) Panel->GetParent();
parent->SetRepeatItem( NULL );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
if( Struct == NULL ) /* no current item */
{
......@@ -323,12 +318,12 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
}
/* now delete the old text
* 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( 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
......@@ -346,7 +341,7 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
delete g_ItemToUndoCopy;
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"
* In this case, the old text is already in undo list as a deleted item.
......@@ -371,5 +366,5 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype )
}
newtext->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
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 )
GetScreen()->ClrRefreshReq();
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
if( DrawPanel->IsMouseCaptured() )
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
if( GetScreen()->GetFileName() == m_DefaultSchematicFileName )
......
......@@ -65,9 +65,9 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
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 units = GetAbbreviatedUnitsLabel();
......@@ -195,8 +195,8 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
delta = Component->GetTransform().TransformCoordinate( pos );
pos = delta + Component->m_Pos;
wxPoint old_cursor_position = sheet->LastScreen()->m_Curseur;
sheet->LastScreen()->m_Curseur = pos;
wxPoint old_cursor_position = sheet->LastScreen()->GetCrossHairPosition();
sheet->LastScreen()->SetCrossHairPosition( pos );
curpos = GetScreen()->GetCrossHairScreenPosition();
......@@ -216,20 +216,20 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
#undef MARGIN
if( DoCenterAndRedraw )
RedrawScreen( mouseWarp );
RedrawScreen( curpos, mouseWarp );
else
{
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
DrawPanel->CursorOff( &dc );
EXCHG( old_cursor_position, sheet->LastScreen()->GetCrossHairPosition() );
DrawPanel->CrossHairOff( &dc );
if( mouseWarp )
DrawPanel->MoveCursor( curpos );
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
EXCHG( old_cursor_position, sheet->LastScreen()->GetCrossHairPosition() );
DrawPanel->CursorOn( &dc );
DrawPanel->CrossHairOn( &dc );
}
}
......@@ -339,9 +339,9 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& event )
m_CurrentSheet->UpdateAllScreenReferences();
}
sheetFoundIn->LastScreen()->m_Curseur = lastItemPosition;
sheetFoundIn->LastScreen()->SetCrossHairPosition( lastItemPosition );
RedrawScreen( warpCursor );
RedrawScreen( lastItemPosition, warpCursor );
msg = event.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable();
SetStatusText( msg );
......
......@@ -34,8 +34,7 @@ wxString SCH_EDIT_FRAME::SelectFromLibBrowser( void )
{
wxSemaphore semaphore( 0, 1 );
/* Close the current Lib browser, if open, and open a new one, in
* "modal" mode */
/* Close the current Lib browser, if open, and open a new one, in "modal" mode */
if( m_ViewlibFrame )
{
m_ViewlibFrame->Destroy();
......@@ -43,7 +42,7 @@ wxString SCH_EDIT_FRAME::SelectFromLibBrowser( void )
}
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
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
......@@ -105,7 +104,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if ( dlg.ShowModal() == wxID_CANCEL )
{
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
return NULL;
}
......@@ -123,7 +122,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Name.IsEmpty() )
{
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
return NULL;
}
......@@ -140,7 +139,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Name.IsEmpty() )
{
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
return NULL;
}
}
......@@ -151,7 +150,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( GetNameOfPartToLoad( this, Library, Name ) == 0 )
{
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
return NULL;
}
}
......@@ -162,7 +161,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Name.IsEmpty() )
{
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
return NULL;
}
}
......@@ -182,13 +181,13 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
if( Entry == NULL )
{
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
return NULL;
}
}
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
if( Entry == NULL )
{
......@@ -199,12 +198,10 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
lastCommponentName = Name;
AddHistoryComponentName( HistoryList, Name );
DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
DrawPanel->SetMouseCapture( ShowWhileMoving, ExitPlaceCmp );
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
// Note if Entry is found, and if Name is an alias of a component,
// alias exists because its root component was found
......@@ -234,7 +231,7 @@ static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
Component->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
}
move_vector = screen->m_Curseur - Component->m_Pos;
move_vector = screen->GetCrossHairPosition() - Component->m_Pos;
Component->Move( move_vector );
Component->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
}
......@@ -253,7 +250,7 @@ void SCH_EDIT_FRAME::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, wxDC* DC,
/* Deletes the previous component. */
if( DC )
{
DrawPanel->CursorOff( DC );
DrawPanel->CrossHairOff( DC );
if( DrawComponent->m_Flags )
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
......@@ -272,7 +269,7 @@ void SCH_EDIT_FRAME::CmpRotationMiroir( SCH_COMPONENT* DrawComponent, wxDC* DC,
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC );
DrawPanel->CrossHairOn( DC );
}
GetScreen()->TestDanglingEnds( DrawPanel, DC );
......@@ -302,9 +299,7 @@ static void ExitPlaceCmp( EDA_DRAW_PANEL* Panel, wxDC* DC )
Component->m_Flags = 0;
}
Panel->Refresh( TRUE );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
Panel->Refresh( true );
screen->SetCurItem( NULL );
}
......@@ -427,12 +422,11 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
g_ItemToUndoCopy = Component->Clone();
}
DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = Component->m_Pos;
DrawPanel->MouseToCursorSchema();
DrawPanel->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( Component->m_Pos );
DrawPanel->MoveCursorToCrossHair();
DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
DrawPanel->SetMouseCapture( ShowWhileMoving, ExitPlaceCmp );
GetScreen()->SetCurItem( Component );
OldPos = Component->m_Pos;
OldTransform = Component->GetTransform();
......@@ -455,10 +449,10 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
Component->m_Flags |= IS_MOVED;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, FALSE );
#endif
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->CursorOn( DC );
DrawPanel->CrossHairOn( DC );
}
......@@ -270,7 +270,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
}
else
{
DrawPanel->MouseToCursorSchema();
RedrawScreen( true );
DrawPanel->MoveCursorToCrossHair();
RedrawScreen( screen->GetScrollCenterPosition(), true );
}
}
......@@ -299,7 +299,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
break;
case HK_ZOOM_IN:
......@@ -724,7 +724,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
{
SCH_SHEET* sheet = (SCH_SHEET*) aItem;
// 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 )
aItem = slabel;
......@@ -733,7 +733,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem->Type() == SCH_JUNCTION_T )
{
// If 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 )
......@@ -813,7 +813,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aItem == NULL )
{
aItem = PickStruct( GetScreen()->m_Curseur, GetScreen(),
aItem = PickStruct( GetScreen()->GetCrossHairPosition(), GetScreen(),
COMPONENT_T | TEXT_T | LABEL_T | SHEET_T );
if( aItem == NULL )
break;
......@@ -928,7 +928,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
break;
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
break;
case HK_ZOOM_IN:
......
......@@ -66,7 +66,7 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event )
wxString CmpName;
LIB_ALIAS* LibEntry = NULL;
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
if( GetScreen()->IsModify()
&& !IsOK( this, _( "Current part not saved.\n\nDiscard current changes?" ) ) )
......@@ -216,10 +216,10 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->ClrRefreshReq();
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->DrawCursor( DC );
DrawPanel->DrawCrossHair( DC );
DisplayLibInfos();
UpdateStatusBar();
......@@ -235,7 +235,7 @@ void LIB_EDIT_FRAME::SaveActiveLibrary( wxCommandEvent& event )
wxFileName fn;
wxString msg;
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
if( GetScreen()->IsModify() )
{
......@@ -373,7 +373,7 @@ void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event )
wxArrayString ListNames;
wxString msg;
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
m_lastDrawItem = NULL;
m_drawItem = NULL;
......@@ -472,7 +472,7 @@ void LIB_EDIT_FRAME::CreateNewLibraryPart( wxCommandEvent& event )
lost!\n\nClear the current component from the screen?" ) ) )
return;
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
m_drawItem = NULL;
......
......@@ -49,7 +49,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawEntry == NULL )
{
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_Curseur );
GetScreen()->GetCrossHairPosition() );
}
if( DrawEntry )
......@@ -103,7 +103,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawEntry == NULL )
{
DrawEntry = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_Curseur );
GetScreen()->GetCrossHairPosition() );
}
if( DrawEntry == NULL )
{
......@@ -156,7 +156,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
if( m_drawItem == NULL )
{
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_Curseur );
GetScreen()->GetCrossHairPosition() );
}
if( m_drawItem == NULL )
{
......@@ -227,6 +227,6 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break;
}
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE;
}
......@@ -347,13 +347,13 @@ int LIB_EDIT_FRAME::BestZoom()
BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert );
dx = BoundaryBox.GetWidth();
dy = BoundaryBox.GetHeight();
GetScreen()->m_Curseur = BoundaryBox.Centre();
GetScreen()->SetScrollCenterPosition( BoundaryBox.Centre() );
}
else
{
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
GetScreen()->m_Curseur = wxPoint( 0, 0 );
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
}
/*
......@@ -375,6 +375,7 @@ int LIB_EDIT_FRAME::BestZoom()
{
if( m_clientSize == wxSize( -1, -1 ) )
m_clientSize = DrawPanel->GetClientSize();
size = m_clientSize;
}
......@@ -582,7 +583,7 @@ void LIB_EDIT_FRAME::OnViewEntryDoc( 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 )
m_convert = 1;
......@@ -625,18 +626,18 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_LIBEDIT_CANCEL_EDITING:
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
DrawPanel->UnManageCursor();
if( DrawPanel->IsMouseCaptured() )
DrawPanel->EndMouseCapture();
else
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
break;
case ID_POPUP_LIBEDIT_DELETE_ITEM:
DrawPanel->UnManageCursor();
DrawPanel->EndMouseCapture();
break;
default:
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW, wxEmptyString );
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor(), wxEmptyString );
break;
}
......@@ -715,7 +716,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
if( m_drawItem )
{
EndDrawGraphicItem( &dc );
......@@ -725,7 +726,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_BODY_EDIT_ITEM:
if( m_drawItem )
{
DrawPanel->CursorOff( &dc );
DrawPanel->CrossHairOff( &dc );
switch( m_drawItem->Type() )
{
......@@ -744,7 +745,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
;
}
DrawPanel->CursorOn( &dc );
DrawPanel->CrossHairOn( &dc );
}
break;
......@@ -765,11 +766,11 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_drawItem == NULL )
break;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
int oldFlags = m_drawItem->GetFlags();
m_drawItem->SetFlags( 0 );
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->SetFlags( oldFlags );
break;
......@@ -778,30 +779,31 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_DELETE_ITEM:
if( m_drawItem == NULL )
break;
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOff( &dc );
DrawPanel->MoveCursorToCrossHair();
DrawPanel->CrossHairOff( &dc );
SaveCopyInUndoList( m_component );
if( m_drawItem->Type() == LIB_PIN_T )
{
DeletePin( &dc, m_component, (LIB_PIN*) m_drawItem );
}
else
{
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
else
m_component->RemoveDrawItem( m_drawItem, DrawPanel, &dc );
}
m_drawItem = NULL;
OnModify( );
DrawPanel->CursorOn( &dc );
DrawPanel->CrossHairOn( &dc );
break;
case ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST:
if( m_drawItem == NULL )
break;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
if( m_drawItem->Type() == LIB_PIN_T )
StartMovePin( &dc );
else
......@@ -813,7 +815,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_drawItem == NULL )
break;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
if( m_drawItem->Type() == LIB_RECTANGLE_T
|| m_drawItem->Type() == LIB_CIRCLE_T
|| m_drawItem->Type() == LIB_POLYLINE_T
......@@ -828,7 +830,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT:
if( m_drawItem == NULL && m_drawItem->Type() != LIB_TEXT_T )
break;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
if( !m_drawItem->InEditMode() )
{
SaveCopyInUndoList( m_component );
......@@ -843,7 +845,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
if( m_drawItem == NULL || ( m_drawItem->Type() != LIB_FIELD_T ) )
break;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
if( !m_drawItem->InEditMode() )
{
......@@ -859,13 +861,13 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM:
if( m_drawItem == NULL )
break;
DrawPanel->CursorOff( &dc );
DrawPanel->CrossHairOff( &dc );
if( m_drawItem->Type() == LIB_FIELD_T )
{
EditField( &dc, (LIB_FIELD*) m_drawItem );
}
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc );
DrawPanel->MoveCursorToCrossHair();
DrawPanel->CrossHairOn( &dc );
break;
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM:
......@@ -876,7 +878,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
SaveCopyInUndoList( m_component );
GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id );
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
break;
case ID_POPUP_ZOOM_BLOCK:
......@@ -888,34 +890,34 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_DELETE_BLOCK:
DrawPanel->m_AutoPAN_Request = false;
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
HandleBlockEnd( &dc );
break;
case ID_POPUP_COPY_BLOCK:
DrawPanel->m_AutoPAN_Request = false;
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
HandleBlockPlace( &dc );
break;
case ID_POPUP_SELECT_ITEMS_BLOCK:
DrawPanel->m_AutoPAN_Request = false;
GetScreen()->m_BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
HandleBlockEnd( &dc );
break;
case ID_POPUP_MIRROR_Y_BLOCK:
DrawPanel->m_AutoPAN_Request = false;
GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_Y;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
HandleBlockPlace( &dc );
break;
case ID_POPUP_PLACE_BLOCK:
DrawPanel->m_AutoPAN_Request = false;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
HandleBlockPlace( &dc );
break;
......@@ -1074,8 +1076,8 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
wxT( "Cannot create new part from non-existant current part." ) );
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
DrawPanel->CursorOff( &dc );
DrawPanel->CrossHairOff( &dc );
EditField( &dc, &m_component->GetValueField() );
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc );
DrawPanel->MoveCursorToCrossHair();
DrawPanel->CrossHairOn( &dc );
}
......@@ -166,7 +166,7 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor()
if( m_drawItem == NULL )
m_drawItem = m_component->LocateDrawItem( m_unit, m_convert, TYPE_NOT_INIT,
GetScreen()->m_Curseur );
GetScreen()->GetCrossHairPosition() );
}
return m_drawItem;
......
......@@ -47,7 +47,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
{
if( !SnapPoint2( Screen->m_MousePosition, COMPONENT_T, DrawList ) )
{
if( !SnapPoint2( Screen->m_Curseur, COMPONENT_T, DrawList ) )
if( !SnapPoint2( Screen->GetCrossHairPosition(), COMPONENT_T, DrawList ) )
break;
}
......
......@@ -352,7 +352,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case SCH_COMPONENT_T:
InstallCmpeditFrame( this, (SCH_COMPONENT*) item );
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
break;
case SCH_TEXT_T:
......@@ -364,7 +364,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case SCH_FIELD_T:
EditCmpFieldText( (SCH_FIELD*) item, aDC );
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
break;
case SCH_MARKER_T:
......
......@@ -71,7 +71,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
if( DrawStruct && (DrawStruct->Type() == SCH_SHEET_T) )
{
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 )
DrawStruct = slabel;
......@@ -494,7 +494,7 @@ void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAM
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 ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm );
}
......@@ -502,7 +502,7 @@ void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAM
msg = AddHotkeyName( _( "Delete Junction" ), s_Schematic_Hokeys_Descr, HK_DELETE );
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_CONNECTION, _( "Delete Connection" ),
......@@ -514,7 +514,7 @@ void AddMenusForJunction( wxMenu* PopMenu, SCH_JUNCTION* Junction, SCH_EDIT_FRAM
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
{
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
wxPoint pos = frame->GetScreen()->m_Curseur;
wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg;
if( is_new )
......@@ -532,7 +532,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
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 ) )
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ), break_line_xpm );
......@@ -552,7 +552,7 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
{
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
wxPoint pos = frame->GetScreen()->m_Curseur;
wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
wxString msg;
if( is_new )
{
......
......@@ -123,7 +123,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
if( pin->IsNew() )
{
pin->m_Flags |= IS_CANCELLED;
DrawPanel->UnManageCursor();
DrawPanel->EndMouseCapture();
}
return;
}
......@@ -194,8 +194,6 @@ static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC )
parent->RestoreComponent();
/* clear edit flags */
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
parent->SetDrawItem( NULL );
parent->SetLastDrawItem( NULL );
Panel->Refresh( true );
......@@ -216,12 +214,11 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC )
// Some tests
if( (CurrentPin == NULL) || (CurrentPin->Type() != LIB_PIN_T) )
{
wxMessageBox( wxT("LIB_EDIT_FRAME::PlacePin() error") );
wxMessageBox( wxT( "LIB_EDIT_FRAME::PlacePin() error" ) );
return;
}
newpos.x = GetScreen()->m_Curseur.x;
newpos.y = -GetScreen()->m_Curseur.y;
newpos = GetScreen()->GetCrossHairPosition( true );
// Tst for an other pin in same new position:
for( Pin = m_component->GetNextPin(); Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
......@@ -235,7 +232,7 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC )
status =
IsOK( this, _( "This position is already occupied by \
another pin. Continue?" ) );
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = false;
if( !status )
......@@ -252,8 +249,7 @@ another pin. Continue?" ) );
else
SaveCopyInUndoList( m_component );
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->EndMouseCapture();
OnModify();
CurrentPin->SetPosition( newpos );
......@@ -280,11 +276,11 @@ another pin. Continue?" ) );
Pin->m_Flags = 0;
}
DrawPanel->CursorOff( DC );
DrawPanel->CrossHairOff( DC );
bool showPinText = true;
CurrentPin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE,
&showPinText, DefaultTransform );
DrawPanel->CursorOn( DC );
DrawPanel->CrossHairOn( DC );
m_drawItem = NULL;
}
......@@ -322,15 +318,13 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
startPos.x = OldPos.x;
startPos.y = -OldPos.y;
DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur = startPos;
DrawPanel->MouseToCursorSchema();
DrawPanel->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( startPos );
DrawPanel->MoveCursorToCrossHair();
CurrentPin->DisplayInfo( this );
DrawPanel->ManageCurseur = DrawMovePin;
DrawPanel->ForceCloseManageCurseur = AbortPinMove;
DrawPanel->CursorOn( DC );
DrawPanel->SetMouseCapture( DrawMovePin, AbortPinMove );
DrawPanel->CrossHairOn( DC );
}
......@@ -361,7 +355,7 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
}
/* 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 );
PinPreviousPos = CurrentPin->GetPosition();
......@@ -435,7 +429,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
if( g_EditPinByPinIsOn == false )
pin->m_Flags |= IS_LINKED;
pin->SetPosition( GetScreen()->GetCursorDrawPosition() );
pin->SetPosition( GetScreen()->GetCrossHairPosition( true ) );
pin->SetLength( LastPinLength );
pin->SetOrientation( LastPinOrient );
pin->SetType( LastPinType );
......@@ -451,7 +445,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
GetEventHandler()->ProcessEvent( cmd );
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = false;
if( pin->m_Flags & IS_CANCELLED )
......@@ -462,8 +456,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
else
{
ClearTempCopyComponent();
DrawPanel->ManageCurseur = DrawMovePin;
DrawPanel->ForceCloseManageCurseur = AbortPinMove;
DrawPanel->SetMouseCapture( DrawMovePin, AbortPinMove );
if( DC )
pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, wxCOPY, &showPinText,
......@@ -607,10 +600,9 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
if( g_EditPinByPinIsOn == false )
Pin->m_Flags |= IS_LINKED;
wxPoint savepos = GetScreen()->m_Curseur;
DrawPanel->CursorOff( DC );
GetScreen()->m_Curseur.x = Pin->GetPosition().x;
GetScreen()->m_Curseur.y = -Pin->GetPosition().y;
wxPoint savepos = GetScreen()->GetCrossHairPosition();
DrawPanel->CrossHairOff( DC );
GetScreen()->SetCrossHairPosition( wxPoint( Pin->GetPosition().x, -Pin->GetPosition().y ) );
// Add this new pin in list, and creates pins for others parts if needed
m_drawItem = Pin;
......@@ -618,8 +610,8 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
PlacePin( DC );
m_lastDrawItem = Pin;
GetScreen()->m_Curseur = savepos;
DrawPanel->CursorOn( DC );
GetScreen()->SetCrossHairPosition( savepos );
DrawPanel->CrossHairOn( DC );
Pin->DisplayInfo( this );
OnModify( );
......
......@@ -366,8 +366,7 @@ void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
int fieldNdx;
LIB_COMPONENT* Entry;
frame->DrawPanel->ManageCurseur = NULL;
frame->DrawPanel->ForceCloseManageCurseur = NULL;
frame->DrawPanel->SetMouseCapture( NULL, NULL );
SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();
......
......@@ -417,9 +417,9 @@ void SCH_SHEET::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
if( IsNew() )
{
// fix size and position of the new sheet
// using the last values set by the ManageCurseur function
frame->DrawPanel->ManageCurseur = NULL;
frame->DrawPanel->ForceCloseManageCurseur = NULL;
// using the last values set by the m_mouseCaptureCallback function
frame->DrawPanel->SetMouseCapture( NULL, NULL );
if( !frame->EditSheet( this, DC ) )
{
frame->GetScreen()->SetCurItem( NULL );
......
This diff is collapsed.
......@@ -398,8 +398,7 @@ int SCH_EDIT_FRAME::BestZoom()
size = DrawPanel->GetClientSize();
zoom = MAX( (double) dx / (double) size.x, (double) dy / (double) size.y );
GetScreen()->m_Curseur.x = dx / 2;
GetScreen()->m_Curseur.y = dy / 2;
GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
return wxRound( zoom * (double) GetScreen()->m_ZoomScalar );
}
......@@ -693,12 +692,12 @@ void SCH_EDIT_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
{
if( m_ViewlibFrame )
{
m_ViewlibFrame->Show( TRUE );
m_ViewlibFrame->Show( true );
}
else
{
m_ViewlibFrame = new LIB_VIEW_FRAME( this );
m_ViewlibFrame->AdjustScrollBars();
m_ViewlibFrame->AdjustScrollBars( wxPoint( 0 , 0 ) );
}
}
......@@ -707,7 +706,7 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
{
if( m_LibeditFrame )
{
m_LibeditFrame->Show( TRUE );
m_LibeditFrame->Show( true );
}
else
{
......@@ -715,7 +714,7 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
wxT( "Library Editor" ),
wxPoint( -1, -1 ),
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 )
if( aSheet->m_SheetName.IsEmpty() )
aSheet->m_SheetName.Printf( wxT( "Sheet%8.8lX" ), GetTimeStamp() );
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = false;
aSheet->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
......@@ -219,7 +219,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
/* Move selected sheet with the cursor.
* Callback function use by ManageCurseur.
* Callback function use by m_mouseCaptureCallback.
*/
static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
......@@ -233,13 +233,13 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( sheet->m_Flags & IS_RESIZED )
{
wxSize newSize( MAX( s_PreviousSheetWidth, screen->m_Curseur.x - sheet->m_Pos.x ),
MAX( s_PreviousSheetHeight, screen->m_Curseur.y - sheet->m_Pos.y ) );
wxSize newSize( MAX( s_PreviousSheetWidth, screen->GetCrossHairPosition().x - sheet->m_Pos.x ),
MAX( s_PreviousSheetHeight, screen->GetCrossHairPosition().y - sheet->m_Pos.y ) );
sheet->Resize( newSize );
}
else /* Move Sheet */
{
moveVector = screen->m_Curseur - sheet->m_Pos;
moveVector = screen->GetCrossHairPosition() - sheet->m_Pos;
sheet->Move( moveVector );
}
......@@ -263,12 +263,12 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
}
else if( (sheet->m_Flags & (IS_RESIZED|IS_MOVED)) )
{
wxPoint curspos = screen->m_Curseur;
aPanel->GetScreen()->m_Curseur = s_OldPos;
wxPoint curspos = screen->GetCrossHairPosition();
aPanel->GetScreen()->SetCrossHairPosition( s_OldPos );
MoveOrResizeSheet( aPanel, aDC, wxDefaultPosition, true );
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
sheet->m_Flags = 0;
screen->m_Curseur = curspos;
screen->SetCrossHairPosition( curspos );
}
else
{
......@@ -276,8 +276,6 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
}
screen->SetCurItem( NULL );
aPanel->ManageCurseur = NULL;
aPanel->ForceCloseManageCurseur = NULL;
SAFE_DELETE( g_ItemToUndoCopy );
}
......@@ -292,7 +290,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
m_itemToRepeat = NULL;
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_TimeStamp = GetTimeStamp();
......@@ -305,10 +303,8 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
// also need to update the hierarchy, if we are adding
// a sheet to a screen that already has multiple instances (!)
GetScreen()->SetCurItem( sheet );
DrawPanel->ManageCurseur = MoveOrResizeSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, aDC, wxDefaultPosition, false );
DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, false );
return sheet;
}
......@@ -341,9 +337,8 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
sheetLabel.m_Pos.y - aSheet->m_Pos.y );
}
DrawPanel->ManageCurseur = MoveOrResizeSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo
{
......@@ -358,16 +353,15 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( ( aSheet == NULL ) || ( aSheet->Type() != SCH_SHEET_T ) )
return;
DrawPanel->CursorOff( aDC );
GetScreen()->m_Curseur = aSheet->m_Pos;
DrawPanel->MouseToCursorSchema();
DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( aSheet->m_Pos );
DrawPanel->MoveCursorToCrossHair();
s_OldPos = aSheet->m_Pos;
aSheet->m_Flags |= IS_MOVED;
DrawPanel->ManageCurseur = MoveOrResizeSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->CursorOn( aDC );
DrawPanel->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->CrossHairOn( aDC );
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 )
}
Panel->GetScreen()->SetCurItem( NULL );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
}
......@@ -86,11 +84,10 @@ void SCH_SHEET_PIN::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
m_Pos = tmp;
}
ConstraintOnEdge( frame->GetScreen()->m_Curseur );
ConstraintOnEdge( frame->GetScreen()->GetCrossHairPosition() );
Sheet->Draw( frame->DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
frame->DrawPanel->ManageCurseur = NULL;
frame->DrawPanel->ForceCloseManageCurseur = NULL;
frame->DrawPanel->EndMouseCapture();
}
......@@ -102,9 +99,8 @@ void SCH_EDIT_FRAME::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC )
s_InitialPosition = SheetLabel->m_Pos;
s_InitialEdge = SheetLabel->GetEdge();
DrawPanel->ManageCurseur = Move_PinSheet;
DrawPanel->ForceCloseManageCurseur = ExitPinSheet;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
DrawPanel->SetMouseCapture( Move_PinSheet, ExitPinSheet );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
}
......@@ -119,7 +115,7 @@ static void Move_PinSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
if( aErase )
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 );
}
......@@ -189,9 +185,8 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::Create_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
GetScreen()->SetCurItem( NewSheetLabel );
s_CurrentTypeLabel = NewSheetLabel->m_Shape;
DrawPanel->ManageCurseur = Move_PinSheet;
DrawPanel->ForceCloseManageCurseur = ExitPinSheet;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
DrawPanel->SetMouseCapture( Move_PinSheet, ExitPinSheet );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
OnModify();
return NewSheetLabel;
......@@ -243,8 +238,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
s_CurrentTypeLabel = NewSheetLabel->m_Shape = HLabel->m_Shape;
GetScreen()->SetCurItem( NewSheetLabel );
DrawPanel->ManageCurseur = Move_PinSheet;
DrawPanel->ForceCloseManageCurseur = ExitPinSheet;
DrawPanel->SetMouseCapture( Move_PinSheet, ExitPinSheet );
Move_PinSheet( DrawPanel, DC, wxDefaultPosition, false );
return NewSheetLabel;
......
......@@ -107,11 +107,8 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( item == NULL )
return;
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
bool newItem = item->IsNew();
item->EndEdit( parent->GetScreen()->GetCursorDrawPosition(), true );
item->EndEdit( parent->GetScreen()->GetCrossHairPosition( true ), true );
if( newItem )
{
......@@ -127,9 +124,8 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC )
LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC )
{
DrawPanel->ManageCurseur = SymbolDisplayDraw;
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn;
wxPoint drawPos = GetScreen()->GetCursorDrawPosition();
DrawPanel->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
wxPoint drawPos = GetScreen()->GetCrossHairPosition( true );
// no temp copy -> the current version of component will be used for Undo
// This is normal when adding new items to the current component
......@@ -164,7 +160,7 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC*
DrawPanel->m_IgnoreMouseEvents = true;
EditSymbolText( NULL, Text );
DrawPanel->m_IgnoreMouseEvents = false;
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
if( Text->m_Text.IsEmpty() )
{
......@@ -194,16 +190,15 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC*
m_drawItem->SetConvert( m_convert );
// Draw initial symbol:
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
}
else
{
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->EndMouseCapture();
return NULL;
}
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE;
return m_drawItem;
......@@ -217,7 +212,7 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC )
if( m_drawItem == NULL )
return;
wxPoint pos = GetScreen()->GetCursorDrawPosition();
wxPoint pos = GetScreen()->GetCrossHairPosition( true );
if( m_drawItem->ContinueEdit( pos ) )
{
......@@ -251,11 +246,11 @@ static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
{
int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit();
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 );
}
else
item->Draw( aPanel, aDC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL,
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), -1, g_XorMode, NULL,
DefaultTransform );
}
......@@ -268,10 +263,9 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC )
SetCursor( wxCURSOR_HAND );
TempCopyComponent();
m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCursorDrawPosition() );
DrawPanel->ManageCurseur = RedrawWhileMovingCursor;
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCrossHairPosition( true ) );
DrawPanel->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
}
......@@ -282,10 +276,9 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC )
return;
TempCopyComponent();
m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCursorDrawPosition() );
DrawPanel->ManageCurseur = SymbolDisplayDraw;
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCrossHairPosition( true ) );
DrawPanel->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
}
......@@ -300,7 +293,7 @@ static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
return;
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 );
}
......@@ -328,13 +321,12 @@ void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC )
if( m_drawItem->IsNew() )
m_component->AddDrawItem( m_drawItem );
m_drawItem->EndEdit( GetScreen()->GetCursorDrawPosition() );
m_drawItem->EndEdit( GetScreen()->GetCrossHairPosition( true ) );
m_drawItem = NULL;
OnModify();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->Refresh();
}
......@@ -52,8 +52,8 @@ void LIB_EDIT_FRAME::LoadOneSymbol( void )
if( dlg.ShowModal() == wxID_CANCEL )
return;
GetScreen()->m_Curseur = wxPoint( 0, 0 );
DrawPanel->MouseToCursorSchema();
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE;
wxFileName fn = dlg.GetPath();
......@@ -229,14 +229,13 @@ void LIB_EDIT_FRAME::PlaceAncre()
if( m_component == NULL )
return;
wxPoint offset( -GetScreen()->m_Curseur.x, GetScreen()->m_Curseur.y );
wxPoint offset( -GetScreen()->GetCrossHairPosition().x, GetScreen()->GetCrossHairPosition().y );
OnModify( );
m_component->SetOffset( offset );
/* Redraw the symbol */
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
RedrawScreen( TRUE );
RedrawScreen( wxPoint( 0 , 0 ), true );
DrawPanel->Refresh();
}
......@@ -301,7 +301,7 @@ void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv )
void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
{
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
UpdateStatusBar();
}
......@@ -313,8 +313,7 @@ int LIB_VIEW_FRAME::BestZoom()
LIB_COMPONENT* component;
CMP_LIBRARY* lib;
GetScreen()->m_Curseur.x = 0;
GetScreen()->m_Curseur.y = 0;
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
bestzoom = 16;
lib = CMP_LIBRARY::FindLibrary( m_libraryName );
......@@ -360,7 +359,7 @@ int LIB_VIEW_FRAME::BestZoom()
(double) GetScreen()->m_ZoomScalar );
bestzoom = MAX( ii, jj ) + 1;
GetScreen()->m_Curseur = BoundaryBox.Centre();
GetScreen()->SetScrollCenterPosition( BoundaryBox.Centre() );
return bestzoom;
}
......
......@@ -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 );
/* Redraw the cursor */
DrawPanel->DrawCursor( DC );
DrawPanel->DrawCrossHair( DC );
if( !tmp.IsEmpty() )
component->SetName( tmp );
......
......@@ -89,11 +89,11 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
{
bool err = false;
if( DrawPanel->ManageCurseur == NULL )
if( !DrawPanel->IsMouseCaptured() )
{
err = true;
DisplayError( this,
wxT( "Error in HandleBlockPLace : ManageCurseur = NULL" ) );
wxT( "Error in HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
......@@ -106,15 +106,17 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
Block_Move( DC );
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_COPY: /* Copy */
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
Block_Duplicate( DC );
GetScreen()->m_BlockLocate.ClearItemsList();
break;
......@@ -134,13 +136,10 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
break;
}
DrawPanel->SetMouseCapture( NULL, NULL );
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() )
{
DisplayError( this, wxT( "HandleBlockPLace error: some items left" ) );
......@@ -166,7 +165,7 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
bool nextcmd = false;
bool zoom_command = false;
if( DrawPanel->ManageCurseur )
if( DrawPanel->IsMouseCaptured() )
switch( GetScreen()->m_BlockLocate.m_Command )
{
......@@ -181,14 +180,14 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list */
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
nextcmd = true;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
break;
case BLOCK_DELETE: /* Delete */
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
Block_Delete( DC );
break;
......@@ -211,12 +210,8 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
if( ! nextcmd )
{
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->m_BlockLocate.ClearItemsList();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->ClearBlockCommand();
DrawPanel->SetMouseCapture( NULL, NULL );
DisplayToolMsg( wxEmptyString );
}
......@@ -253,9 +248,9 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP )
{
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.m_MoveVector.y = screen->m_Curseur.y -
screen->m_BlockLocate.m_MoveVector.y = screen->GetCrossHairPosition().y -
screen->m_BlockLocate.GetBottom();
}
......@@ -306,11 +301,11 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC )
wxPoint delta;
wxPoint oldpos;
oldpos = GetScreen()->m_Curseur;
DrawPanel->ManageCurseur = NULL;
oldpos = GetScreen()->GetCrossHairPosition();
DrawPanel->m_mouseCaptureCallback = NULL;
GetScreen()->m_Curseur = oldpos;
DrawPanel->MouseToCursorSchema();
GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->MoveCursorToCrossHair();
GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize();
......@@ -338,11 +333,11 @@ void WinEDA_GerberFrame::Block_Duplicate( wxDC* DC )
wxPoint delta;
wxPoint oldpos;
oldpos = GetScreen()->m_Curseur;
DrawPanel->ManageCurseur = NULL;
oldpos = GetScreen()->GetCrossHairPosition();
DrawPanel->m_mouseCaptureCallback = NULL;
GetScreen()->m_Curseur = oldpos;
DrawPanel->MouseToCursorSchema();
GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->MoveCursorToCrossHair();
GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize();
......
......@@ -20,7 +20,7 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
int hotkey = 0;
wxPoint pos = aPosition;
PutOnGrid( &pos );
pos = GetScreen()->GetNearestGridPosition( pos );
if( GetScreen()->IsRefreshReq() )
{
......@@ -37,7 +37,7 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
return;
}
oldpos = GetScreen()->m_Curseur;
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
switch( g_KeyPressed )
......@@ -71,19 +71,19 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
break;
}
GetScreen()->m_Curseur = pos;
GetScreen()->SetCrossHairPosition( pos );
if( oldpos != GetScreen()->m_Curseur )
if( oldpos != GetScreen()->GetCrossHairPosition() )
{
pos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = oldpos;
DrawPanel->CursorOff( aDC );
GetScreen()->m_Curseur = pos;
DrawPanel->CursorOn( aDC );
pos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos );
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 )
TraceWorkSheet( DC, screen, 0 );
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( DrawPanel->IsMouseCaptured() )
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)
// relative to the active layer
......
......@@ -97,7 +97,8 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_CANCEL_CURRENT_COMMAND:
DrawPanel->UnManageCursor( );
DrawPanel->EndMouseCapture( );
/* Should not be executed, except bug */
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE )
{
......@@ -105,14 +106,16 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.ClearItemsList();
}
if( m_ID_current_state == 0 )
SetToolID( 0, 0, wxEmptyString );
else
DrawPanel->SetCursor( DrawPanel->GetDefaultCursor() );
break;
default:
DrawPanel->UnManageCursor( );
DrawPanel->EndMouseCapture( );
break;
}
......
......@@ -247,7 +247,7 @@ int WinEDA_GerberFrame::BestZoom()
x = (double) bbox.GetWidth() / (double) size.x;
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 );
return best_zoom;
......
......@@ -126,7 +126,7 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
break;
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
break;
case HK_SWITCH_UNITS:
......
......@@ -15,12 +15,13 @@ GERBER_DRAW_ITEM* WinEDA_GerberFrame::Locate( int aTypeloc )
MsgPanel->EraseMsgBox();
wxPoint ref;
bool found = false;
if( aTypeloc == CURSEUR_ON_GRILLE )
ref = GetScreen()->m_Curseur;
ref = GetScreen()->GetCrossHairPosition();
else
ref = GetScreen()->m_MousePosition;
int layer = GetScreen()->m_Active_Layer;
int layer = GetScreen()->m_Active_Layer;
// Search first on active layer
BOARD_ITEM* item = GetBoard()->m_Drawings;
......
......@@ -54,7 +54,7 @@ void WinEDA_GerberFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message( wxEmptyString );
SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = state;
UpdateStatusBar();
break;
......
......@@ -62,10 +62,18 @@ class BASE_SCREEN : public EDA_ITEM
char m_FlagSave; ///< Indicates automatic file save.
EDA_ITEM* m_CurrentItem; ///< Currently selected object
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:
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_O_Curseur; /* Relative Screen cursor coordinate (on grid)
* in user units. (coordinates from last reset position)*/
......@@ -151,14 +159,28 @@ public:
virtual int GetInternalUnits( void );
/**
* Return the current cursor position in drawing coordinates.
*
* This call inverts the Y axis coordinated of m_Curseur to correct for the difference
* between the wxWidgets GDI and the Kicad drawing coordinates.
* Function GetCrossHairPosition
* return the current cross hair position in logical (drawing) coordinates.
* @param aInvertY Inverts the Y axis position.
* @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 */
......@@ -352,7 +374,7 @@ public:
*/
wxPoint RefPos( bool useMouse )
{
return useMouse ? m_MousePosition : m_Curseur;
return useMouse ? m_MousePosition : m_crossHairPosition;
}
/**
......@@ -408,6 +430,12 @@ public:
void ClearBlockCommand() { m_BlockLocate.Clear(); }
wxPoint GetScrollCenterPosition() const { return m_scrollCenter; }
void SetScrollCenterPosition( const wxPoint& aCenterPosition )
{
m_scrollCenter = aCenterPosition;
}
#if defined(DEBUG)
/**
......
......@@ -15,6 +15,18 @@ class BASE_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
{
private:
......@@ -53,12 +65,11 @@ public:
/* Cursor management (used in editing functions) */
/* Mouse capture move callback function prototype. */
void (*ManageCurseur)( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
/* Mouse capture move callback function. */
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback;
/* Abort managed cursor callback function prototype. */
void (*ForceCloseManageCurseur)( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
/* Abort mouse capture callback function. */
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback;
public:
......@@ -123,10 +134,10 @@ public:
void OnActivate( wxActivateEvent& event );
/**
* Fucntion DoPrepareDC
* Function DoPrepareDC
* sets up the device context \a aDC for drawing.
* <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
* method is called to set the DC device origin (scroll bar position). This connects
* everything together to achieve the appropriate coordinate manipulation using wxDC
......@@ -153,7 +164,7 @@ public:
/* Mouse and keys events */
/**
* Funtion OnMouseWheel
* Function OnMouseWheel
* handles mouse wheel events.
* <p>
* The mouse wheel is used to provide support for zooming and panning. This
......@@ -188,7 +199,7 @@ public:
* Function IsPointOnDisplay
* @param aPosition The position to test in logical (drawing) units.
* @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 );
......@@ -227,7 +238,11 @@ public:
*/
wxPoint GetScreenCenterLogicalPosition();
void MouseToCursorSchema();
/**
* Function MoveCursorToCrossHair
* warps the cursor to the current cross hair position.
*/
void MoveCursorToCrossHair();
/**
* Function MoveCursor
......@@ -238,27 +253,40 @@ public:
/* Cursor functions */
/**
* Draw the user cursor.
*
* The user cursor is not the mouse cursor although they may be at the
* same screen position. The mouse cursor is still render by the OS.
* This is a drawn cross hair that is used to snap to grid when grid snapping
* is enabled. This is required because OSX does not allow moving the
* cursor programmatically.
*
* Function DrawCrossHair
* draws the user cross hair.
* <p>
* The user cross hair is not the mouse cursor although they may be at the same screen
* position. The mouse cursor is still render by the OS. This is a drawn cross hair
* that is used to snap to grid when grid snapping is enabled. This is as an indicator
* to where the next user action will take place.
* </p>
* @param aDC - the device context 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
void CursorOff( wxDC* DC );
// Hide the cross hair.
void CrossHairOff( wxDC* DC );
// display the grid cursor
void CursorOn( wxDC* DC );
// Show the cross hair.
void CrossHairOn( wxDC* DC );
/**
* 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;
}
/**
* Release managed cursor.
* Function EndMouseCapture
* ends mouse a capture.
*
* 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.
......@@ -267,7 +295,10 @@ public:
* @param aTitle The tool message to display in the status bar or wxEmptyString to clear
* 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; }
......@@ -275,4 +306,34 @@ public:
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 */
......@@ -281,7 +281,6 @@ public:
*/
virtual void AddMenuZoomAndGrid( wxMenu* aMasterMenu );
void Affiche_Message( const wxString& message );
void EraseMsgBox();
void Process_PageSettings( wxCommandEvent& event );
virtual void SetToolbars();
......@@ -297,6 +296,7 @@ public:
virtual void ReCreateVToolbar() = 0;
virtual void ReCreateMenuBar();
virtual void ReCreateAuxiliaryToolbar();
/**
* Function SetToolID
* Enables the icon of the selected tool in the vertical toolbar.
......@@ -392,28 +392,19 @@ public:
virtual void OnSize( wxSizeEvent& event );
void OnEraseBackground( wxEraseEvent& SizeEvent );
void SetToolbarBgColor( int color_num );
virtual void OnZoom( wxCommandEvent& event );
void OnGrid( int grid_type );
/**
* Function RedrawScreen
* 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.
* @param aWarpPointer Moves the mouse cursor is to the drawing position ( which
* is usually on grid) 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
* order to have \a aCenterPoint at the center of the screen.
* @param aCenterPoint The position in logical units to center the scroll bars.
* @param aWarpPointer Moves the mouse cursor to \a aCenterPoint if true.
*/
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 */
void Window_Zoom( EDA_Rect& Rect );
......@@ -438,14 +429,12 @@ public:
wxString GetXYSheetReferences( BASE_SCREEN* aScreen, const wxPoint& aPosition );
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 OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ToolOnRightClick( wxCommandEvent& event );
void AdjustScrollBars();
void AdjustScrollBars( const wxPoint& aCenterPosition );
/**
* Function OnActivate (virtual)
......@@ -544,9 +533,7 @@ public:
* @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)
*/
virtual void PrintPage( wxDC* aDC,
int aPrintMask, bool aPrintMirrorMode,
void * aData = NULL);
virtual void PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData = NULL );
DECLARE_EVENT_TABLE()
};
......
......@@ -22,10 +22,10 @@ void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
return;
OnModify();
DrawPanel->CursorOff( DC ); // Erase cursor shape
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
track->SetState( SEGM_FIXE, Flag_On );
track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
DrawPanel->CursorOn( DC ); // Display cursor shape
DrawPanel->CrossHairOn( DC ); // Display cursor shape
track->DisplayInfo( this );
}
......@@ -39,7 +39,7 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
if( (track == NULL ) || (track->Type() == TYPE_ZONE) )
return;
DrawPanel->CursorOff( DC ); // Erase cursor shape
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
Track = Marque_Une_Piste( GetBoard(), track, &nb_segm, NULL, true );
Trace_Une_Piste( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL );
......@@ -50,7 +50,7 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
Track = Track->Next();
}
DrawPanel->CursorOn( DC ); // Display cursor shape
DrawPanel->CrossHairOn( DC ); // Display cursor shape
OnModify();
}
......@@ -74,7 +74,7 @@ void WinEDA_PcbFrame::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
}
}
DrawPanel->CursorOff( DC ); // Erase cursor shape
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
while( Track ) /* Flag change */
{
if( (net_code >= 0 ) && (net_code != Track->GetNet()) )
......@@ -86,6 +86,6 @@ void WinEDA_PcbFrame::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
Track = Track->Next();
}
DrawPanel->CursorOn( DC ); // Display cursor shape
DrawPanel->CrossHairOn( DC ); // Display cursor shape
OnModify();
}
......@@ -90,15 +90,14 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
return;
case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur )
if( DrawPanel->IsMouseCaptured() )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
DrawPanel->m_endMouseCaptureCallback( DrawPanel, &dc );
}
break;
default: // Abort a current command (if any)
DrawPanel->UnManageCursor( 0, DrawPanel->GetDefaultCursor() );
DrawPanel->EndMouseCapture( 0, DrawPanel->GetDefaultCursor() );
break;
}
......@@ -211,10 +210,8 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
*/
if( PlaceModulesHorsPcb && edgesExists )
{
if( GetScreen()->m_Curseur.y <
(GetBoard()->m_BoundaryBox.GetBottom() + 2000) )
GetScreen()->m_Curseur.y = GetBoard()->m_BoundaryBox.GetBottom() +
2000;
if( GetScreen()->GetCrossHairPosition().y < (GetBoard()->m_BoundaryBox.GetBottom() + 2000) )
GetScreen()->GetCrossHairPosition().y = GetBoard()->m_BoundaryBox.GetBottom() + 2000;
}
/* calculate the area needed by footprints */
......@@ -232,7 +229,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
Xsize_allowed = (int) ( sqrt( surface ) * 4.0 / 3.0 );
start = current = GetScreen()->m_Curseur;
start = current = GetScreen()->GetCrossHairPosition();
Ymax_size = 0;
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
......@@ -254,14 +251,10 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
Ymax_size = 0;
}
GetScreen()->m_Curseur.x =
current.x + Module->m_Pos.x - Module->m_RealBoundaryBox.GetX();
GetScreen()->m_Curseur.y =
current.y + Module->m_Pos.y - Module->m_RealBoundaryBox.GetY();
GetScreen()->SetCrossHairPosition( current + Module->m_Pos -
Module->m_RealBoundaryBox.GetPosition() );
Ymax_size = MAX( Ymax_size, Module->m_RealBoundaryBox.GetHeight() );
PutOnGrid( &GetScreen()->m_Curseur );
Place_Module( Module, NULL, true );
current.x += Module->m_RealBoundaryBox.GetWidth() + pas_grille;
......
......@@ -276,10 +276,10 @@ end_of_tst:
break;
/* Place module. */
CurrPosition = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = PosOK;
CurrPosition = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( PosOK );
Place_Module( Module, DC );
GetScreen()->m_Curseur = CurrPosition;
GetScreen()->SetCrossHairPosition( CurrPosition );
Module->Set_Rectangle_Encadrement();
Module->SetRectangleExinscrit();
......@@ -616,7 +616,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
DrawModuleOutlines( DrawPanel, DC, Module );
mincout = -1.0;
Affiche_Message( wxT( "Score ??, pos ??" ) );
SetStatusText( wxT( "Score ??, pos ??" ) );
for( ; CurrPosition.x < GetBoard()->m_BoundaryBox.GetRight() - fx;
CurrPosition.x += g_GridRoutingSize )
......@@ -674,7 +674,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC )
(int) mincout,
(float) LastPosOK.x / 10000,
(float) LastPosOK.y / 10000 );
Affiche_Message( msg );
SetStatusText( msg );
}
}
if( DisplayChevelu )
......
......@@ -158,7 +158,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
return;
}
Affiche_Message( _( "Place Cells" ) );
SetStatusText( _( "Place Cells" ) );
PlaceCells( GetBoard(), -1, FORCE_PADS );
/* Construction of the track list for router. */
......@@ -176,9 +176,8 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
InitWork(); /* Free memory for the list of router connections. */
Board.UnInitBoard();
stop = time( NULL ) - start;
msg.Printf( wxT( "time = %d second%s" ), stop,
( stop == 1 ) ? wxT( "" ) : wxT( "s" ) );
Affiche_Message( msg );
msg.Printf( wxT( "time = %d second%s" ), stop, ( stop == 1 ) ? wxT( "" ) : wxT( "s" ) );
SetStatusText( msg );
}
......
......@@ -112,7 +112,7 @@ int WinEDA_BasePcbFrame::BestZoom( void )
else
jj = 31;
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;
}
......@@ -129,16 +129,15 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
/* There may be need to reframe the drawing. */
if( !DrawPanel->IsPointOnDisplay( aPos ) )
{
screen->m_Curseur = aPos;
RedrawScreen( true );
RedrawScreen( aPos, true );
}
else
{
// Put cursor on item position
DrawPanel->CursorOff( &dc );
screen->m_Curseur = aPos;
DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc );
DrawPanel->CrossHairOff( &dc );
screen->SetCrossHairPosition( aPos );
DrawPanel->MoveCursorToCrossHair();
DrawPanel->CrossHairOn( &dc );
}
}
......@@ -323,8 +322,8 @@ void WinEDA_BasePcbFrame::UpdateStatusBar()
wxString Line;
double theta, ro;
int dx = screen->m_Curseur.x - screen->m_O_Curseur.x;
int dy = screen->m_Curseur.y - screen->m_O_Curseur.y;
int dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
int dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
if( dx==0 && dy==0 )
theta = 0.0;
......
......@@ -85,15 +85,15 @@ private:
static bool InstallBlockCmdFrame( WinEDA_BasePcbFrame* parent, const wxString& title )
{
int nocmd;
wxPoint oldpos = parent->GetScreen()->m_Curseur;
wxPoint oldpos = parent->GetScreen()->GetCrossHairPosition();
parent->DrawPanel->m_IgnoreMouseEvents = true;
DIALOG_BLOCK_OPTIONS dlg( parent, title );
nocmd = dlg.ShowModal();
parent->GetScreen()->m_Curseur = oldpos;
parent->DrawPanel->MouseToCursorSchema();
parent->GetScreen()->SetCrossHairPosition( oldpos );
parent->DrawPanel->MoveCursorToCrossHair();
parent->DrawPanel->m_IgnoreMouseEvents = false;
parent->DrawPanel->SetCursor( parent->DrawPanel->GetDefaultCursor() );
......@@ -201,11 +201,12 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
{
bool err = false;
if( DrawPanel->ManageCurseur == NULL )
if( !DrawPanel->IsMouseCaptured() )
{
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;
switch( GetScreen()->m_BlockLocate.m_Command )
......@@ -217,15 +218,17 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
Block_Move();
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_COPY: /* Copy */
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
Block_Duplicate();
GetScreen()->m_BlockLocate.ClearItemsList();
break;
......@@ -240,11 +243,9 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
OnModify();
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;
DrawPanel->SetMouseCapture( NULL, NULL );
GetScreen()->ClearBlockCommand();
if( GetScreen()->m_BlockLocate.GetCount() )
{
DisplayError( this, wxT( "Error in HandleBlockPLace some items left in list" ) );
......@@ -274,11 +275,8 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
// If coming here after cancel block, clean up and exit
if( GetScreen()->m_BlockLocate.m_State == STATE_NO_BLOCK )
{
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->m_BlockLocate.ClearItemsList();
DrawPanel->SetMouseCapture( NULL, NULL );
GetScreen()->ClearBlockCommand();
DisplayToolMsg( wxEmptyString );
return false;
}
......@@ -292,7 +290,7 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
cancelCmd = true;
// undraw block outline
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
}
else
{
......@@ -307,7 +305,7 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
}
}
if( !cancelCmd && DrawPanel->ManageCurseur )
if( !cancelCmd && DrawPanel->IsMouseCaptured() )
{
switch( GetScreen()->m_BlockLocate.m_Command )
{
......@@ -321,24 +319,24 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
nextcmd = true;
DrawPanel->ManageCurseur = drawMovingBlock;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback = drawMovingBlock;
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
break;
case BLOCK_DELETE: /* Delete */
DrawPanel->ManageCurseur = NULL;
DrawPanel->m_mouseCaptureCallback = NULL;
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
Block_Delete();
break;
case BLOCK_ROTATE: /* Rotation */
DrawPanel->ManageCurseur = NULL;
DrawPanel->m_mouseCaptureCallback = NULL;
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
Block_Rotate();
break;
case BLOCK_FLIP: /* Flip */
DrawPanel->ManageCurseur = NULL;
DrawPanel->m_mouseCaptureCallback = NULL;
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
Block_Flip();
break;
......@@ -358,7 +356,7 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
// Turn off the redraw block routine now so it is not displayed
// with one corner at the new center of the screen
DrawPanel->ManageCurseur = NULL;
DrawPanel->m_mouseCaptureCallback = NULL;
Window_Zoom( GetScreen()->m_BlockLocate );
break;
......@@ -369,12 +367,8 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
if( ! nextcmd )
{
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->m_BlockLocate.ClearItemsList();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->ClearBlockCommand();
DrawPanel->SetMouseCapture( NULL, NULL );
DisplayToolMsg( wxEmptyString );
}
......@@ -583,7 +577,7 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP )
{
screen->m_BlockLocate.m_MoveVector = screen->m_Curseur -
screen->m_BlockLocate.m_MoveVector = screen->GetCrossHairPosition() -
screen->m_BlockLocate.m_BlockLastCursorPosition;
}
......@@ -671,7 +665,7 @@ void WinEDA_PcbFrame::Block_Rotate()
wxPoint centre; // rotation cent-re for the rotation transform
int rotAngle = 900; // rotation angle in 0.1 deg.
oldpos = GetScreen()->m_Curseur;
oldpos = GetScreen()->GetCrossHairPosition();
centre = GetScreen()->m_BlockLocate.Centre();
OnModify();
......@@ -740,7 +734,7 @@ void WinEDA_PcbFrame::Block_Flip()
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection;
itemsList->m_Status = UR_FLIPPED;
memo = GetScreen()->m_Curseur;
memo = GetScreen()->GetCrossHairPosition();
center = GetScreen()->m_BlockLocate.Centre();
......
......@@ -103,14 +103,13 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
{
BlockState state = GetScreen()->m_BlockLocate.m_State;
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_Command = command;
DrawPanel->ManageCurseur = DrawAndSizingBlockOutlines;
DrawPanel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
GetScreen()->m_Curseur.x = GetScreen()->m_BlockLocate.GetRight();
GetScreen()->m_Curseur.y = GetScreen()->m_BlockLocate.GetBottom();
DrawPanel->MouseToCursorSchema();
DrawPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
GetScreen()->m_BlockLocate.GetBottom() ) );
DrawPanel->MoveCursorToCrossHair();
}
switch( GetScreen()->m_BlockLocate.m_Command )
......@@ -127,12 +126,14 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
if( itemsCount )
{
nextcmd = true;
if( DrawPanel->ManageCurseur != NULL )
if( DrawPanel->IsMouseCaptured() )
{
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( TRUE );
}
......@@ -140,7 +141,7 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
nextcmd = true;
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->m_mouseCaptureCallback = DrawMovingBlockOutlines;
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
break;
......@@ -189,17 +190,14 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
{
ClearMarkItems( currentModule );
}
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->ClearBlockCommand();
SetCurItem( NULL );
DrawPanel->SetMouseCapture( NULL, NULL );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
}
return nextcmd;
}
......@@ -217,10 +215,10 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
bool err = FALSE;
MODULE* currentModule = GetBoard()->m_Modules;
if( DrawPanel->ManageCurseur == NULL )
if( !DrawPanel->IsMouseCaptured() )
{
err = TRUE;
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) );
DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
......@@ -272,14 +270,12 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
OnModify();
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;
SetCurItem( NULL );
DrawPanel->Refresh( TRUE );
DrawPanel->SetMouseCapture( NULL, NULL );
DrawPanel->Refresh( true );
SetToolID( m_ID_current_state, DrawPanel->GetDefaultCursor(), wxEmptyString );
}
......@@ -339,7 +335,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
}
/* Repaint new view. */
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 );
......
......@@ -74,7 +74,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC,
if( aCleanVias ) // delete redundant vias
{
frame->Affiche_Message( _( "Clean vias" ) );
frame->SetStatusText( _( "Clean vias" ) );
clean_vias( frame->GetBoard() );
}
......@@ -83,7 +83,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC,
but is not on the pad or the via center */
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 */
ConnectDanglingEndToPad( frame, DC );
......@@ -98,18 +98,18 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC,
/* Remove null segments and intermediate points on aligned segments */
if( aMergeSegments )
{
frame->Affiche_Message( _( "Merge track segments" ) );
frame->SetStatusText( _( "Merge track segments" ) );
clean_segments( frame );
}
/* Delete dangling tracks */
if( aDeleteUnconnectedSegm )
{
frame->Affiche_Message( _( "Delete unconnected tracks" ) );
frame->SetStatusText( _( "Delete unconnected tracks" ) );
DeleteUnconnectedTracks( frame, DC );
}
frame->Affiche_Message( _( "Cleanup finished" ) );
frame->SetStatusText( _( "Cleanup finished" ) );
frame->Compile_Ratsnest( DC, true );
......
......@@ -370,7 +370,7 @@ void WinEDA_BasePcbFrame::test_1_net_connexion( wxDC* DC, int net_code )
m_Pcb->GetRatsnestsCount(), m_Pcb->GetNoconnectCount(),
nb_net_noconnect );
Affiche_Message( msg );
SetStatusText( msg );
return;
}
......
......@@ -214,7 +214,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
DrawPanel->m_AbortRequest = true; // changed in false if an item
PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
// DrawPanel->m_IgnoreMouseEvents = false;
......@@ -231,9 +231,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
wxRealPoint gridSize;
wxPoint oldpos;
int hotkey = 0;
wxPoint pos = aPosition;
PutOnGrid( &pos );
wxPoint pos = GetScreen()->GetNearestGridPosition( aPosition );
// Save the board after the time out :
int CurrentTime = time( NULL );
......@@ -262,7 +260,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
SetTitle( GetScreen()->GetFileName() );
}
oldpos = GetScreen()->m_Curseur;
oldpos = GetScreen()->GetCrossHairPosition();
gridSize = GetScreen()->GetGridSize();
......@@ -298,7 +296,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
}
// Put cursor in new position, according to the zoom keys (if any).
GetScreen()->m_Curseur = pos;
GetScreen()->SetCrossHairPosition( pos );
/* 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,
......@@ -319,16 +317,15 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
if( keep_on_grid )
{
wxPoint on_grid = pos;
wxPoint on_grid = GetScreen()->GetNearestGridPosition( pos );
PutOnGrid( &on_grid );
wxSize grid;
grid.x = (int) GetScreen()->GetGridSize().x;
grid.y = (int) GetScreen()->GetGridSize().y;
if( Magnetize( m_Pcb, this, m_ID_current_state, grid, on_grid, &pos ) )
{
GetScreen()->m_Curseur = pos;
GetScreen()->SetCrossHairPosition( pos );
}
else
{
......@@ -339,27 +336,27 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
|| !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
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;
GetScreen()->m_Curseur = oldpos;
DrawPanel->CursorOff( aDC );
GetScreen()->m_Curseur = pos;
DrawPanel->CursorOn( aDC );
pos = GetScreen()->GetCrossHairPosition();
GetScreen()->SetCrossHairPosition( oldpos );
DrawPanel->CrossHairOff( aDC );
GetScreen()->SetCrossHairPosition( pos );
DrawPanel->CrossHairOn( aDC );
if( DrawPanel->ManageCurseur )
if( DrawPanel->IsMouseCaptured() )
{
#ifdef USE_WX_OVERLAY
wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC );
oDC.Clear();
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, false );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, false );
#else
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, true );
DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true );
#endif
}
#ifdef USE_WX_OVERLAY
......
......@@ -41,6 +41,7 @@ void RemoteCommand( const char* cmdline )
char* text;
MODULE* module = 0;
WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*)wxGetApp().GetTopWindow();
wxPoint pos;
strncpy( line, cmdline, sizeof(line) - 1 );
......@@ -61,9 +62,10 @@ void RemoteCommand( const char* cmdline )
else
msg.Printf( _( "%s not found" ), GetChars( modName ) );
frame->Affiche_Message( msg );
frame->SetStatusText( msg );
if( module )
frame->GetScreen()->m_Curseur = module->GetPosition();
pos = module->GetPosition();
}
else if( strcmp( idcmd, "$PIN:" ) == 0 )
{
......@@ -80,6 +82,7 @@ void RemoteCommand( const char* cmdline )
modName = CONV_FROM_UTF8( text );
module = frame->GetBoard()->FindModuleByReference( modName );
if( module )
pad = module->FindPadByName( pinName );
......@@ -88,7 +91,7 @@ void RemoteCommand( const char* cmdline )
netcode = pad->GetNet();
// put cursor on the pad:
frame->GetScreen()->m_Curseur = pad->GetPosition();
pos = pad->GetPosition();
}
if( netcode > 0 ) /* highlight the pad net*/
......@@ -106,22 +109,20 @@ void RemoteCommand( const char* cmdline )
msg.Printf( _( "%s not found" ), GetChars( modName ) );
else if( pad == NULL )
{
msg.Printf( _( "%s pin %s not found" ),
GetChars( modName ), GetChars( pinName ) );
msg.Printf( _( "%s pin %s not found" ), GetChars( modName ), GetChars( pinName ) );
frame->SetCurItem( module );
}
else
{
msg.Printf( _( "%s pin %s found" ),
GetChars( modName ), GetChars( pinName ) );
msg.Printf( _( "%s pin %s found" ), GetChars( modName ), GetChars( pinName ) );
frame->SetCurItem( pad );
}
frame->Affiche_Message( msg );
frame->SetStatusText( msg );
}
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 )
if( g_CurrentTrackList.GetCount() == 0 )
{
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->SetMouseCapture( NULL, NULL );
if( g_HighLight_Status )
High_Light( DC );
......@@ -96,8 +95,8 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
}
else
{
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
if( DrawPanel->IsMouseCaptured() )
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
return g_CurrentTrackSegment;
}
......
......@@ -452,20 +452,17 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
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 );
}
// Initialize masks clearances
m_CurrentModule->m_LocalClearance =
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl,
m_Parent->m_InternalUnits );
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->m_InternalUnits );
m_CurrentModule->m_LocalSolderMaskMargin =
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl,
m_Parent->m_InternalUnits );
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits );
m_CurrentModule->m_LocalSolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl,
m_Parent->m_InternalUnits );
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits );
double dtmp = 0.0;
msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp );
......@@ -579,30 +576,30 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
if( m_DC )
{
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 )
{
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_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL );
m_Parent->GetScreen()->m_Curseur = tmp;
m_Parent->GetScreen()->SetCrossHairPosition( tmp );
m_ReferenceCtrl->SetValue( m_ReferenceCopy->m_Text );
}
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_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL );
m_Parent->GetScreen()->m_Curseur = tmp;
m_Parent->GetScreen()->SetCrossHairPosition( tmp );
m_ValueCtrl->SetValue( m_ValueCopy->m_Text );
}
......@@ -426,10 +426,10 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
void DIALOG_MODULE_MODULE_EDITOR::OnEditReference(wxCommandEvent& event)
/***********************************************************************/
{
wxPoint tmp = m_Parent->GetScreen()->m_Curseur;
m_Parent->GetScreen()->m_Curseur = m_ReferenceCopy->m_Pos;
wxPoint tmp = m_Parent->GetScreen()->GetCrossHairPosition();
m_Parent->GetScreen()->SetCrossHairPosition( m_ReferenceCopy->m_Pos );
m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL );
m_Parent->GetScreen()->m_Curseur = tmp;
m_Parent->GetScreen()->SetCrossHairPosition( tmp );
m_ReferenceCtrl->SetValue(m_ReferenceCopy->m_Text);
}
......@@ -437,10 +437,10 @@ void DIALOG_MODULE_MODULE_EDITOR::OnEditReference(wxCommandEvent& event)
void DIALOG_MODULE_MODULE_EDITOR::OnEditValue(wxCommandEvent& event)
/***********************************************************/
{
wxPoint tmp = m_Parent->GetScreen()->m_Curseur;
m_Parent->GetScreen()->m_Curseur = m_ValueCopy->m_Pos;
wxPoint tmp = m_Parent->GetScreen()->GetCrossHairPosition();
m_Parent->GetScreen()->SetCrossHairPosition( m_ValueCopy->m_Pos );
m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL );
m_Parent->GetScreen()->m_Curseur = tmp;
m_Parent->GetScreen()->SetCrossHairPosition( tmp);
m_ValueCtrl->SetValue(m_ValueCopy->m_Text);
}
......@@ -144,7 +144,7 @@ void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message( wxEmptyString );
SetStatusText( wxEmptyString );
DisplayOpt.DisplayPolarCood = state;
UpdateStatusBar();
break;
......
......@@ -68,7 +68,7 @@ void WinEDA_PcbFrame::InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wx
DialogGraphicItemProperties* dialog = new DialogGraphicItemProperties( this,
aItem, aDC );
dialog->ShowModal(); dialog->Destroy();
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE;
}
......
......@@ -64,7 +64,7 @@ void WinEDA_PcbFrame::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC )
DrawPanel->m_IgnoreMouseEvents = TRUE;
DIALOG_PCB_TEXT_PROPERTIES dlg( this, TextPCB, DC );
dlg.ShowModal();
DrawPanel->MouseToCursorSchema();
DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = FALSE;
}
......
......@@ -210,10 +210,8 @@ static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC )
}
}
status_dimension = 0;
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
((WinEDA_PcbFrame*)Panel->GetParent())->SetCurItem(NULL);
status_dimension = 0;
((WinEDA_PcbFrame*)Panel->GetParent())->SetCurItem( NULL );
}
......@@ -226,7 +224,7 @@ DIMENSION* WinEDA_PcbFrame::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
if( Dimension == NULL ) /* debut reel du trace */
{
status_dimension = 1;
pos = GetScreen()->m_Curseur;
pos = GetScreen()->GetCrossHairPosition();
Dimension = new DIMENSION( GetBoard() );
Dimension->m_Flags = IS_NEW;
......@@ -267,8 +265,7 @@ DIMENSION* WinEDA_PcbFrame::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
Dimension->Draw( DrawPanel, DC, GR_XOR );
DrawPanel->ManageCurseur = Montre_Position_New_Dimension;
DrawPanel->ForceCloseManageCurseur = Exit_EditDimension;
DrawPanel->SetMouseCapture( Montre_Position_New_Dimension, Exit_EditDimension );
return Dimension;
}
......@@ -289,8 +286,7 @@ DIMENSION* WinEDA_PcbFrame::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
SaveCopyInUndoList( Dimension, UR_NEW );
OnModify();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->SetMouseCapture( NULL, NULL );
return NULL;
}
......@@ -301,7 +297,7 @@ static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
{
PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem();
wxPoint pos = screen->m_Curseur;
wxPoint pos = screen->GetCrossHairPosition();
if( Dimension == NULL )
return;
......
......@@ -38,14 +38,14 @@ void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
{
if( Edge == NULL )
return;
Edge->Draw( DrawPanel, DC, GR_XOR );
Edge->m_Flags |= IS_MOVED;
MoveVector.x = MoveVector.y = 0;
CursorInitialPosition = GetScreen()->m_Curseur;
DrawPanel->ManageCurseur = Move_Segment;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge_Module;
CursorInitialPosition = GetScreen()->GetCrossHairPosition();
DrawPanel->SetMouseCapture( Move_Segment, Exit_EditEdge_Module );
SetCurItem( Edge );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
}
......@@ -63,8 +63,7 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge )
Edge->m_End0 -= MoveVector;
Edge->m_Flags = 0;
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
OnModify();
MODULE* Module = (MODULE*) Edge->GetParent();
......@@ -89,7 +88,7 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
Edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
}
MoveVector = -(screen->m_Curseur - CursorInitialPosition);
MoveVector = -(screen->GetCrossHairPosition() - CursorInitialPosition);
Edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
......@@ -115,7 +114,7 @@ static void ShowEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aP
Edge->Draw( aPanel, aDC, GR_XOR );
}
Edge->m_End = screen->m_Curseur;
Edge->m_End = screen->GetCrossHairPosition();
/* Update relative coordinate. */
Edge->m_End0 = Edge->m_End - Module->m_Pos;
......@@ -185,8 +184,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge )
/* an edge is put on a copper layer, and it is very dangerous. a
*confirmation is requested */
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;
}
......@@ -223,13 +221,15 @@ void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* aEdge )
{
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 );
if( dlg.ShowModal() != wxID_OK )
return; // cancelled by user
buffer = dlg.GetValue( );
g_ModuleSegmentWidth = ReturnValueFromString( g_UserUnit, buffer, GetScreen()->GetInternalUnits() );
g_ModuleSegmentWidth = ReturnValueFromString( g_UserUnit, buffer,
GetScreen()->GetInternalUnits() );
if( aEdge )
{
......@@ -289,8 +289,7 @@ static void Exit_EditEdge_Module( EDA_DRAW_PANEL* Panel, wxDC* DC )
Edge->Draw( Panel, DC, GR_OR );
}
}
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
Panel->GetScreen()->SetCurItem( NULL );
}
......@@ -339,7 +338,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge->SetLayer( SILKSCREEN_N_BACK );
/* 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 */
Edge->m_End = Edge->m_Start;
......@@ -351,9 +350,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge->m_End0 = Edge->m_Start0;
module->Set_Rectangle_Encadrement();
DrawPanel->ManageCurseur = ShowEdgeModule;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge_Module;
DrawPanel->SetMouseCapture( ShowEdgeModule, Exit_EditEdge_Module );
}
/* Segment creation in progress.
* The ending coordinate are updated by the function
......@@ -380,7 +377,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge->m_Flags = IS_NEW;
Edge->m_Width = g_ModuleSegmentWidth;
Edge->m_Start = GetScreen()->m_Curseur;
Edge->m_Start = GetScreen()->GetCrossHairPosition();
Edge->m_End = Edge->m_Start;
/* Update relative coordinate. */
......@@ -418,6 +415,5 @@ void WinEDA_ModuleEditFrame::End_Edge_Module( EDGE_MODULE* Edge )
Module->Set_Rectangle_Encadrement();
Module->m_LastEdit_Time = time( NULL );
OnModify();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->SetMouseCapture( NULL, NULL );
}
This diff is collapsed.
......@@ -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 )
{
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
TEXTE_PCB* TextePcb = (TEXTE_PCB*) Panel->GetScreen()->GetCurItem();
( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL );
......@@ -61,8 +58,7 @@ void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC )
*/
void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
{
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
if( TextePcb == NULL )
......@@ -79,8 +75,7 @@ void WinEDA_PcbFrame::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
}
if( TextePcb->m_Flags == IS_MOVED ) // If moved only
SaveCopyInUndoList( TextePcb, UR_MOVED,
TextePcb->m_Pos - s_TextCopy.m_Pos );
SaveCopyInUndoList( TextePcb, UR_MOVED, TextePcb->m_Pos - s_TextCopy.m_Pos );
else
{
// Restore initial params
......@@ -109,10 +104,9 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
TextePcb->Draw( DrawPanel, DC, GR_XOR );
TextePcb->m_Flags |= IS_MOVED;
TextePcb->DisplayInfo( this );
DrawPanel->ManageCurseur = Move_Texte_Pcb;
DrawPanel->ForceCloseManageCurseur = Abort_Edit_Pcb_Text;
DrawPanel->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text );
SetCurItem( TextePcb );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
}
......@@ -128,7 +122,7 @@ static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aP
if( aErase )
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 );
}
......@@ -143,8 +137,7 @@ void WinEDA_PcbFrame::Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
SaveCopyInUndoList( TextePcb, UR_DELETED );
TextePcb->UnLink();
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
}
......@@ -166,7 +159,7 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC )
TextePcb->m_Mirror = true;
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;
InstallTextPCBOptionsFrame( TextePcb, DC );
......
......@@ -126,10 +126,10 @@ void WinEDA_PcbFrame::Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem )
{
TRACK* oldsegm = (TRACK*) itemsListPicker.GetPickedItemLink( 0 );
wxASSERT( oldsegm );
DrawPanel->CursorOff( aDC ); // Erase cursor shape
DrawPanel->CrossHairOff( aDC ); // Erase cursor shape
oldsegm->Draw( DrawPanel, aDC, GR_XOR ); // Erase old 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 );
}
......@@ -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
if( aDC )
{
DrawPanel->CursorOff( aDC ); // Erase cursor shape
DrawPanel->CrossHairOff( aDC ); // Erase cursor shape
for( unsigned ii = 0; ii < itemsListPicker.GetCount(); ii++ )
{
TRACK* segm = (TRACK*) itemsListPicker.GetPickedItemLink( ii );
......@@ -176,7 +177,7 @@ void WinEDA_PcbFrame::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment )
segm->Draw( DrawPanel, aDC, GR_OR ); // Display new track shape
}
DrawPanel->CursorOn( aDC ); // Display cursor shape
DrawPanel->CrossHairOn( aDC ); // Display cursor shape
}
SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
......
......@@ -32,12 +32,11 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
return;
drawitem->Draw( DrawPanel, DC, GR_XOR );
drawitem->m_Flags |= IS_MOVED;
s_InitialPosition = s_LastPosition = GetScreen()->m_Curseur;
s_InitialPosition = s_LastPosition = GetScreen()->GetCrossHairPosition();
drawitem->DisplayInfo( this );
DrawPanel->ManageCurseur = Move_Segment;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge;
DrawPanel->SetMouseCapture( Move_Segment, Exit_EditEdge );
SetCurItem( drawitem );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
}
......@@ -51,8 +50,7 @@ void WinEDA_PcbFrame::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
SaveCopyInUndoList(drawitem, UR_MOVED, s_LastPosition - s_InitialPosition);
drawitem->Draw( DrawPanel, DC, GR_OR );
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
OnModify();
drawitem->m_Flags = 0;
......@@ -76,10 +74,10 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
Segment->Draw( aPanel, aDC, GR_XOR );
wxPoint delta;
delta = aPanel->GetScreen()->m_Curseur - s_LastPosition;
delta = aPanel->GetScreen()->GetCrossHairPosition() - s_LastPosition;
Segment->m_Start += delta;
Segment->m_End += delta;
s_LastPosition = aPanel->GetScreen()->m_Curseur;
s_LastPosition = aPanel->GetScreen()->GetCrossHairPosition();
Segment->Draw( aPanel, aDC, GR_XOR );
DisplayOpt.DisplayDrawItems = t_fill;
......@@ -180,21 +178,20 @@ static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Segment->m_Flags & IS_NEW )
{
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, false );
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, false );
Segment ->DeleteStructure();
Segment = NULL;
}
else
{
wxPoint pos = Panel->GetScreen()->m_Curseur;
Panel->GetScreen()->m_Curseur = s_InitialPosition;
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->m_Curseur = pos;
wxPoint pos = Panel->GetScreen()->GetCrossHairPosition();
Panel->GetScreen()->SetCrossHairPosition( s_InitialPosition );
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->SetCrossHairPosition( pos );
Segment->m_Flags = 0;
Segment->Draw( Panel, DC, GR_OR );
}
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
( (WinEDA_PcbFrame*) Panel->GetParent() )->SetCurItem( NULL );
}
......@@ -225,9 +222,8 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
Segment->m_Width = s_large;
Segment->m_Shape = shape;
Segment->m_Angle = 900;
Segment->m_Start = Segment->m_End = GetScreen()->m_Curseur;
DrawPanel->ManageCurseur = Montre_Position_NewSegment;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge;
Segment->m_Start = Segment->m_End = GetScreen()->GetCrossHairPosition();
DrawPanel->SetMouseCapture( Montre_Position_NewSegment, Exit_EditEdge );
}
else /* The ending point ccordinate Segment->m_End was updated by he function
* Montre_Position_NewSegment() called on a move mouse event
......@@ -288,8 +284,7 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
SaveCopyInUndoList( Segment, UR_NEW );
}
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
}
......@@ -312,13 +307,13 @@ static void Montre_Position_NewSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( Segments_45_Only && ( Segment->m_Shape == S_SEGMENT ) )
{
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_End.x, &Segment->m_End.y );
}
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 );
......
......@@ -66,9 +66,9 @@ void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod )
if( pt_mod == NULL )
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:
* The coordinates are relative to the anchor point.
......
......@@ -142,7 +142,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
itmp = g_CurrentTrackList.GetCount();
Begin_Route( g_CurrentTrackSegment, DC );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
/* create the via */
SEGVIA* via = new SEGVIA( GetBoard() );
......@@ -200,7 +200,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
/* DRC fault: the Via cannot be placed here ... */
delete via;
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
// delete the track(s) added in Begin_Route()
while( g_CurrentTrackList.GetCount() > itmp )
......@@ -253,7 +253,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() );
}
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
via->DisplayInfo( this );
UpdateStatusBar();
......
......@@ -61,8 +61,6 @@ static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
g_CurrentTrackList.DeleteAll();
}
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
frame->SetCurItem( NULL );
}
......@@ -86,10 +84,9 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
int masquelayer =
g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
BOARD_ITEM* LockPoint;
wxPoint pos = GetScreen()->m_Curseur;
wxPoint pos = GetScreen()->GetCrossHairPosition();
DrawPanel->ManageCurseur = ShowNewTrackWhenMovingCursor;
DrawPanel->ForceCloseManageCurseur = Exit_Editrack;
DrawPanel->SetMouseCapture( ShowNewTrackWhenMovingCursor, Exit_Editrack );
if( aTrack == NULL ) /* Starting a new track */
{
......@@ -193,7 +190,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackSegment->DisplayInfoBase( this );
SetCurItem( g_CurrentTrackSegment, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
if( Drc_On )
{
......@@ -539,11 +536,11 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
High_Light( DC );
g_HighLight_NetCode = OldNetCodeSurbrillance;
if( OldEtatSurbrillance )
High_Light( DC );
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
}
......@@ -611,7 +608,7 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
{
PCB_SCREEN* screen = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetScreen();
BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->GetParent()) )->GetBoard();
wxPoint cursor = screen->m_Curseur;
wxPoint cursor = screen->GetCrossHairPosition();
wxPoint cv, vec, n;
TRACK* track = g_CurrentTrackSegment;
TRACK* other;
......@@ -734,7 +731,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
{
if( g_TwoSegmentTrackBuild )
{
g_CurrentTrackSegment->m_End = screen->m_Curseur;
g_CurrentTrackSegment->m_End = screen->GetCrossHairPosition();
if( Drc_On )
PushTrack( aPanel );
......@@ -748,7 +745,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
/* Calculate of the end of the path for the permitted directions:
* 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.y,
&g_CurrentTrackSegment->m_End.x,
......@@ -757,7 +754,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
}
else /* Here the angle is arbitrary */
{
g_CurrentTrackSegment->m_End = screen->m_Curseur;
g_CurrentTrackSegment->m_End = screen->GetCrossHairPosition();
}
/* Redraw the new track */
......
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.
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