Commit 50f063da authored by Wayne Stambaugh's avatar Wayne Stambaugh

Changes to use cursor position as parameter and snap to grid settings.

* Changed managed cursor callback definition to include the current
  cursor drawing position.
* Modified all managed cursor callbacks to match new definition.
* Added snap to grid option to base drawing frame object.
* Changed add no connect managed cursor callback to use new position
  parameter instead of the stored one.
* Lots of coding policy fixes.
parent f92d6972
...@@ -174,6 +174,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo ...@@ -174,6 +174,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
Block->m_Flags = 0; Block->m_Flags = 0;
Block->m_Command = (CmdBlockType) ReturnBlockCommand( key ); Block->m_Command = (CmdBlockType) ReturnBlockCommand( key );
if( Block->m_Command == 0 ) if( Block->m_Command == 0 )
return FALSE; return FALSE;
...@@ -216,7 +217,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo ...@@ -216,7 +217,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
return TRUE; return TRUE;
} }
Block->m_State = STATE_BLOCK_MOVE; Block->m_State = STATE_BLOCK_MOVE;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, startpos, FALSE );
break; break;
default: default:
...@@ -240,21 +241,22 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo ...@@ -240,21 +241,22 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
* by Initm_BlockLocateDatas(). * by Initm_BlockLocateDatas().
* The other point of the rectangle is the mouse cursor * The other point of the rectangle is the mouse cursor
*/ */
void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
BLOCK_SELECTOR* PtBlock; BLOCK_SELECTOR* PtBlock;
PtBlock = &panel->GetScreen()->m_BlockLocate; PtBlock = &aPanel->GetScreen()->m_BlockLocate;
PtBlock->m_MoveVector = wxPoint( 0, 0 ); PtBlock->m_MoveVector = wxPoint( 0, 0 );
if( erase ) if( aErase )
PtBlock->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color ); PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
PtBlock->m_BlockLastCursorPosition = panel->GetScreen()->m_Curseur; PtBlock->m_BlockLastCursorPosition = aPanel->GetScreen()->m_Curseur;
PtBlock->SetEnd( panel->GetScreen()->m_Curseur ); PtBlock->SetEnd( aPanel->GetScreen()->m_Curseur );
PtBlock->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color ); PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
if( PtBlock->m_State == STATE_BLOCK_INIT ) if( PtBlock->m_State == STATE_BLOCK_INIT )
{ {
...@@ -275,7 +277,7 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -275,7 +277,7 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Panel->ManageCurseur ) /* Erase current drawing if( Panel->ManageCurseur ) /* Erase current drawing
* on screen */ * on screen */
{ {
Panel->ManageCurseur( Panel, DC, FALSE ); /* Clear block outline. */ Panel->ManageCurseur( Panel, DC, wxDefaultPosition, false ); /* Clear block outline. */
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
......
...@@ -78,6 +78,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, ...@@ -78,6 +78,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype,
m_LastGridSizeId = 0; m_LastGridSizeId = 0;
m_DrawGrid = true; // hide/Show grid. default = show m_DrawGrid = true; // hide/Show grid. default = show
m_GridColor = DARKGRAY; // Grid color m_GridColor = DARKGRAY; // Grid color
m_snapToGrid = true;
// Internal units per inch: = 1000 for schema, = 10000 for PCB // Internal units per inch: = 1000 for schema, = 10000 for PCB
m_InternalUnits = EESCHEMA_INTERNAL_UNIT; m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
...@@ -450,6 +451,17 @@ void EDA_DRAW_FRAME::OnGrid( int grid_type ) ...@@ -450,6 +451,17 @@ void EDA_DRAW_FRAME::OnGrid( int grid_type )
} }
wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition )
{
wxPoint pos = aPosition;
if( m_CurrentScreen != NULL && m_snapToGrid )
pos = m_CurrentScreen->GetNearestGridPosition( aPosition );
return pos;
}
int EDA_DRAW_FRAME::ReturnBlockCommand( int key ) int EDA_DRAW_FRAME::ReturnBlockCommand( int key )
{ {
return 0; return 0;
......
...@@ -52,30 +52,30 @@ SCH_ITEM::~SCH_ITEM() ...@@ -52,30 +52,30 @@ SCH_ITEM::~SCH_ITEM()
* for an "old" item, saving it in undo list must be done before editiing, * for an "old" item, saving it in undo list must be done before editiing,
* and not here! * and not here!
*/ */
void SCH_ITEM::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC )
{ {
SCH_SCREEN* screen = aFrame->GetScreen();
if( m_Flags & IS_NEW ) if( m_Flags & IS_NEW )
{ {
SCH_SCREEN* screen = frame->GetScreen(); if( !screen->CheckIfOnDrawList( this ) ) // don't want a loop!
if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop!
screen->AddToDrawList( this ); screen->AddToDrawList( this );
frame->SetRepeatItem( this ); aFrame->SetRepeatItem( this );
frame->SaveCopyInUndoList( this, UR_NEW ); aFrame->SaveCopyInUndoList( this, UR_NEW );
} }
m_Flags = 0; m_Flags = 0;
frame->GetScreen()->SetModify(); screen->SetModify();
frame->GetScreen()->SetCurItem( NULL ); screen->SetCurItem( NULL );
frame->DrawPanel->ManageCurseur = NULL; aFrame->DrawPanel->ManageCurseur = NULL;
frame->DrawPanel->ForceCloseManageCurseur = NULL; aFrame->DrawPanel->ForceCloseManageCurseur = NULL;
if( DC ) if( aDC )
{ {
frame->DrawPanel->CursorOff( DC ); // Erase schematic cursor aFrame->DrawPanel->CursorOff( aDC ); // Erase schematic cursor
Draw( frame->DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); Draw( aFrame->DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
frame->DrawPanel->CursorOn( DC ); // Display schematic cursor aFrame->DrawPanel->CursorOn( aDC ); // Display schematic cursor
} }
} }
......
...@@ -490,7 +490,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition ) ...@@ -490,7 +490,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, 0 ); DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, 0 );
} }
} }
......
...@@ -38,7 +38,8 @@ extern void DuplicateItemsInList( SCH_SCREEN* screen, ...@@ -38,7 +38,8 @@ extern void DuplicateItemsInList( SCH_SCREEN* screen,
PICKED_ITEMS_LIST& aItemsList, PICKED_ITEMS_LIST& aItemsList,
const wxPoint aMoveVector ); const wxPoint aMoveVector );
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase );
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to /* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
...@@ -130,7 +131,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -130,7 +131,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
SaveCopyInUndoList( block->m_ItemsSelection, UR_MOVED, block->m_MoveVector ); SaveCopyInUndoList( block->m_ItemsSelection, UR_MOVED, block->m_MoveVector );
MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector ); MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector );
...@@ -140,7 +141,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -140,7 +141,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DuplicateItemsInList( GetScreen(), block->m_ItemsSelection, block->m_MoveVector ); DuplicateItemsInList( GetScreen(), block->m_ItemsSelection, block->m_MoveVector );
...@@ -152,7 +153,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -152,7 +153,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_PASTE: case BLOCK_PASTE:
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
PasteListOfItems( DC ); PasteListOfItems( DC );
block->ClearItemsList(); block->ClearItemsList();
break; break;
...@@ -250,14 +251,14 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -250,14 +251,14 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{ {
nextcmd = true; nextcmd = true;
GetScreen()->SelectBlockItems(); GetScreen()->SelectBlockItems();
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
block->m_State = STATE_BLOCK_MOVE; block->m_State = STATE_BLOCK_MOVE;
} }
else else
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
} }
...@@ -265,7 +266,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -265,7 +266,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
GetScreen()->UpdatePickList(); GetScreen()->UpdatePickList();
DrawAndSizingBlockOutlines( DrawPanel, DC, false ); DrawAndSizingBlockOutlines( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
...@@ -280,7 +281,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -280,7 +281,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_SAVE: /* Save */ case BLOCK_SAVE: /* Save */
GetScreen()->UpdatePickList(); GetScreen()->UpdatePickList();
DrawAndSizingBlockOutlines( DrawPanel, DC, false ); DrawAndSizingBlockOutlines( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
...@@ -370,7 +371,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -370,7 +371,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_DRAG: /* move to Drag */ case BLOCK_DRAG: /* move to Drag */
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
// Clear list of items to move, and rebuild it with items to drag: // Clear list of items to move, and rebuild it with items to drag:
block->ClearItemsList(); block->ClearItemsList();
...@@ -384,7 +385,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -384,7 +385,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
GetScreen()->SelectBlockItems(); GetScreen()->SelectBlockItems();
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
block->m_State = STATE_BLOCK_MOVE; block->m_State = STATE_BLOCK_MOVE;
} }
...@@ -392,7 +393,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -392,7 +393,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_DELETE: /* move to Delete */ case BLOCK_DELETE: /* move to Delete */
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
...@@ -406,7 +407,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -406,7 +407,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_SAVE: /* Save list in paste buffer*/ case BLOCK_SAVE: /* Save list in paste buffer*/
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
...@@ -425,7 +426,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -425,7 +426,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_ROTATE: case BLOCK_ROTATE:
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
/* Compute the rotation center and put it on grid */ /* Compute the rotation center and put it on grid */
...@@ -442,7 +443,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -442,7 +443,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_MIRROR_X: case BLOCK_MIRROR_X:
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
...@@ -459,7 +460,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -459,7 +460,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_MIRROR_Y: case BLOCK_MIRROR_Y:
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() ) if( block->GetCount() )
{ {
...@@ -496,33 +497,33 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -496,33 +497,33 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
/* Traces the outline of the search block structures /* Traces the outline of the search block structures
* The entire block follows the cursor * The entire block follows the cursor
*/ */
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
BLOCK_SELECTOR* block = &panel->GetScreen()->m_BlockLocate;; BASE_SCREEN* screen = aPanel->GetScreen();
BASE_SCREEN* screen = panel->GetScreen(); BLOCK_SELECTOR* block = &screen->m_BlockLocate;;
SCH_ITEM* schitem; SCH_ITEM* schitem;
/* Erase old block contents. */ /* Erase old block contents. */
if( erase ) if( aErase )
{ {
block->Draw( panel, DC, block->m_MoveVector, g_XorMode, block->m_Color ); block->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, block->m_Color );
for( unsigned ii = 0; ii < block->GetCount(); ii++ ) for( unsigned ii = 0; ii < block->GetCount(); ii++ )
{ {
schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii ); schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii );
schitem->Draw( panel, DC, block->m_MoveVector, g_XorMode, g_GhostColor ); schitem->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, g_GhostColor );
} }
} }
/* Repaint new view. */ /* Repaint new view. */
block->m_MoveVector = screen->m_Curseur - block->m_BlockLastCursorPosition; block->m_MoveVector = screen->m_Curseur - block->m_BlockLastCursorPosition;
block->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, block->m_Color );
block->Draw( panel, DC, block->m_MoveVector, g_XorMode, block->m_Color );
for( unsigned ii = 0; ii < block->GetCount(); ii++ ) for( unsigned ii = 0; ii < block->GetCount(); ii++ )
{ {
schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii ); schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii );
schitem->Draw( panel, DC, block->m_MoveVector, g_XorMode, g_GhostColor ); schitem->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, g_GhostColor );
} }
} }
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
#include "libeditframe.h" #include "libeditframe.h"
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
/* /*
...@@ -107,12 +108,12 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -107,12 +108,12 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
nextCmd = true; nextCmd = true;
if( DrawPanel->ManageCurseur != NULL ) if( DrawPanel->ManageCurseur != NULL )
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
} }
break; break;
...@@ -184,7 +185,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -184,7 +185,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
} }
...@@ -200,12 +201,12 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -200,12 +201,12 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
*/ */
void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
{ {
bool err = FALSE; bool err = false;
wxPoint pt; wxPoint pt;
if( DrawPanel->ManageCurseur == NULL ) if( DrawPanel->ManageCurseur == NULL )
{ {
err = TRUE; err = true;
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) ); DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) );
} }
...@@ -214,7 +215,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -214,7 +215,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.m_Command )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
err = TRUE; err = true;
break; break;
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
...@@ -227,7 +228,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -227,7 +228,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
pt.y *= -1; pt.y *= -1;
if ( m_component ) if ( m_component )
m_component->MoveSelectedItems( pt ); m_component->MoveSelectedItems( pt );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
...@@ -270,7 +271,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -270,7 +271,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
} }
...@@ -280,14 +281,15 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -280,14 +281,15 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
* Traces the outline of the search block structures * Traces the outline of the search block structures
* The entire block follows the cursor * The entire block follows the cursor
*/ */
void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
BLOCK_SELECTOR* PtBlock; BLOCK_SELECTOR* PtBlock;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
wxPoint move_offset; wxPoint move_offset;
PtBlock = &screen->m_BlockLocate; PtBlock = &screen->m_BlockLocate;
LIB_EDIT_FRAME* parent = ( LIB_EDIT_FRAME* ) panel->GetParent(); LIB_EDIT_FRAME* parent = ( LIB_EDIT_FRAME* ) aPanel->GetParent();
wxASSERT( parent != NULL ); wxASSERT( parent != NULL );
LIB_COMPONENT* component = parent->GetComponent(); LIB_COMPONENT* component = parent->GetComponent();
...@@ -298,11 +300,11 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -298,11 +300,11 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
int unit = parent->GetUnit(); int unit = parent->GetUnit();
int convert = parent->GetConvert(); int convert = parent->GetConvert();
if( erase ) if( aErase )
{ {
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color ); PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
component->Draw( panel, DC, PtBlock->m_MoveVector, unit, convert, component->Draw( aPanel, aDC, PtBlock->m_MoveVector, unit, convert,
g_XorMode, -1, DefaultTransform, true, true, true ); g_XorMode, -1, DefaultTransform, true, true, true );
} }
...@@ -310,9 +312,9 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -310,9 +312,9 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
PtBlock->m_MoveVector.x = screen->m_Curseur.x - PtBlock->m_BlockLastCursorPosition.x; 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.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( aDC, g_XorMode );
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color ); PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
component->Draw( panel, DC, PtBlock->m_MoveVector, unit, convert, component->Draw( aPanel, aDC, PtBlock->m_MoveVector, unit, convert,
g_XorMode, -1, DefaultTransform, true, true, true ); g_XorMode, -1, DefaultTransform, true, true, true );
} }
...@@ -73,7 +73,8 @@ static void RestoreOldWires( SCH_SCREEN* screen ) ...@@ -73,7 +73,8 @@ static void RestoreOldWires( SCH_SCREEN* screen )
/** /**
* Mouse capture callback for drawing line segments. * Mouse capture callback for drawing line segments.
*/ */
static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, bool aErase ) static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
SCH_LINE* CurrentLine = (SCH_LINE*) aPanel->GetScreen()->GetCurItem(); SCH_LINE* CurrentLine = (SCH_LINE*) aPanel->GetScreen()->GetCurItem();
SCH_LINE* segment; SCH_LINE* segment;
...@@ -149,7 +150,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) ...@@ -149,7 +150,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
if( !newsegment ) /* first point : Create first wire or bus */ if( !newsegment ) /* first point : Create first wire or bus */
{ {
s_ConnexionStartPoint = cursorpos; s_ConnexionStartPoint = cursorpos;
s_OldWiresList = GetScreen()->ExtractWires( TRUE ); s_OldWiresList = GetScreen()->ExtractWires( true );
GetScreen()->SchematicCleanUp( DrawPanel ); GetScreen()->SchematicCleanUp( DrawPanel );
switch( type ) switch( type )
...@@ -203,7 +204,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) ...@@ -203,7 +204,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
return; return;
} }
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
/* Creates the new segment, or terminates the command /* Creates the new segment, or terminates the command
* if the end point is on a pin, junction or an other wire or bus */ * if the end point is on a pin, junction or an other wire or bus */
...@@ -239,7 +240,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type ) ...@@ -239,7 +240,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
oldsegment->m_Flags = SELECTED; oldsegment->m_Flags = SELECTED;
newsegment->m_Flags = IS_NEW; newsegment->m_Flags = IS_NEW;
GetScreen()->SetCurItem( newsegment ); GetScreen()->SetCurItem( newsegment );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
/* This is the first segment: Now we know the start segment position. /* This is the first segment: Now we know the start segment position.
* Create a junction if needed. Note: a junction can be needed later, * Create a junction if needed. Note: a junction can be needed later,
...@@ -479,11 +480,11 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC ) ...@@ -479,11 +480,11 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
/* Cancel trace in progress */ /* Cancel trace in progress */
if( GetScreen()->GetCurItem()->Type() == SCH_POLYLINE_T ) if( GetScreen()->GetCurItem()->Type() == SCH_POLYLINE_T )
{ {
Show_Polyline_in_Ghost( DrawPanel, DC, FALSE ); Show_Polyline_in_Ghost( DrawPanel, DC, false );
} }
else else
{ {
DrawSegment( DrawPanel, DC, FALSE ); DrawSegment( DrawPanel, DC, wxDefaultPosition, false );
} }
EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), GetScreen() ); EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), GetScreen() );
...@@ -519,17 +520,16 @@ SCH_JUNCTION* SCH_EDIT_FRAME::CreateNewJunctionStruct( wxDC* DC, ...@@ -519,17 +520,16 @@ SCH_JUNCTION* SCH_EDIT_FRAME::CreateNewJunctionStruct( wxDC* DC,
} }
/* Routine to create new NoConnect struct. */ SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPosition )
SCH_NO_CONNECT* SCH_EDIT_FRAME::CreateNewNoConnectStruct( wxDC* DC )
{ {
SCH_NO_CONNECT* NewNoConnect; SCH_NO_CONNECT* NewNoConnect;
NewNoConnect = new SCH_NO_CONNECT( GetScreen()->m_Curseur ); NewNoConnect = new SCH_NO_CONNECT( aPosition );
m_itemToRepeat = NewNoConnect; m_itemToRepeat = NewNoConnect;
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CursorOff( aDC ); // Erase schematic cursor
NewNoConnect->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); NewNoConnect->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // Display schematic cursor DrawPanel->CursorOn( aDC ); // Display schematic cursor
NewNoConnect->SetNext( GetScreen()->GetDrawItems() ); NewNoConnect->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( NewNoConnect ); GetScreen()->SetDrawItems( NewNoConnect );
...@@ -645,7 +645,7 @@ void IncrementLabelMember( wxString& name ) ...@@ -645,7 +645,7 @@ void IncrementLabelMember( wxString& name )
} }
/* Return TRUE if pos can be a terminal point for a wire or a bus /* Return true if pos can be a terminal point for a wire or a bus
* i.e. : * i.e. :
* for a WIRE, if at pos is found: * for a WIRE, if at pos is found:
* - a junction * - a junction
...@@ -669,7 +669,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -669,7 +669,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
item = PickStruct( pos, screen, BUS_T ); item = PickStruct( pos, screen, BUS_T );
if( item ) if( item )
return TRUE; return true;
pinsheet = screen->GetSheetLabel( pos ); pinsheet = screen->GetSheetLabel( pos );
...@@ -678,21 +678,21 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -678,21 +678,21 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
itempos = pinsheet->m_Pos; itempos = pinsheet->m_Pos;
if( (itempos.x == pos.x) && (itempos.y == pos.y) ) if( (itempos.x == pos.x) && (itempos.y == pos.y) )
return TRUE; return true;
} }
break; break;
case LAYER_NOTES: case LAYER_NOTES:
item = PickStruct( pos, screen, DRAW_ITEM_T ); item = PickStruct( pos, screen, DRAW_ITEM_T );
if( item ) if( item )
return TRUE; return true;
break; break;
case LAYER_WIRE: case LAYER_WIRE:
item = PickStruct( pos, screen, BUS_ENTRY_T | JUNCTION_T ); item = PickStruct( pos, screen, BUS_ENTRY_T | JUNCTION_T );
if( item ) if( item )
return TRUE; return true;
pin = screen->GetPin( pos, &LibItem ); pin = screen->GetPin( pos, &LibItem );
...@@ -705,19 +705,19 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -705,19 +705,19 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
itempos.y += LibItem->m_Pos.y; itempos.y += LibItem->m_Pos.y;
if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) ) if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) )
return TRUE; return true;
} }
item = PickStruct( pos, screen, WIRE_T ); item = PickStruct( pos, screen, WIRE_T );
if( item ) if( item )
return TRUE; return true;
item = PickStruct( pos, screen, LABEL_T ); item = PickStruct( pos, screen, LABEL_T );
if( item && (item->Type() != SCH_TEXT_T) if( item && (item->Type() != SCH_TEXT_T)
&& ( ( (SCH_GLOBALLABEL*) item )->m_Pos.x == pos.x ) && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.x == pos.x )
&& ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) ) && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) )
return TRUE; return true;
pinsheet = screen->GetSheetLabel( pos ); pinsheet = screen->GetSheetLabel( pos );
...@@ -726,7 +726,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -726,7 +726,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
itempos = pinsheet->m_Pos; itempos = pinsheet->m_Pos;
if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) ) if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) )
return TRUE; return true;
} }
break; break;
...@@ -735,7 +735,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -735,7 +735,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
break; break;
} }
return FALSE; return false;
} }
...@@ -750,16 +750,16 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -750,16 +750,16 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
bool IsJunctionNeeded( SCH_EDIT_FRAME* frame, wxPoint& pos ) bool IsJunctionNeeded( SCH_EDIT_FRAME* frame, wxPoint& pos )
{ {
if( PickStruct( pos, frame->GetScreen(), JUNCTION_T ) ) if( PickStruct( pos, frame->GetScreen(), JUNCTION_T ) )
return FALSE; return false;
if( PickStruct( pos, frame->GetScreen(), WIRE_T | EXCLUDE_ENDPOINTS_T ) ) if( PickStruct( pos, frame->GetScreen(), WIRE_T | EXCLUDE_ENDPOINTS_T ) )
{ {
if( PickStruct( pos, frame->GetScreen(), WIRE_T | ENDPOINTS_ONLY_T ) ) if( PickStruct( pos, frame->GetScreen(), WIRE_T | ENDPOINTS_ONLY_T ) )
return TRUE; return true;
if( frame->GetScreen()->GetPin( pos, NULL, true ) ) if( frame->GetScreen()->GetPin( pos, NULL, true ) )
return TRUE; return true;
} }
return FALSE; return false;
} }
...@@ -50,22 +50,23 @@ static void ExitBusEntry( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -50,22 +50,23 @@ static void ExitBusEntry( EDA_DRAW_PANEL* Panel, wxDC* DC )
} }
static void ShowWhileMoving( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
// Draws the bus entry while moving the cursor // Draws the bus entry while moving the cursor
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) screen->GetCurItem(); SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) screen->GetCurItem();
if( BusEntry == NULL ) if( BusEntry == NULL )
return; return;
/* Erase the last segment position. */ /* Erase the last segment position. */
if( erase ) if( aErase )
BusEntry->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode ); BusEntry->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
/* Redraw at the new position. */ /* Redraw at the new position. */
BusEntry->m_Pos = screen->m_Curseur; BusEntry->m_Pos = screen->m_Curseur;
BusEntry->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode ); BusEntry->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
} }
......
...@@ -290,7 +290,7 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) ...@@ -290,7 +290,7 @@ void SCH_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, TRUE );
} }
} }
...@@ -372,7 +372,7 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) ...@@ -372,7 +372,7 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, TRUE );
} }
} }
...@@ -453,7 +453,7 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) ...@@ -453,7 +453,7 @@ void LIB_VIEW_FRAME::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, TRUE );
} }
} }
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
static void AbortMoveCmpField( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void AbortMoveCmpField( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void MoveCmpField( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void MoveCmpField( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
/******************************************************************************/ /******************************************************************************/
...@@ -178,12 +179,13 @@ modified!\nYou must create a new power" ) ); ...@@ -178,12 +179,13 @@ modified!\nYou must create a new power" ) );
/* /*
* Move standard text field. This routine is normally attached to the cursor. * Move standard text field. This routine is normally attached to the cursor.
*/ */
static void MoveCmpField( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void MoveCmpField( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
wxPoint pos; wxPoint pos;
int fieldNdx; int fieldNdx;
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) panel->GetParent(); SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
SCH_FIELD* currentField = frame->GetCurrentField(); SCH_FIELD* currentField = frame->GetCurrentField();
if( currentField == NULL ) if( currentField == NULL )
...@@ -193,9 +195,10 @@ static void MoveCmpField( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -193,9 +195,10 @@ static void MoveCmpField( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
fieldNdx = currentField->m_FieldId; fieldNdx = currentField->m_FieldId;
currentField->m_AddExtraText = frame->m_Multiflag; currentField->m_AddExtraText = frame->m_Multiflag;
if( erase )
if( aErase )
{ {
currentField->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode ); currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
} }
pos = ( (SCH_COMPONENT*) currentField->GetParent() )->m_Pos; pos = ( (SCH_COMPONENT*) currentField->GetParent() )->m_Pos;
...@@ -204,12 +207,12 @@ static void MoveCmpField( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -204,12 +207,12 @@ static void MoveCmpField( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
// But here we want the relative position of the moved field // But here we want the relative position of the moved field
// and we know the actual position. // and we know the actual position.
// So we are using the inverse rotation/mirror transform. // So we are using the inverse rotation/mirror transform.
wxPoint pt( panel->GetScreen()->m_Curseur - pos ); wxPoint pt( aPanel->GetScreen()->m_Curseur - pos );
TRANSFORM itrsfm = component->GetTransform().InverseTransform(); TRANSFORM itrsfm = component->GetTransform().InverseTransform();
currentField->m_Pos = pos + itrsfm.TransformCoordinate( pt ); currentField->m_Pos = pos + itrsfm.TransformCoordinate( pt );
currentField->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode ); currentField->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
} }
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
#include "sch_text.h" #include "sch_text.h"
static void ShowWhileMoving( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
static void ExitMoveTexte( EDA_DRAW_PANEL* panel, wxDC* DC ); static void ExitMoveTexte( EDA_DRAW_PANEL* panel, wxDC* DC );
...@@ -69,7 +70,7 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ) ...@@ -69,7 +70,7 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte; DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
GetScreen()->SetCurItem( TextStruct ); GetScreen()->SetCurItem( TextStruct );
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
} }
...@@ -184,13 +185,14 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type ) ...@@ -184,13 +185,14 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
/************************************/ /************************************/
/* Redraw a Text while moving */ /* Redraw a Text while moving */
/************************************/ /************************************/
static void ShowWhileMoving( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
SCH_ITEM* TextStruct = (SCH_ITEM*) panel->GetScreen()->GetCurItem(); SCH_ITEM* TextStruct = (SCH_ITEM*) aPanel->GetScreen()->GetCurItem();
/* "Undraw" the current text at its old position*/ /* "Undraw" the current text at its old position*/
if( erase ) if( aErase )
TextStruct->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode ); TextStruct->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
/* redraw the text */ /* redraw the text */
switch( TextStruct->Type() ) switch( TextStruct->Type() )
...@@ -199,14 +201,14 @@ static void ShowWhileMoving( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -199,14 +201,14 @@ static void ShowWhileMoving( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
case SCH_GLOBAL_LABEL_T: case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T:
case SCH_TEXT_T: case SCH_TEXT_T:
( (SCH_TEXT*) TextStruct )->m_Pos = panel->GetScreen()->m_Curseur; ( (SCH_TEXT*) TextStruct )->m_Pos = aPanel->GetScreen()->m_Curseur;
break; break;
default: default:
break; break;
} }
TextStruct->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode ); TextStruct->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
} }
......
...@@ -59,7 +59,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -59,7 +59,7 @@ void SCH_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->ClrRefreshReq(); GetScreen()->ClrRefreshReq();
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->DrawCursor( DC ); DrawPanel->DrawCursor( DC );
......
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
static void ShowWhileMoving( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
static void ExitPlaceCmp( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void ExitPlaceCmp( EDA_DRAW_PANEL* Panel, wxDC* DC );
static TRANSFORM OldTransform; static TRANSFORM OldTransform;
...@@ -221,22 +222,21 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC, ...@@ -221,22 +222,21 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
/** /**
* Move a component. * Move a component.
*/ */
static void ShowWhileMoving( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void ShowWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
wxPoint move_vector; wxPoint move_vector;
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
SCH_COMPONENT* Component = (SCH_COMPONENT*) screen->GetCurItem(); SCH_COMPONENT* Component = (SCH_COMPONENT*) screen->GetCurItem();
if( erase ) if( aErase )
{ {
Component->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); Component->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
} }
move_vector = screen->m_Curseur - Component->m_Pos; move_vector = screen->m_Curseur - Component->m_Pos;
Component->Move( move_vector ); Component->Move( move_vector );
Component->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); Component->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
} }
......
...@@ -217,7 +217,7 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -217,7 +217,7 @@ void LIB_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->ClrRefreshReq(); GetScreen()->ClrRefreshReq();
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->DrawCursor( DC ); DrawPanel->DrawCursor( DC );
......
...@@ -29,10 +29,11 @@ static wxArrayString s_PowerNameList; ...@@ -29,10 +29,11 @@ static wxArrayString s_PowerNameList;
void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{ {
SCH_ITEM* item = GetScreen()->GetCurItem(); SCH_ITEM* item = GetScreen()->GetCurItem();
wxPoint gridPosition = GetGridPosition( aPosition );
if( ( m_ID_current_state == 0 ) || ( item && item->m_Flags ) ) if( ( m_ID_current_state == 0 ) || ( item && item->m_Flags ) )
{ {
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = false;
m_itemToRepeat = NULL; m_itemToRepeat = NULL;
if( item && item->m_Flags ) if( item && item->m_Flags )
...@@ -52,7 +53,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -52,7 +53,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
item->Place( this, aDC ); item->Place( this, aDC );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
return; return;
case SCH_SCREEN_T: case SCH_SCREEN_T:
...@@ -103,35 +104,35 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -103,35 +104,35 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_NOCONN_BUTT: case ID_NOCONN_BUTT:
if( ( item == NULL ) || ( item->m_Flags == 0 ) ) if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{ {
m_itemToRepeat = CreateNewNoConnectStruct( aDC ); m_itemToRepeat = AddNoConnect( aDC, gridPosition );
GetScreen()->SetCurItem( m_itemToRepeat ); GetScreen()->SetCurItem( m_itemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
} }
else else
{ {
item->Place( this, aDC ); item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = false;
} }
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case ID_JUNCTION_BUTT: case ID_JUNCTION_BUTT:
if( ( item == NULL ) || ( item->m_Flags == 0 ) ) if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{ {
m_itemToRepeat = CreateNewJunctionStruct( aDC, GetScreen()->m_Curseur, TRUE ); m_itemToRepeat = CreateNewJunctionStruct( aDC, GetScreen()->m_Curseur, true );
GetScreen()->SetCurItem( m_itemToRepeat ); GetScreen()->SetCurItem( m_itemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
} }
else else
{ {
item->Place( this, aDC ); item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = false;
} }
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case ID_WIRETOBUS_ENTRY_BUTT: case ID_WIRETOBUS_ENTRY_BUTT:
...@@ -141,7 +142,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -141,7 +142,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
item = CreateBusEntry( aDC, ( m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT ) ? item = CreateBusEntry( aDC, ( m_ID_current_state == ID_WIRETOBUS_ENTRY_BUTT ) ?
WIRE_TO_BUS : BUS_TO_BUS ); WIRE_TO_BUS : BUS_TO_BUS );
GetScreen()->SetCurItem( item ); GetScreen()->SetCurItem( item );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
} }
else else
{ {
...@@ -149,7 +150,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -149,7 +150,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( true ); DrawPanel->Refresh( true );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = false;
} }
break; break;
...@@ -158,34 +159,34 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -158,34 +159,34 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
OnModify(); OnModify();
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
break; break;
case ID_WIRE_BUTT: case ID_WIRE_BUTT:
BeginSegment( aDC, LAYER_WIRE ); BeginSegment( aDC, LAYER_WIRE );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
break; break;
case ID_BUS_BUTT: case ID_BUS_BUTT:
BeginSegment( aDC, LAYER_BUS ); BeginSegment( aDC, LAYER_BUS );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
break; break;
case ID_LINE_COMMENT_BUTT: case ID_LINE_COMMENT_BUTT:
BeginSegment( aDC, LAYER_NOTES ); BeginSegment( aDC, LAYER_NOTES );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
break; break;
case ID_TEXT_COMMENT_BUTT: case ID_TEXT_COMMENT_BUTT:
if( ( item == NULL ) || ( item->m_Flags == 0 ) ) if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{ {
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_NOTES ) ); GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_NOTES ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
} }
else else
{ {
item->Place( this, aDC ); item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = false;
} }
break; break;
...@@ -193,14 +194,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -193,14 +194,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( ( item == NULL ) || ( item->m_Flags == 0 ) ) if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{ {
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_LOCLABEL ) ); GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_LOCLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
} }
else else
{ {
item->Place( this, aDC ); item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
} }
break; break;
...@@ -214,14 +215,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -214,14 +215,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if(m_ID_current_state == ID_HIERLABEL_BUTT) if(m_ID_current_state == ID_HIERLABEL_BUTT)
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) ); GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
} }
else else
{ {
item->Place( this, aDC ); item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
} }
break; break;
...@@ -229,14 +230,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -229,14 +230,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( ( item == NULL ) || ( item->m_Flags == 0 ) ) if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{ {
GetScreen()->SetCurItem( CreateSheet( aDC ) ); GetScreen()->SetCurItem( CreateSheet( aDC ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
} }
else else
{ {
item->Place( this, aDC ); item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
} }
break; break;
...@@ -259,22 +260,22 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -259,22 +260,22 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{ {
item->Place( this, aDC ); item->Place( this, aDC );
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
} }
break; break;
case ID_COMPONENT_BUTT: case ID_COMPONENT_BUTT:
if( (item == NULL) || (item->m_Flags == 0) ) if( (item == NULL) || (item->m_Flags == 0) )
{ {
GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, TRUE ) ); GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, true ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
} }
else else
{ {
item->Place( this, aDC ); item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
} }
break; break;
...@@ -282,15 +283,15 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -282,15 +283,15 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( ( item == NULL ) || ( item->m_Flags == 0 ) ) if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{ {
GetScreen()->SetCurItem( Load_Component( aDC, wxT( "power" ), GetScreen()->SetCurItem( Load_Component( aDC, wxT( "power" ),
s_PowerNameList, FALSE ) ); s_PowerNameList, false ) );
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = true;
} }
else else
{ {
item->Place( this, aDC ); item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = false;
GetScreen()->TestDanglingEnds(); GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( true );
} }
break; break;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, bool asDeMorgan ); static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, bool asDeMorgan );
static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void AbortPinMove( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void DrawMovePin( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositon, bool aErase );
static wxPoint OldPos; static wxPoint OldPos;
...@@ -336,9 +336,10 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC ) ...@@ -336,9 +336,10 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
/* Move pin to the current mouse position. This function is called by the /* Move pin to the current mouse position. This function is called by the
* cursor management code. */ * cursor management code. */
static void DrawMovePin( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
LIB_EDIT_FRAME* parent = (LIB_EDIT_FRAME*) panel->GetParent(); LIB_EDIT_FRAME* parent = (LIB_EDIT_FRAME*) aPanel->GetParent();
if( parent == NULL ) if( parent == NULL )
return; return;
...@@ -352,16 +353,16 @@ static void DrawMovePin( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -352,16 +353,16 @@ static void DrawMovePin( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
bool showPinText = true; bool showPinText = true;
/* Erase pin in old position */ /* Erase pin in old position */
if( erase ) if( aErase )
{ {
CurrentPin->SetPosition( PinPreviousPos ); CurrentPin->SetPosition( PinPreviousPos );
CurrentPin->Draw( panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), -1, g_XorMode,
&showPinText, DefaultTransform ); &showPinText, DefaultTransform );
} }
/* Redraw pin in new position */ /* Redraw pin in new position */
CurrentPin->SetPosition( panel->GetScreen()->GetCursorDrawPosition() ); CurrentPin->SetPosition( aPanel->GetScreen()->GetCursorDrawPosition() );
CurrentPin->Draw( panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform ); CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform );
PinPreviousPos = CurrentPin->GetPosition(); PinPreviousPos = CurrentPin->GetPosition();
......
...@@ -221,7 +221,8 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -221,7 +221,8 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
/* Move selected sheet with the cursor. /* Move selected sheet with the cursor.
* Callback function use by ManageCurseur. * Callback function use by ManageCurseur.
*/ */
static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, bool aErase ) static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
wxPoint moveVector; wxPoint moveVector;
BASE_SCREEN* screen = aPanel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
...@@ -264,7 +265,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) ...@@ -264,7 +265,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{ {
wxPoint curspos = screen->m_Curseur; wxPoint curspos = screen->m_Curseur;
aPanel->GetScreen()->m_Curseur = s_OldPos; aPanel->GetScreen()->m_Curseur = s_OldPos;
MoveOrResizeSheet( aPanel, aDC, true ); MoveOrResizeSheet( aPanel, aDC, wxDefaultPosition, true );
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE ); sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
sheet->m_Flags = 0; sheet->m_Flags = 0;
screen->m_Curseur = curspos; screen->m_Curseur = curspos;
...@@ -307,8 +308,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC ) ...@@ -307,8 +308,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
DrawPanel->ManageCurseur = MoveOrResizeSheet; DrawPanel->ManageCurseur = MoveOrResizeSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, aDC, wxDefaultPosition, false );
DrawPanel->ManageCurseur( DrawPanel, aDC, false );
return sheet; return sheet;
} }
...@@ -343,7 +343,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -343,7 +343,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
DrawPanel->ManageCurseur = MoveOrResizeSheet; DrawPanel->ManageCurseur = MoveOrResizeSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, aDC, true ); DrawPanel->ManageCurseur( DrawPanel, aDC, wxDefaultPosition, true );
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo
{ {
...@@ -366,7 +366,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC ) ...@@ -366,7 +366,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
aSheet->m_Flags |= IS_MOVED; aSheet->m_Flags |= IS_MOVED;
DrawPanel->ManageCurseur = MoveOrResizeSheet; DrawPanel->ManageCurseur = MoveOrResizeSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, aDC, true ); DrawPanel->ManageCurseur( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->CursorOn( aDC ); DrawPanel->CursorOn( aDC );
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
static void ExitPinSheet( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void ExitPinSheet( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Move_PinSheet( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void Move_PinSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
static int s_CurrentTypeLabel = NET_INPUT; static int s_CurrentTypeLabel = NET_INPUT;
...@@ -103,23 +104,24 @@ void SCH_EDIT_FRAME::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC ) ...@@ -103,23 +104,24 @@ void SCH_EDIT_FRAME::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC )
DrawPanel->ManageCurseur = Move_PinSheet; DrawPanel->ManageCurseur = Move_PinSheet;
DrawPanel->ForceCloseManageCurseur = ExitPinSheet; DrawPanel->ForceCloseManageCurseur = ExitPinSheet;
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
} }
static void Move_PinSheet( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void Move_PinSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
SCH_SHEET_PIN* SheetLabel = (SCH_SHEET_PIN*) panel->GetScreen()->GetCurItem(); SCH_SHEET_PIN* SheetLabel = (SCH_SHEET_PIN*) aPanel->GetScreen()->GetCurItem();
if( SheetLabel == NULL ) if( SheetLabel == NULL )
return; return;
if( erase ) if( aErase )
SheetLabel->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode ); SheetLabel->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
SheetLabel->ConstraintOnEdge( panel->GetScreen()->m_Curseur ); SheetLabel->ConstraintOnEdge( aPanel->GetScreen()->m_Curseur );
SheetLabel->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode ); SheetLabel->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
} }
...@@ -189,7 +191,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::Create_PinSheet( SCH_SHEET* Sheet, wxDC* DC ) ...@@ -189,7 +191,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::Create_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
DrawPanel->ManageCurseur = Move_PinSheet; DrawPanel->ManageCurseur = Move_PinSheet;
DrawPanel->ForceCloseManageCurseur = ExitPinSheet; DrawPanel->ForceCloseManageCurseur = ExitPinSheet;
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
OnModify(); OnModify();
return NewSheetLabel; return NewSheetLabel;
...@@ -243,7 +245,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC ) ...@@ -243,7 +245,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
GetScreen()->SetCurItem( NewSheetLabel ); GetScreen()->SetCurItem( NewSheetLabel );
DrawPanel->ManageCurseur = Move_PinSheet; DrawPanel->ManageCurseur = Move_PinSheet;
DrawPanel->ForceCloseManageCurseur = ExitPinSheet; DrawPanel->ForceCloseManageCurseur = ExitPinSheet;
Move_PinSheet( DrawPanel, DC, FALSE ); Move_PinSheet( DrawPanel, DC, wxDefaultPosition, false );
return NewSheetLabel; return NewSheetLabel;
} }
......
...@@ -23,8 +23,10 @@ ...@@ -23,8 +23,10 @@
#include "dialogs/dialog_lib_edit_draw_item.h" #include "dialogs/dialog_lib_edit_draw_item.h"
static void SymbolDisplayDraw( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); bool aErase );
static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
/* /*
...@@ -192,7 +194,7 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* ...@@ -192,7 +194,7 @@ LIB_DRAW_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC*
m_drawItem->SetConvert( m_convert ); m_drawItem->SetConvert( m_convert );
// Draw initial symbol: // Draw initial symbol:
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
} }
else else
{ {
...@@ -230,28 +232,30 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC ) ...@@ -230,28 +232,30 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC )
/* /*
* Redraw the graphic shape while moving * Redraw the graphic shape while moving
*/ */
static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
LIB_DRAW_ITEM* item; LIB_DRAW_ITEM* item;
item = ( (LIB_EDIT_FRAME*) panel->GetParent() )->GetDrawItem(); item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
if( item == NULL ) if( item == NULL )
return; return;
BASE_SCREEN* Screen = panel->GetScreen(); BASE_SCREEN* Screen = aPanel->GetScreen();
item->SetEraseLastDrawItem( aErase );
item->SetEraseLastDrawItem( erase );
// if item is the reference field, we must add the current unit id // if item is the reference field, we must add the current unit id
if( item->Type() == LIB_FIELD_T ) if( item->Type() == LIB_FIELD_T )
{ {
int unit = ((LIB_EDIT_FRAME*)panel->GetParent())->GetUnit(); int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit();
wxString text = ((LIB_FIELD*)item)->GetFullText( unit ); wxString text = ((LIB_FIELD*)item)->GetFullText( unit );
item->Draw( panel, DC, Screen->GetCursorDrawPosition(), -1, g_XorMode, &text, item->Draw( aPanel, aDC, Screen->GetCursorDrawPosition(), -1, g_XorMode, &text,
DefaultTransform ); DefaultTransform );
} }
else else
item->Draw( panel, DC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL, item->Draw( aPanel, aDC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL,
DefaultTransform ); DefaultTransform );
} }
...@@ -267,7 +271,7 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC ) ...@@ -267,7 +271,7 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC )
m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCursorDrawPosition() ); m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCursorDrawPosition() );
DrawPanel->ManageCurseur = RedrawWhileMovingCursor; DrawPanel->ManageCurseur = RedrawWhileMovingCursor;
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn; DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn;
DrawPanel->ManageCurseur( DrawPanel, DC, true ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
} }
...@@ -281,21 +285,22 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC ) ...@@ -281,21 +285,22 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC )
m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCursorDrawPosition() ); m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCursorDrawPosition() );
DrawPanel->ManageCurseur = SymbolDisplayDraw; DrawPanel->ManageCurseur = SymbolDisplayDraw;
DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn; DrawPanel->ForceCloseManageCurseur = AbortSymbolTraceOn;
DrawPanel->ManageCurseur( DrawPanel, DC, true ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
} }
//! @brief Manage mouse events when creating new graphic object or modifying an graphic object. //! @brief Manage mouse events when creating new graphic object or modifying an graphic object.
static void SymbolDisplayDraw( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
BASE_SCREEN* Screen = panel->GetScreen(); BASE_SCREEN* Screen = aPanel->GetScreen();
LIB_DRAW_ITEM* item = ( (LIB_EDIT_FRAME*) panel->GetParent() )->GetDrawItem(); LIB_DRAW_ITEM* item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
if( item == NULL ) if( item == NULL )
return; return;
item->SetEraseLastDrawItem( erase ); item->SetEraseLastDrawItem( aErase );
item->Draw( panel, DC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL, item->Draw( aPanel, aDC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL,
DefaultTransform ); DefaultTransform );
} }
......
...@@ -153,8 +153,8 @@ int TEMPLATES::AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName ) ...@@ -153,8 +153,8 @@ int TEMPLATES::AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName )
{ {
if( m_Fields[i].m_Name == aFieldName.m_Name ) if( m_Fields[i].m_Name == aFieldName.m_Name )
{ {
// D(printf("inserting template fieldname:'%s' at %d\n", D( printf( "inserting template fieldname:'%s' at %d\n",
// aFieldName.m_Name.utf8_str(), i );) CONV_TO_UTF8( aFieldName.m_Name ), i ); )
m_Fields[i] = aFieldName; m_Fields[i] = aFieldName;
return i; // return the container index return i; // return the container index
......
...@@ -41,7 +41,8 @@ ...@@ -41,7 +41,8 @@
#define BLOCK_COLOR BROWN #define BLOCK_COLOR BROWN
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool erase );
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to /* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
* the key (ALT, SHIFT ALT ..) * the key (ALT, SHIFT ALT ..)
...@@ -106,14 +107,14 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC ) ...@@ -106,14 +107,14 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
Block_Move( DC ); Block_Move( DC );
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
Block_Duplicate( DC ); Block_Duplicate( DC );
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
...@@ -180,14 +181,14 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC ) ...@@ -180,14 +181,14 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list */ case BLOCK_PRESELECT_MOVE: /* Move with preselection list */
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
nextcmd = true; nextcmd = true;
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
Block_Delete( DC ); Block_Delete( DC );
break; break;
...@@ -228,29 +229,29 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC ) ...@@ -228,29 +229,29 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
/* Traces the outline of the block structures of a repositioning move /* Traces the outline of the block structures of a repositioning move
*/ */
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositon,
bool aErase )
{ {
int Color; int Color;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
Color = YELLOW; Color = YELLOW;
if( erase ) if( aErase )
{ {
screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color );
Color );
if( screen->m_BlockLocate.m_MoveVector.x if( screen->m_BlockLocate.m_MoveVector.x|| screen->m_BlockLocate.m_MoveVector.y )
|| screen->m_BlockLocate.m_MoveVector.y )
{ {
screen->m_BlockLocate.Draw( panel, screen->m_BlockLocate.Draw( aPanel,
DC, aDC,
screen->m_BlockLocate.m_MoveVector, screen->m_BlockLocate.m_MoveVector,
g_XorMode, g_XorMode,
Color ); Color );
} }
} }
if( panel->GetScreen()->m_BlockLocate.m_State != STATE_BLOCK_STOP ) if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP )
{ {
screen->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x - screen->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x -
screen->m_BlockLocate.GetRight(); screen->m_BlockLocate.GetRight();
...@@ -258,12 +259,12 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ...@@ -258,12 +259,12 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase
screen->m_BlockLocate.GetBottom(); screen->m_BlockLocate.GetBottom();
} }
screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, Color ); screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color );
if( screen->m_BlockLocate.m_MoveVector.x
|| screen->m_BlockLocate.m_MoveVector.y ) if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
{ {
screen->m_BlockLocate.Draw( panel, screen->m_BlockLocate.Draw( aPanel,
DC, aDC,
screen->m_BlockLocate.m_MoveVector, screen->m_BlockLocate.m_MoveVector,
g_XorMode, g_XorMode,
Color ); Color );
......
...@@ -83,7 +83,7 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) ...@@ -83,7 +83,7 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, true );
} }
} }
......
...@@ -101,8 +101,8 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -101,8 +101,8 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
wxPoint( 0, 0 ) ); wxPoint( 0, 0 ) );
// Draw the "background" now, i.e. grid and axis after gerber layers // Draw the "background" now, i.e. grid and axis after gerber layers
// because most of time the actual background is erased by succesive drawings of each gerber layer // because most of time the actual background is erased by succesive drawings of each gerber
// mainly in COPY mode // layer mainly in COPY mode
DrawPanel->DrawBackGround( DC ); DrawPanel->DrawBackGround( DC );
if( IsElementVisible( DCODES_VISIBLE ) ) if( IsElementVisible( DCODES_VISIBLE ) )
...@@ -111,7 +111,7 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -111,7 +111,7 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
TraceWorkSheet( DC, screen, 0 ); TraceWorkSheet( DC, screen, 0 );
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->DrawCursor( DC ); DrawPanel->DrawCursor( DC );
......
...@@ -144,7 +144,8 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC ); ...@@ -144,7 +144,8 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC );
* by InitBlockLocateDatas(). * by InitBlockLocateDatas().
* The other point of the rectangle is the mouse cursor * The other point of the rectangle is the mouse cursor
*/ */
void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
#endif /* __INCLUDE__BLOCK_COMMANDE_H__ */ #endif /* __INCLUDE__BLOCK_COMMANDE_H__ */
...@@ -71,10 +71,11 @@ public: ...@@ -71,10 +71,11 @@ public:
/* Cursor management (used in editing functions) */ /* Cursor management (used in editing functions) */
/* Mouse capture move callback function prototype. */ /* Mouse capture move callback function prototype. */
void (*ManageCurseur)( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); void (*ManageCurseur)( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
/* Abort managed cursor callback function prototype. */ /* Abort managed cursor callback function prototype. */
void (*ForceCloseManageCurseur)( EDA_DRAW_PANEL* panel, wxDC* DC ); void (*ForceCloseManageCurseur)( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
public: public:
......
...@@ -76,7 +76,6 @@ private: ...@@ -76,7 +76,6 @@ private:
wxString m_DefaultSchematicFileName; wxString m_DefaultSchematicFileName;
SCH_FIELD* m_CurrentField; SCH_FIELD* m_CurrentField;
int m_TextFieldSize; int m_TextFieldSize;
bool m_ShowGrid;
PARAM_CFG_ARRAY m_projectFileParams; PARAM_CFG_ARRAY m_projectFileParams;
PARAM_CFG_ARRAY m_configSettings; PARAM_CFG_ARRAY m_configSettings;
wxPageSetupDialogData m_pageSetupData; wxPageSetupDialogData m_pageSetupData;
...@@ -448,8 +447,14 @@ private: ...@@ -448,8 +447,14 @@ private:
void StartMoveBusEntry( SCH_BUS_ENTRY* DrawLibItem, void StartMoveBusEntry( SCH_BUS_ENTRY* DrawLibItem,
wxDC* DC ); wxDC* DC );
// NoConnect /**
SCH_NO_CONNECT* CreateNewNoConnectStruct( wxDC* DC ); * Function AddNoConnect
* add a no connect item to the current schematic sheet at \a aPosition.
* @param aDC The device context to draw the no connect to.
* @param aPosition The position in logical (drawing) units to add the no connect.
* @return The no connect item added.
*/
SCH_NO_CONNECT* AddNoConnect( wxDC* aDC, const wxPoint& aPosition );
// Junction // Junction
SCH_JUNCTION* CreateNewJunctionStruct( wxDC* DC, SCH_JUNCTION* CreateNewJunctionStruct( wxDC* DC,
......
...@@ -243,6 +243,7 @@ protected: ...@@ -243,6 +243,7 @@ protected:
private: private:
BASE_SCREEN* m_CurrentScreen; ///< current used SCREEN BASE_SCREEN* m_CurrentScreen; ///< current used SCREEN
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
protected: protected:
void SetBaseScreen( BASE_SCREEN* aScreen ) void SetBaseScreen( BASE_SCREEN* aScreen )
...@@ -284,6 +285,7 @@ public: ...@@ -284,6 +285,7 @@ public:
void EraseMsgBox(); void EraseMsgBox();
void Process_PageSettings( wxCommandEvent& event ); void Process_PageSettings( wxCommandEvent& event );
virtual void SetToolbars(); virtual void SetToolbars();
/** /**
* Function SetLanguage * Function SetLanguage
* called on a language menu selection * called on a language menu selection
...@@ -352,6 +354,15 @@ public: ...@@ -352,6 +354,15 @@ public:
m_GridColor = aColor; m_GridColor = aColor;
} }
/**
* Function GetGridPosition
* returns the nearest grid position to \a aPosition if a screen is defined and snap to
* grid is enabled. Otherwise, the origianl positions is returned.
* @see m_snapToGrid and m_BaseScreen members.
* @param aPosition The position to test.
* @return The wxPoint of the appropriate cursor position.
*/
wxPoint GetGridPosition( const wxPoint& aPosition );
/** /**
* Command event handler for selecting grid sizes. * Command event handler for selecting grid sizes.
......
...@@ -35,9 +35,11 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset ...@@ -35,9 +35,11 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset
* handles drawing of a moving block * handles drawing of a moving block
* @param aPanel = Current draw panel * @param aPanel = Current draw panel
* @param aDC = Current device context * @param aDC = Current device context
* @param aPosition The cursor position in logical (drawing) units.
* @param aErase = Erase block at current position * @param aErase = Erase block at current position
**/ **/
static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, bool aErase ); static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
static bool blockIncludeModules = true; static bool blockIncludeModules = true;
...@@ -219,14 +221,14 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC ) ...@@ -219,14 +221,14 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
Block_Move(); Block_Move();
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
Block_Duplicate(); Block_Duplicate();
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
...@@ -285,19 +287,20 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC ) ...@@ -285,19 +287,20 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
return false; return false;
} }
// Show dialog if there are no selected items and // Show dialog if there are no selected items and we're not zooming
// we're not zooming
if( !GetScreen()->m_BlockLocate.GetCount() if( !GetScreen()->m_BlockLocate.GetCount()
&& GetScreen()->m_BlockLocate.m_Command != BLOCK_ZOOM ) && GetScreen()->m_BlockLocate.m_Command != BLOCK_ZOOM )
{ {
if( !InstallBlockCmdFrame( this, _( "Block Operation" ) ) ) if( !InstallBlockCmdFrame( this, _( "Block Operation" ) ) )
{ {
cancelCmd = true; cancelCmd = true;
DrawPanel->ManageCurseur( DrawPanel, DC, false ); // undraw block outline
// undraw block outline
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
} }
else else
{ {
DrawAndSizingBlockOutlines( DrawPanel, DC, false ); DrawAndSizingBlockOutlines( DrawPanel, DC, wxDefaultPosition, false );
Block_SelectItems(); Block_SelectItems();
// Exit if no items found // Exit if no items found
...@@ -323,7 +326,7 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC ) ...@@ -323,7 +326,7 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
nextcmd = true; nextcmd = true;
DrawPanel->ManageCurseur = drawMovingBlock; DrawPanel->ManageCurseur = drawMovingBlock;
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
...@@ -566,14 +569,14 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset ...@@ -566,14 +569,14 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset
} }
static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, bool aErase ) static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
BASE_SCREEN* screen = aPanel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
if( aErase ) if( aErase )
{ {
if( screen->m_BlockLocate.m_MoveVector.x if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|| screen->m_BlockLocate.m_MoveVector.y )
{ {
screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector, screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector,
GR_XOR, BLOCK_OUTLINE_COLOR ); GR_XOR, BLOCK_OUTLINE_COLOR );
......
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
#define IS_SELECTED 1 #define IS_SELECTED 1
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
static int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect ); static int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect );
static void ClearMarkItems( MODULE* module ); static void ClearMarkItems( MODULE* module );
...@@ -128,9 +129,9 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -128,9 +129,9 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
nextcmd = true; nextcmd = true;
if( DrawPanel->ManageCurseur != NULL ) if( DrawPanel->ManageCurseur != NULL )
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines; DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
...@@ -289,28 +290,29 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC ) ...@@ -289,28 +290,29 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
/* Traces the outline of the search block structures /* Traces the outline of the search block structures
* The entire block follows the cursor * The entire block follows the cursor
*/ */
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
BLOCK_SELECTOR* PtBlock; BLOCK_SELECTOR* PtBlock;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
BOARD_ITEM* item; BOARD_ITEM* item;
wxPoint move_offset; wxPoint move_offset;
MODULE* currentModule = MODULE* currentModule =
( (WinEDA_BasePcbFrame*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules; ( (WinEDA_BasePcbFrame*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules;
PtBlock = &screen->m_BlockLocate; PtBlock = &screen->m_BlockLocate;
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( aDC, g_XorMode );
if( erase ) if( aErase )
{ {
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
PtBlock->m_Color );
if( currentModule ) if( currentModule )
{ {
move_offset.x = -PtBlock->m_MoveVector.x; move_offset.x = -PtBlock->m_MoveVector.x;
move_offset.y = -PtBlock->m_MoveVector.y; move_offset.y = -PtBlock->m_MoveVector.y;
item = currentModule->m_Drawings; item = currentModule->m_Drawings;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
...@@ -320,7 +322,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ...@@ -320,7 +322,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase
{ {
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
item->Draw( panel, DC, g_XorMode, move_offset ); item->Draw( aPanel, aDC, g_XorMode, move_offset );
break; break;
default: default:
...@@ -329,27 +331,26 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ...@@ -329,27 +331,26 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase
} }
D_PAD* pad = currentModule->m_Pads; D_PAD* pad = currentModule->m_Pads;
for( ; pad != NULL; pad = pad->Next() ) for( ; pad != NULL; pad = pad->Next() )
{ {
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
pad->Draw( panel, DC, g_XorMode, move_offset ); pad->Draw( aPanel, aDC, g_XorMode, move_offset );
} }
} }
} }
/* Repaint new view. */ /* Repaint new view. */
PtBlock->m_MoveVector = PtBlock->m_MoveVector = screen->m_Curseur - PtBlock->m_BlockLastCursorPosition;
screen->m_Curseur - PtBlock->m_BlockLastCursorPosition;
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode,
PtBlock->m_Color );
PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
if( currentModule ) if( currentModule )
{ {
item = currentModule->m_Drawings; item = currentModule->m_Drawings;
move_offset = - PtBlock->m_MoveVector; move_offset = - PtBlock->m_MoveVector;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
...@@ -359,7 +360,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ...@@ -359,7 +360,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase
{ {
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE: case TYPE_EDGE_MODULE:
item->Draw( panel, DC, g_XorMode, move_offset ); item->Draw( aPanel, aDC, g_XorMode, move_offset );
break; break;
default: default:
...@@ -368,11 +369,13 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ...@@ -368,11 +369,13 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase
} }
D_PAD* pad = currentModule->m_Pads; D_PAD* pad = currentModule->m_Pads;
for( ; pad != NULL; pad = pad->Next() ) for( ; pad != NULL; pad = pad->Next() )
{ {
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
pad->Draw( panel, DC, g_XorMode, move_offset );
pad->Draw( aPanel, aDC, g_XorMode, move_offset );
} }
} }
} }
......
...@@ -199,14 +199,14 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -199,14 +199,14 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm ); ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm );
} }
/* @todo: rather than assignment to TRUE, these should be increment and decrement /* @todo: rather than assignment to true, these should be increment and decrement
* operators throughout _everywhere_. * operators throughout _everywhere_.
* That way we can handle nesting. * That way we can handle nesting.
* But I tried that and found there cases where the assignment to TRUE (converted to * But I tried that and found there cases where the assignment to true (converted to
* a m_IgnoreMouseEvents++ ) * a m_IgnoreMouseEvents++ )
* was not balanced with the -- (now m_IgnoreMouseEvents=FALSE), so I had to revert. * was not balanced with the -- (now m_IgnoreMouseEvents=false), so I had to revert.
* Somebody should track down these and make them balanced. * Somebody should track down these and make them balanced.
* DrawPanel->m_IgnoreMouseEvents = TRUE; * DrawPanel->m_IgnoreMouseEvents = true;
*/ */
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection() // this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection()
...@@ -216,7 +216,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -216,7 +216,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
// DrawPanel->m_IgnoreMouseEvents = FALSE; // DrawPanel->m_IgnoreMouseEvents = false;
// The function ProcessItemSelection() has set the current item, return it. // The function ProcessItemSelection() has set the current item, return it.
item = GetCurItem(); item = GetCurItem();
...@@ -303,19 +303,19 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) ...@@ -303,19 +303,19 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
/* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the /* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the
* cursor is left off grid this is better to reach items to delete off grid, * cursor is left off grid this is better to reach items to delete off grid,
*/ */
bool keep_on_grid = TRUE; bool keep_on_grid = true;
if( m_ID_current_state == ID_PCB_DELETE_ITEM_BUTT ) if( m_ID_current_state == ID_PCB_DELETE_ITEM_BUTT )
keep_on_grid = FALSE; keep_on_grid = false;
/* Cursor is left off grid if no block in progress and no moving object */ /* Cursor is left off grid if no block in progress and no moving object */
if( GetScreen()->m_BlockLocate.m_State != STATE_NO_BLOCK ) if( GetScreen()->m_BlockLocate.m_State != STATE_NO_BLOCK )
keep_on_grid = TRUE; keep_on_grid = true;
EDA_ITEM* DrawStruct = GetScreen()->GetCurItem(); EDA_ITEM* DrawStruct = GetScreen()->GetCurItem();
if( DrawStruct && DrawStruct->m_Flags ) if( DrawStruct && DrawStruct->m_Flags )
keep_on_grid = TRUE; keep_on_grid = true;
if( keep_on_grid ) if( keep_on_grid )
{ {
...@@ -357,9 +357,9 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition ) ...@@ -357,9 +357,9 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY
wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC ); wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC );
oDC.Clear(); oDC.Clear();
DrawPanel->ManageCurseur( DrawPanel, aDC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, false );
#else #else
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, true );
#endif #endif
} }
#ifdef USE_WX_OVERLAY #ifdef USE_WX_OVERLAY
......
...@@ -31,8 +31,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -31,8 +31,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
return NULL; return NULL;
} }
if( aTrack->m_Flags & IS_NEW ) // Trace in progress, erase the last if( aTrack->m_Flags & IS_NEW ) // Trace in progress, erase the last segment
// segment
{ {
if( g_CurrentTrackList.GetCount() > 0 ) if( g_CurrentTrackList.GetCount() > 0 )
{ {
...@@ -41,7 +40,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -41,7 +40,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
D( g_CurrentTrackList.VerifyListIntegrity(); ) D( g_CurrentTrackList.VerifyListIntegrity(); )
// Delete the current trace // Delete the current trace
ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE ); ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, FALSE );
// delete the most recently entered // delete the most recently entered
delete g_CurrentTrackList.PopBack(); delete g_CurrentTrackList.PopBack();
...@@ -98,7 +97,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) ...@@ -98,7 +97,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
else else
{ {
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
return g_CurrentTrackSegment; return g_CurrentTrackSegment;
} }
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
/* Loca functions */ /* Loca functions */
static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase );
/* Local variables : */ /* Local variables : */
static int status_dimension; /* Used in cimension creation: static int status_dimension; /* Used in cimension creation:
...@@ -295,25 +296,24 @@ DIMENSION* WinEDA_PcbFrame::Begin_Dimension( DIMENSION* Dimension, wxDC* DC ) ...@@ -295,25 +296,24 @@ DIMENSION* WinEDA_PcbFrame::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
} }
/************************************************************************************/ static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) const wxPoint& aPosition, bool aErase )
/************************************************************************************/
/* redessin du contour de la piste lors des deplacements de la souris */
{ {
PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem(); DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem();
wxPoint pos = screen->m_Curseur; wxPoint pos = screen->m_Curseur;
if( Dimension == NULL ) if( Dimension == NULL )
return; return;
/* efface ancienne position */ // Erase previous dimension.
if( erase ) if( aErase )
{ {
Dimension->Draw( panel, DC, GR_XOR ); Dimension->Draw( aPanel, aDC, GR_XOR );
} }
Dimension->SetLayer( screen->m_Active_Layer ); Dimension->SetLayer( screen->m_Active_Layer );
if( status_dimension == 1 ) if( status_dimension == 1 )
{ {
Dimension->TraitD_ox = pos.x; Dimension->TraitD_ox = pos.x;
...@@ -346,7 +346,7 @@ static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* panel, wxDC* DC, bool ...@@ -346,7 +346,7 @@ static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* panel, wxDC* DC, bool
Dimension->AdjustDimensionDetails( ); Dimension->AdjustDimensionDetails( );
} }
Dimension->Draw( panel, DC, GR_XOR ); Dimension->Draw( aPanel, aDC, GR_XOR );
} }
......
...@@ -19,9 +19,11 @@ ...@@ -19,9 +19,11 @@
#include "module_editor_frame.h" #include "module_editor_frame.h"
static void ShowEdgeModule( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void ShowEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool erase );
static void Exit_EditEdge_Module( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void Exit_EditEdge_Module( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
int ArcValue = 900; int ArcValue = 900;
static wxPoint MoveVector; // Move vector for move edge static wxPoint MoveVector; // Move vector for move edge
...@@ -43,7 +45,7 @@ void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -43,7 +45,7 @@ void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
DrawPanel->ManageCurseur = Move_Segment; DrawPanel->ManageCurseur = Move_Segment;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge_Module; DrawPanel->ForceCloseManageCurseur = Exit_EditEdge_Module;
SetCurItem( Edge ); SetCurItem( Edge );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
} }
...@@ -72,9 +74,9 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge ) ...@@ -72,9 +74,9 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge )
/* Move and redraw the current edited graphic item when mouse is moving */ /* Move and redraw the current edited graphic item when mouse is moving */
static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
{ {
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem(); EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem();
if( Edge == NULL ) if( Edge == NULL )
...@@ -82,14 +84,14 @@ static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -82,14 +84,14 @@ static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
MODULE* Module = (MODULE*) Edge->GetParent(); MODULE* Module = (MODULE*) Edge->GetParent();
if( erase ) if( aErase )
{ {
Edge->Draw( panel, DC, GR_XOR, MoveVector ); Edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
} }
MoveVector = -(screen->m_Curseur - CursorInitialPosition); MoveVector = -(screen->m_Curseur - CursorInitialPosition);
Edge->Draw( panel, DC, GR_XOR, MoveVector ); Edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
} }
...@@ -97,9 +99,10 @@ static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -97,9 +99,10 @@ static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
/* Redraw the current edited (moved) graphic item /* Redraw the current edited (moved) graphic item
*/ */
static void ShowEdgeModule( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void ShowEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem(); EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem();
if( Edge == NULL ) if( Edge == NULL )
...@@ -109,7 +112,7 @@ static void ShowEdgeModule( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -109,7 +112,7 @@ static void ShowEdgeModule( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
// if( erase ) // if( erase )
{ {
Edge->Draw( panel, DC, GR_XOR ); Edge->Draw( aPanel, aDC, GR_XOR );
} }
Edge->m_End = screen->m_Curseur; Edge->m_End = screen->m_Curseur;
...@@ -118,7 +121,7 @@ static void ShowEdgeModule( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -118,7 +121,7 @@ static void ShowEdgeModule( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
Edge->m_End0 = Edge->m_End - Module->m_Pos; Edge->m_End0 = Edge->m_End - Module->m_Pos;
RotatePoint( &Edge->m_End0, -Module->m_Orient ); RotatePoint( &Edge->m_End0, -Module->m_Orient );
Edge->Draw( panel, DC, GR_XOR ); Edge->Draw( aPanel, aDC, GR_XOR );
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
} }
......
...@@ -351,10 +351,13 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -351,10 +351,13 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
* If a track is in progress, it will be redrawn * If a track is in progress, it will be redrawn
*/ */
if( DrawPanel->ManageCurseur == ShowNewTrackWhenMovingCursor ) if( DrawPanel->ManageCurseur == ShowNewTrackWhenMovingCursor )
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, false ); ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false );
g_Alternate_Track_Posture = !g_Alternate_Track_Posture; g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
if( DrawPanel->ManageCurseur == ShowNewTrackWhenMovingCursor ) if( DrawPanel->ManageCurseur == ShowNewTrackWhenMovingCursor )
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, false ); ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false );
break; break;
case ID_POPUP_PCB_PLACE_MICROVIA: case ID_POPUP_PCB_PLACE_MICROVIA:
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
#include "protos.h" #include "protos.h"
static void Move_Texte_Pcb( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
static void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC );
...@@ -111,24 +112,25 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ) ...@@ -111,24 +112,25 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
DrawPanel->ManageCurseur = Move_Texte_Pcb; DrawPanel->ManageCurseur = Move_Texte_Pcb;
DrawPanel->ForceCloseManageCurseur = Abort_Edit_Pcb_Text; DrawPanel->ForceCloseManageCurseur = Abort_Edit_Pcb_Text;
SetCurItem( TextePcb ); SetCurItem( TextePcb );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
} }
/* Move PCB text following the cursor. */ /* Move PCB text following the cursor. */
static void Move_Texte_Pcb( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
TEXTE_PCB* TextePcb = (TEXTE_PCB*) panel->GetScreen()->GetCurItem(); TEXTE_PCB* TextePcb = (TEXTE_PCB*) aPanel->GetScreen()->GetCurItem();
if( TextePcb == NULL ) if( TextePcb == NULL )
return; return;
if( erase ) if( aErase )
TextePcb->Draw( panel, DC, GR_XOR ); TextePcb->Draw( aPanel, aDC, GR_XOR );
TextePcb->m_Pos = panel->GetScreen()->m_Curseur; TextePcb->m_Pos = aPanel->GetScreen()->m_Curseur;
TextePcb->Draw( panel, DC, GR_XOR ); TextePcb->Draw( aPanel, aDC, GR_XOR );
} }
......
...@@ -15,8 +15,10 @@ ...@@ -15,8 +15,10 @@
static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Montre_Position_NewSegment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void Montre_Position_NewSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); const wxPoint& aPosition, bool aErase );
static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
static wxPoint s_InitialPosition; // Initial cursor position. static wxPoint s_InitialPosition; // Initial cursor position.
...@@ -35,7 +37,7 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) ...@@ -35,7 +37,7 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
DrawPanel->ManageCurseur = Move_Segment; DrawPanel->ManageCurseur = Move_Segment;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge; DrawPanel->ForceCloseManageCurseur = Exit_EditEdge;
SetCurItem( drawitem ); SetCurItem( drawitem );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
} }
...@@ -59,9 +61,10 @@ void WinEDA_PcbFrame::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) ...@@ -59,9 +61,10 @@ void WinEDA_PcbFrame::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
/* /*
* Redraw segment during cursor movement. * Redraw segment during cursor movement.
*/ */
static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
DRAWSEGMENT* Segment = (DRAWSEGMENT*) panel->GetScreen()->GetCurItem(); DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
int t_fill = DisplayOpt.DisplayDrawItems; int t_fill = DisplayOpt.DisplayDrawItems;
if( Segment == NULL ) if( Segment == NULL )
...@@ -69,16 +72,16 @@ static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -69,16 +72,16 @@ static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
DisplayOpt.DisplayDrawItems = SKETCH; DisplayOpt.DisplayDrawItems = SKETCH;
if( erase ) if( aErase )
Segment->Draw( panel, DC, GR_XOR ); Segment->Draw( aPanel, aDC, GR_XOR );
wxPoint delta; wxPoint delta;
delta = panel->GetScreen()->m_Curseur - s_LastPosition; delta = aPanel->GetScreen()->m_Curseur - s_LastPosition;
Segment->m_Start += delta; Segment->m_Start += delta;
Segment->m_End += delta; Segment->m_End += delta;
s_LastPosition = panel->GetScreen()->m_Curseur; s_LastPosition = aPanel->GetScreen()->m_Curseur;
Segment->Draw( panel, DC, GR_XOR ); Segment->Draw( aPanel, aDC, GR_XOR );
DisplayOpt.DisplayDrawItems = t_fill; DisplayOpt.DisplayDrawItems = t_fill;
} }
...@@ -177,7 +180,7 @@ static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -177,7 +180,7 @@ static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Segment->m_Flags & IS_NEW ) if( Segment->m_Flags & IS_NEW )
{ {
Panel->ManageCurseur( Panel, DC, FALSE ); Panel->ManageCurseur( Panel, DC, wxDefaultPosition, false );
Segment ->DeleteStructure(); Segment ->DeleteStructure();
Segment = NULL; Segment = NULL;
} }
...@@ -185,7 +188,7 @@ static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -185,7 +188,7 @@ static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
{ {
wxPoint pos = Panel->GetScreen()->m_Curseur; wxPoint pos = Panel->GetScreen()->m_Curseur;
Panel->GetScreen()->m_Curseur = s_InitialPosition; Panel->GetScreen()->m_Curseur = s_InitialPosition;
Panel->ManageCurseur( Panel, DC, TRUE ); Panel->ManageCurseur( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->m_Curseur = pos; Panel->GetScreen()->m_Curseur = pos;
Segment->m_Flags = 0; Segment->m_Flags = 0;
Segment->Draw( Panel, DC, GR_OR ); Segment->Draw( Panel, DC, GR_OR );
...@@ -254,7 +257,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment, ...@@ -254,7 +257,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
Segment->m_Type = DrawItem->m_Type; Segment->m_Type = DrawItem->m_Type;
Segment->m_Angle = DrawItem->m_Angle; Segment->m_Angle = DrawItem->m_Angle;
Segment->m_Start = Segment->m_End = DrawItem->m_End; Segment->m_Start = Segment->m_End = DrawItem->m_End;
Montre_Position_NewSegment( DrawPanel, DC, FALSE ); Montre_Position_NewSegment( DrawPanel, DC, wxDefaultPosition, false );
} }
else else
{ {
...@@ -293,9 +296,10 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC ) ...@@ -293,9 +296,10 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
/* Redraw segment during cursor movement /* Redraw segment during cursor movement
*/ */
static void Montre_Position_NewSegment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void Montre_Position_NewSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{ {
DRAWSEGMENT* Segment = (DRAWSEGMENT*) panel->GetScreen()->GetCurItem(); DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
int t_fill = DisplayOpt.DisplayDrawItems; int t_fill = DisplayOpt.DisplayDrawItems;
if( Segment == NULL ) if( Segment == NULL )
...@@ -303,20 +307,20 @@ static void Montre_Position_NewSegment( EDA_DRAW_PANEL* panel, wxDC* DC, bool er ...@@ -303,20 +307,20 @@ static void Montre_Position_NewSegment( EDA_DRAW_PANEL* panel, wxDC* DC, bool er
DisplayOpt.DisplayDrawItems = SKETCH; DisplayOpt.DisplayDrawItems = SKETCH;
if( erase ) if( aErase )
Segment->Draw( panel, DC, GR_XOR ); Segment->Draw( aPanel, aDC, GR_XOR );
if( Segments_45_Only && ( Segment->m_Shape == S_SEGMENT ) ) if( Segments_45_Only && ( Segment->m_Shape == S_SEGMENT ) )
{ {
Calcule_Coord_Extremite_45( panel->GetScreen()->m_Curseur, Calcule_Coord_Extremite_45( aPanel->GetScreen()->m_Curseur,
Segment->m_Start.x, Segment->m_Start.y, Segment->m_Start.x, Segment->m_Start.y,
&Segment->m_End.x, &Segment->m_End.y ); &Segment->m_End.x, &Segment->m_End.y );
} }
else /* here the angle is arbitrary */ else /* here the angle is arbitrary */
{ {
Segment->m_End = panel->GetScreen()->m_Curseur; Segment->m_End = aPanel->GetScreen()->m_Curseur;
} }
Segment->Draw( panel, DC, GR_XOR ); Segment->Draw( aPanel, aDC, GR_XOR );
DisplayOpt.DisplayDrawItems = t_fill; DisplayOpt.DisplayDrawItems = t_fill;
} }
...@@ -142,7 +142,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -142,7 +142,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
itmp = g_CurrentTrackList.GetCount(); itmp = g_CurrentTrackList.GetCount();
Begin_Route( g_CurrentTrackSegment, DC ); Begin_Route( g_CurrentTrackSegment, DC );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
/* create the via */ /* create the via */
SEGVIA* via = new SEGVIA( GetBoard() ); SEGVIA* via = new SEGVIA( GetBoard() );
...@@ -200,7 +200,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -200,7 +200,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
/* DRC fault: the Via cannot be placed here ... */ /* DRC fault: the Via cannot be placed here ... */
delete via; delete via;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
// delete the track(s) added in Begin_Route() // delete the track(s) added in Begin_Route()
while( g_CurrentTrackList.GetCount() > itmp ) while( g_CurrentTrackList.GetCount() > itmp )
...@@ -253,7 +253,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -253,7 +253,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() ); g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() );
} }
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
via->DisplayInfo( this ); via->DisplayInfo( this );
UpdateStatusBar(); UpdateStatusBar();
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
static void Exit_Editrack( EDA_DRAW_PANEL* panel, wxDC* DC ); static void Exit_Editrack( EDA_DRAW_PANEL* panel, wxDC* DC );
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase );
static void ComputeBreakPoint( TRACK* track, int n, wxPoint end ); static void ComputeBreakPoint( TRACK* track, int n, wxPoint end );
static void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList ); static void DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList );
...@@ -41,7 +42,7 @@ static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -41,7 +42,7 @@ static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( track && ( track->Type()==TYPE_VIA || track->Type()==TYPE_TRACK ) ) if( track && ( track->Type()==TYPE_VIA || track->Type()==TYPE_TRACK ) )
{ {
/* Erase the current drawing */ /* Erase the current drawing */
ShowNewTrackWhenMovingCursor( Panel, DC, false ); ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false );
if( g_HighLight_Status ) if( g_HighLight_Status )
frame->High_Light( DC ); frame->High_Light( DC );
...@@ -192,7 +193,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -192,7 +193,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackSegment->DisplayInfoBase( this ); g_CurrentTrackSegment->DisplayInfoBase( this );
SetCurItem( g_CurrentTrackSegment, false ); SetCurItem( g_CurrentTrackSegment, false );
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( Drc_On ) if( Drc_On )
{ {
...@@ -203,8 +204,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -203,8 +204,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
} }
} }
} }
else /* Track in progress : segment coordinates are updated by else // Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor.
* ShowNewTrackWhenMovingCursor*/
{ {
/* Tst for a D.R.C. error: */ /* Tst for a D.R.C. error: */
if( Drc_On ) if( Drc_On )
...@@ -241,7 +241,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -241,7 +241,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
/* Erase old track on screen */ /* Erase old track on screen */
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
ShowNewTrackWhenMovingCursor( DrawPanel, DC, false ); ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
...@@ -280,7 +280,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) ...@@ -280,7 +280,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
/* Show the new position */ /* Show the new position */
ShowNewTrackWhenMovingCursor( DrawPanel, DC, false ); ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
} }
} }
...@@ -440,8 +440,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC ) ...@@ -440,8 +440,8 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC )
if( Begin_Route( aTrack, DC ) == NULL ) if( Begin_Route( aTrack, DC ) == NULL )
return; return;
ShowNewTrackWhenMovingCursor( DrawPanel, DC, true ); ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, true );
ShowNewTrackWhenMovingCursor( DrawPanel, DC, false ); ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
trace_ratsnest_pad( DC ); trace_ratsnest_pad( DC );
/* cleanup /* cleanup
...@@ -669,18 +669,19 @@ static void PushTrack( EDA_DRAW_PANEL* panel ) ...@@ -669,18 +669,19 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
/* Redraw the current track beiing created when the mouse cursor is moved /* Redraw the current track beiing created when the mouse cursor is moved
*/ */
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetScreen(); PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent(); WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) aPanel->GetParent();
bool Track_fill_copy = DisplayOpt.DisplayPcbTrackFill; bool Track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
DisplayOpt.DisplayPcbTrackFill = true; DisplayOpt.DisplayPcbTrackFill = true;
int showTrackClearanceMode = DisplayOpt.ShowTrackClearanceMode; int showTrackClearanceMode = DisplayOpt.ShowTrackClearanceMode;
if (g_FirstTrackSegment == NULL) if ( g_FirstTrackSegment == NULL )
return; return;
NETCLASS* netclass = g_FirstTrackSegment->GetNetClass(); NETCLASS* netclass = g_FirstTrackSegment->GetNetClass();
...@@ -689,22 +690,17 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -689,22 +690,17 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS; DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
/* Erase old track */ /* Erase old track */
if( erase ) if( aErase )
{ {
Trace_Une_Piste( panel, Trace_Une_Piste( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
DC,
g_FirstTrackSegment,
g_CurrentTrackList.GetCount(),
GR_XOR );
frame->trace_ratsnest_pad( DC ); frame->trace_ratsnest_pad( aDC );
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
{ {
int color = int color = g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x, GRCircle( &aPanel->m_ClipBox, aDC, g_CurrentTrackSegment->m_End.x,
g_CurrentTrackSegment->m_End.y, g_CurrentTrackSegment->m_End.y,
( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(), ( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(),
color ); color );
...@@ -717,19 +713,20 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -717,19 +713,20 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
// Set track parameters, that can be modified while creating the track // Set track parameters, that can be modified while creating the track
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
if( !frame->GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth ) if( !frame->GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
g_CurrentTrackSegment->m_Width = frame->GetBoard()->GetCurrentTrackWidth(); g_CurrentTrackSegment->m_Width = frame->GetBoard()->GetCurrentTrackWidth();
if( g_TwoSegmentTrackBuild ) if( g_TwoSegmentTrackBuild )
{ {
TRACK* previous_track = g_CurrentTrackSegment->Back(); TRACK* previous_track = g_CurrentTrackSegment->Back();
if( previous_track && previous_track->Type()==TYPE_TRACK ) if( previous_track && previous_track->Type()==TYPE_TRACK )
{ {
previous_track->SetLayer( screen->m_Active_Layer ); previous_track->SetLayer( screen->m_Active_Layer );
if( !frame->GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth ) if( !frame->GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
previous_track->m_Width = previous_track->m_Width = frame->GetBoard()->GetCurrentTrackWidth();
frame->GetBoard()->GetCurrentTrackWidth();
} }
} }
...@@ -740,7 +737,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -740,7 +737,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
g_CurrentTrackSegment->m_End = screen->m_Curseur; g_CurrentTrackSegment->m_End = screen->m_Curseur;
if( Drc_On ) if( Drc_On )
PushTrack( panel ); PushTrack( aPanel );
ComputeBreakPoint( g_CurrentTrackSegment, ComputeBreakPoint( g_CurrentTrackSegment,
g_CurrentTrackList.GetCount(), g_CurrentTrackList.GetCount(),
...@@ -765,18 +762,13 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -765,18 +762,13 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
/* Redraw the new track */ /* Redraw the new track */
D( g_CurrentTrackList.VerifyListIntegrity(); ); D( g_CurrentTrackList.VerifyListIntegrity(); );
Trace_Une_Piste( panel, Trace_Une_Piste( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
DC,
g_FirstTrackSegment,
g_CurrentTrackList.GetCount(),
GR_XOR );
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS ) if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
{ {
int color = int color = g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
GRCircle( &panel->m_ClipBox, DC, g_CurrentTrackSegment->m_End.x, GRCircle( &aPanel->m_ClipBox, aDC, g_CurrentTrackSegment->m_End.x,
g_CurrentTrackSegment->m_End.y, g_CurrentTrackSegment->m_End.y,
( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(), ( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(),
color ); color );
...@@ -811,7 +803,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -811,7 +803,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
DisplayOpt.DisplayPcbTrackFill = Track_fill_copy; DisplayOpt.DisplayPcbTrackFill = Track_fill_copy;
frame->build_ratsnest_pad( NULL, g_CurrentTrackSegment->m_End, false ); frame->build_ratsnest_pad( NULL, g_CurrentTrackSegment->m_End, false );
frame->trace_ratsnest_pad( DC ); frame->trace_ratsnest_pad( aDC );
} }
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
#include "protos.h" #include "protos.h"
static void Show_MoveTexte_Module( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC );
...@@ -190,7 +191,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -190,7 +191,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
DrawPanel->ManageCurseur = Show_MoveTexte_Module; DrawPanel->ManageCurseur = Show_MoveTexte_Module;
DrawPanel->ForceCloseManageCurseur = AbortMoveTextModule; DrawPanel->ForceCloseManageCurseur = AbortMoveTextModule;
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, TRUE );
} }
...@@ -240,28 +241,30 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -240,28 +241,30 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
} }
static void Show_MoveTexte_Module( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
TEXTE_MODULE* Text = (TEXTE_MODULE*) screen->GetCurItem(); TEXTE_MODULE* Text = (TEXTE_MODULE*) screen->GetCurItem();
if( Text == NULL ) if( Text == NULL )
return; return;
// Erase umbilical and text if necessary // Erase umbilical and text if necessary
if( erase ) if( aErase )
{ {
Text->DrawUmbilical( panel, DC, GR_XOR, -MoveVector ); Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );
Text->Draw( panel, DC, GR_XOR, MoveVector ); Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
} }
MoveVector = TextInitialPosition - screen->m_Curseur; MoveVector = TextInitialPosition - screen->m_Curseur;
// Draw umbilical if text moved // Draw umbilical if text moved
if( MoveVector.x || MoveVector.y ) if( MoveVector.x || MoveVector.y )
Text->DrawUmbilical( panel, DC, GR_XOR, -MoveVector ); Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );
// Redraw text // Redraw text
Text->Draw( panel, DC, GR_XOR, MoveVector ); Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
} }
void WinEDA_BasePcbFrame::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC ) void WinEDA_BasePcbFrame::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
......
...@@ -16,9 +16,10 @@ ...@@ -16,9 +16,10 @@
/* Routines Locales */ /* Routines Locales */
static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* panel, static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel,
wxDC* DC, wxDC* aDC,
bool erase ); const wxPoint& aPosition,
bool aErase );
/* Local variables : */ /* Local variables : */
static int MireDefaultSize = 5000; static int MireDefaultSize = 5000;
...@@ -279,18 +280,19 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC ) ...@@ -279,18 +280,19 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
/* Redraw the contour of the track while moving the mouse */ /* Redraw the contour of the track while moving the mouse */
static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{ {
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem(); MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem();
if( MirePcb == NULL ) if( MirePcb == NULL )
return; return;
if( erase ) if( aErase )
MirePcb->Draw( panel, DC, GR_XOR ); MirePcb->Draw( aPanel, aDC, GR_XOR );
MirePcb->m_Pos = screen->m_Curseur; MirePcb->m_Pos = screen->m_Curseur;
MirePcb->Draw( panel, DC, GR_XOR ); MirePcb->Draw( aPanel, aDC, GR_XOR );
} }
...@@ -523,7 +523,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio ...@@ -523,7 +523,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* aDC, const wxPoint& aPositio
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, aDC, true ); DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, true );
} }
} }
......
...@@ -108,7 +108,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC ) ...@@ -108,7 +108,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
module->m_Flags = tmp; module->m_Flags = tmp;
} }
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
} }
...@@ -231,24 +231,25 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module ) ...@@ -231,24 +231,25 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
/* Redraw the footprint when moving the mouse. /* Redraw the footprint when moving the mouse.
*/ */
void Montre_Position_Empreinte( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) void Montre_Position_Empreinte( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
MODULE* module = (MODULE*) panel->GetScreen()->GetCurItem(); MODULE* module = (MODULE*) aPanel->GetScreen()->GetCurItem();
if( module == NULL ) if( module == NULL )
return; return;
/* Erase current footprint. */ /* Erase current footprint. */
if( erase ) if( aErase )
{ {
DrawModuleOutlines( panel, DC, module ); DrawModuleOutlines( aPanel, aDC, module );
} }
/* Redraw the module at the new position. */ /* Redraw the module at the new position. */
g_Offset_Module = module->m_Pos - panel->GetScreen()->m_Curseur; g_Offset_Module = module->m_Pos - aPanel->GetScreen()->m_Curseur;
DrawModuleOutlines( panel, DC, module ); DrawModuleOutlines( aPanel, aDC, module );
Dessine_Segments_Dragges( panel, DC ); Dessine_Segments_Dragges( aPanel, aDC );
} }
......
...@@ -57,17 +57,18 @@ static void Exit_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -57,17 +57,18 @@ static void Exit_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC )
/* Draw in drag mode when moving a pad. /* Draw in drag mode when moving a pad.
*/ */
static void Show_Pad_Move( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
TRACK* Track; TRACK* Track;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
D_PAD* pad = s_CurrentSelectedPad; D_PAD* pad = s_CurrentSelectedPad;
if( erase ) if( aErase )
pad->Draw( panel, DC, GR_XOR ); pad->Draw( aPanel, aDC, GR_XOR );
pad->m_Pos = screen->m_Curseur; pad->m_Pos = screen->m_Curseur;
pad->Draw( panel, DC, GR_XOR ); pad->Draw( aPanel, aDC, GR_XOR );
if( !g_Drag_Pistes_On ) if( !g_Drag_Pistes_On )
return; return;
...@@ -75,17 +76,21 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -75,17 +76,21 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{ {
Track = g_DragSegmentList[ii].m_Segm; Track = g_DragSegmentList[ii].m_Segm;
if( erase )
Track->Draw( panel, DC, GR_XOR ); if( aErase )
Track->Draw( aPanel, aDC, GR_XOR );
if( g_DragSegmentList[ii].m_Pad_Start ) if( g_DragSegmentList[ii].m_Pad_Start )
{ {
Track->m_Start = pad->m_Pos; Track->m_Start = pad->m_Pos;
} }
if( g_DragSegmentList[ii].m_Pad_End ) if( g_DragSegmentList[ii].m_Pad_End )
{ {
Track->m_End = pad->m_Pos; Track->m_End = pad->m_Pos;
} }
Track->Draw( panel, DC, GR_XOR );
Track->Draw( aPanel, aDC, GR_XOR );
} }
} }
......
...@@ -19,10 +19,12 @@ ...@@ -19,10 +19,12 @@
#include "protos.h" #include "protos.h"
static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel, bool aErase );
wxDC* DC, static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel,
bool erase ); wxDC* aDC,
const wxPoint& aPosition,
bool aErase );
static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC );
static bool InitialiseDragParameters(); static bool InitialiseDragParameters();
...@@ -59,7 +61,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -59,7 +61,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
Panel->GetScreen()->m_Curseur = PosInit; Panel->GetScreen()->m_Curseur = PosInit;
if( Panel->ManageCurseur ) if( Panel->ManageCurseur )
Panel->ManageCurseur( Panel, DC, true ); Panel->ManageCurseur( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->m_Curseur = oldpos; Panel->GetScreen()->m_Curseur = oldpos;
g_HighLight_Status = false; g_HighLight_Status = false;
...@@ -134,24 +136,25 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -134,24 +136,25 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
/* Redraw the moved node according to the mouse cursor position */ /* Redraw the moved node according to the mouse cursor position */
static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{ {
int ii; int ii;
wxPoint moveVector; wxPoint moveVector;
TRACK* Track; TRACK* Track;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
int track_fill_copy = DisplayOpt.DisplayPcbTrackFill; int track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
int draw_mode = GR_XOR | GR_SURBRILL; int draw_mode = GR_XOR | GR_SURBRILL;
DisplayOpt.DisplayPcbTrackFill = false; DisplayOpt.DisplayPcbTrackFill = false;
erase = true; aErase = true;
/* erase the current moved track segments from screen */ /* erase the current moved track segments from screen */
if( erase ) if( aErase )
{ {
if( NewTrack ) if( NewTrack )
Trace_Une_Piste( panel, DC, NewTrack, NbPtNewTrack, draw_mode ); Trace_Une_Piste( aPanel, aDC, NewTrack, NbPtNewTrack, draw_mode );
} }
/* set the new track coordinates */ /* set the new track coordinates */
...@@ -162,22 +165,25 @@ static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -162,22 +165,25 @@ static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
ii = NbPtNewTrack; ii = NbPtNewTrack;
Track = NewTrack; Track = NewTrack;
for( ; (ii > 0) && (Track != NULL); ii--, Track = Track->Next() ) for( ; (ii > 0) && (Track != NULL); ii--, Track = Track->Next() )
{ {
if( Track->m_Flags & STARTPOINT ) if( Track->m_Flags & STARTPOINT )
Track->m_Start += moveVector; Track->m_Start += moveVector;
if( Track->m_Flags & ENDPOINT ) if( Track->m_Flags & ENDPOINT )
Track->m_End += moveVector; Track->m_End += moveVector;
} }
/* Redraw the current moved track segments */ /* Redraw the current moved track segments */
Trace_Une_Piste( panel, DC, NewTrack, NbPtNewTrack, draw_mode ); Trace_Une_Piste( aPanel, aDC, NewTrack, NbPtNewTrack, draw_mode );
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{ {
Track = g_DragSegmentList[ii].m_Segm; Track = g_DragSegmentList[ii].m_Segm;
if( erase )
Track->Draw( panel, DC, draw_mode ); if( aErase )
Track->Draw( aPanel, aDC, draw_mode );
if( Track->m_Flags & STARTPOINT ) if( Track->m_Flags & STARTPOINT )
Track->m_Start += moveVector; Track->m_Start += moveVector;
...@@ -185,13 +191,13 @@ static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -185,13 +191,13 @@ static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
if( Track->m_Flags & ENDPOINT ) if( Track->m_Flags & ENDPOINT )
Track->m_End += moveVector; Track->m_End += moveVector;
Track->Draw( panel, DC, draw_mode ); Track->Draw( aPanel, aDC, draw_mode );
} }
DisplayOpt.DisplayPcbTrackFill = track_fill_copy; DisplayOpt.DisplayPcbTrackFill = track_fill_copy;
// Display track length // Display track length
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent(); WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) aPanel->GetParent();
Track->DisplayInfo( frame ); Track->DisplayInfo( frame );
} }
...@@ -236,15 +242,15 @@ static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) ...@@ -236,15 +242,15 @@ static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
* when moving segments * when moving segments
* (i.e. when a segment length is 0) and we want keep them constant * (i.e. when a segment length is 0) and we want keep them constant
*/ */
static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel, static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
wxDC* DC, bool erase ) const wxPoint& aPosition, bool aErase )
{ {
double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated
// intersection points // intersection points
double tx1, tx2, ty1, ty2; // temporary storage of double tx1, tx2, ty1, ty2; // temporary storage of
// points // points
int dx, dy; int dx, dy;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
bool update = true; bool update = true;
TRACK* Track; TRACK* Track;
TRACK* tSegmentToStart = NULL, * tSegmentToEnd = NULL; TRACK* tSegmentToStart = NULL, * tSegmentToEnd = NULL;
...@@ -260,9 +266,12 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel, ...@@ -260,9 +266,12 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel,
*/ */
int ii = g_DragSegmentList.size() - 1; int ii = g_DragSegmentList.size() - 1;
Track = g_DragSegmentList[ii].m_Segm; Track = g_DragSegmentList[ii].m_Segm;
if( Track == NULL ) if( Track == NULL )
return; return;
ii--; ii--;
if( ii >= 0) if( ii >= 0)
{ {
if( s_EndSegmentPresent ) if( s_EndSegmentPresent )
...@@ -271,6 +280,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel, ...@@ -271,6 +280,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel,
tSegmentToEnd = g_DragSegmentList[ii].m_Segm; tSegmentToEnd = g_DragSegmentList[ii].m_Segm;
ii--; ii--;
} }
if( s_StartSegmentPresent ) if( s_StartSegmentPresent )
{ {
// Get the segment connected to the start point // Get the segment connected to the start point
...@@ -280,16 +290,18 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel, ...@@ -280,16 +290,18 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel,
} }
int draw_mode = GR_XOR | GR_SURBRILL; int draw_mode = GR_XOR | GR_SURBRILL;
/* Undraw the current moved track segments before modification*/ /* Undraw the current moved track segments before modification*/
// if( erase ) // if( erase )
{ {
Track->Draw( panel, DC, draw_mode ); Track->Draw( aPanel, aDC, draw_mode );
if( tSegmentToStart ) if( tSegmentToStart )
tSegmentToStart->Draw( panel, DC, draw_mode ); tSegmentToStart->Draw( aPanel, aDC, draw_mode );
if( tSegmentToEnd ) if( tSegmentToEnd )
tSegmentToEnd->Draw( panel, DC, draw_mode ); tSegmentToEnd->Draw( aPanel, aDC, draw_mode );
} }
/* Compute the new track segment position */ /* Compute the new track segment position */
...@@ -431,6 +443,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel, ...@@ -431,6 +443,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel,
Track->m_Start.y = wxRound( yi1 ); Track->m_Start.y = wxRound( yi1 );
Track->m_End.x = wxRound( xi2 ); Track->m_End.x = wxRound( xi2 );
Track->m_End.y = wxRound( yi2 ); Track->m_End.y = wxRound( yi2 );
if( tSegmentToEnd ) if( tSegmentToEnd )
{ {
if( tSegmentToEnd->m_Flags & STARTPOINT ) if( tSegmentToEnd->m_Flags & STARTPOINT )
...@@ -438,6 +451,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel, ...@@ -438,6 +451,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel,
else else
tSegmentToEnd->m_End = Track->m_End; tSegmentToEnd->m_End = Track->m_End;
} }
if( tSegmentToStart ) if( tSegmentToStart )
{ {
if( tSegmentToStart->m_Flags & STARTPOINT ) if( tSegmentToStart->m_Flags & STARTPOINT )
...@@ -447,14 +461,16 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel, ...@@ -447,14 +461,16 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel,
} }
} }
Track->Draw( panel, DC, draw_mode ); Track->Draw( aPanel, aDC, draw_mode );
if( tSegmentToStart ) if( tSegmentToStart )
tSegmentToStart->Draw( panel, DC, draw_mode ); tSegmentToStart->Draw( aPanel, aDC, draw_mode );
if( tSegmentToEnd ) if( tSegmentToEnd )
tSegmentToEnd->Draw( panel, DC, draw_mode ); tSegmentToEnd->Draw( aPanel, aDC, draw_mode );
// Display track length // Display track length
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent(); WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) aPanel->GetParent();
Track->DisplayInfo( frame ); Track->DisplayInfo( frame );
} }
...@@ -731,7 +747,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, ...@@ -731,7 +747,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
g_HighLight_Status = true; g_HighLight_Status = true;
GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode ); GetBoard()->DrawHighLight( DrawPanel, DC, g_HighLight_NetCode );
DrawPanel->ManageCurseur( DrawPanel, DC, true ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
} }
......
...@@ -30,9 +30,10 @@ static void gen_arc( std::vector <wxPoint>& aBuffer, ...@@ -30,9 +30,10 @@ static void gen_arc( std::vector <wxPoint>& aBuffer,
wxPoint aStartPoint, wxPoint aStartPoint,
wxPoint aCenter, wxPoint aCenter,
int a_ArcAngle ); int a_ArcAngle );
static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* panel, static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* apanel,
wxDC* DC, wxDC* aDC,
bool erase ); const wxPoint& aPosition,
bool aErase );
int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer, int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
...@@ -57,13 +58,14 @@ static int Self_On; ...@@ -57,13 +58,14 @@ static int Self_On;
/* This function shows on screen the bounding box of the inductor that will be /* This function shows on screen the bounding box of the inductor that will be
* created at the end of the build inductor process * created at the end of the build inductor process
*/ */
static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ) static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{ {
/* Calculate the orientation and size of the box containing the inductor: /* Calculate the orientation and size of the box containing the inductor:
* the box is a rectangle with height = lenght/2 * the box is a rectangle with height = lenght/2
* the shape is defined by a rectangle, nor necessary horizontal or vertical * the shape is defined by a rectangle, nor necessary horizontal or vertical
*/ */
GRSetDrawMode( DC, GR_XOR ); GRSetDrawMode( aDC, GR_XOR );
wxPoint poly[5]; wxPoint poly[5];
wxPoint pt = Mself.m_End - Mself.m_Start; wxPoint pt = Mself.m_End - Mself.m_Start;
...@@ -81,12 +83,12 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* panel, wxDC* DC, b ...@@ -81,12 +83,12 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* panel, wxDC* DC, b
poly[3] = Mself.m_Start + pt; poly[3] = Mself.m_Start + pt;
poly[4] = poly[0]; poly[4] = poly[0];
if( erase ) if( aErase )
{ {
GRPoly( &panel->m_ClipBox, DC, 5, poly, false, 0, YELLOW, YELLOW ); GRPoly( &aPanel->m_ClipBox, aDC, 5, poly, false, 0, YELLOW, YELLOW );
} }
Mself.m_End = panel->GetScreen()->m_Curseur; Mself.m_End = aPanel->GetScreen()->m_Curseur;
pt = Mself.m_End - Mself.m_Start; pt = Mself.m_End - Mself.m_Start;
angle = -wxRound( atan2( (double) pt.y, (double) pt.x ) * 1800.0 / M_PI ); angle = -wxRound( atan2( (double) pt.y, (double) pt.x ) * 1800.0 / M_PI );
len = wxRound( sqrt( (double) pt.x * pt.x + (double) pt.y * pt.y ) ); len = wxRound( sqrt( (double) pt.x * pt.x + (double) pt.y * pt.y ) );
...@@ -102,7 +104,7 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* panel, wxDC* DC, b ...@@ -102,7 +104,7 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* panel, wxDC* DC, b
poly[3] = Mself.m_Start + pt; poly[3] = Mself.m_Start + pt;
poly[4] = poly[0]; poly[4] = poly[0];
GRPoly( &panel->m_ClipBox, DC, 5, poly, false, 0, YELLOW, YELLOW ); GRPoly( &aPanel->m_ClipBox, aDC, 5, poly, false, 0, YELLOW, YELLOW );
} }
...@@ -111,7 +113,7 @@ void Exit_Self( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -111,7 +113,7 @@ void Exit_Self( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Self_On ) if( Self_On )
{ {
Self_On = 0; Self_On = 0;
Panel->ManageCurseur( Panel, DC, 0 ); Panel->ManageCurseur( Panel, DC, wxDefaultPosition, 0 );
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
} }
...@@ -137,7 +139,7 @@ void WinEDA_PcbFrame::Begin_Self( wxDC* DC ) ...@@ -137,7 +139,7 @@ void WinEDA_PcbFrame::Begin_Self( wxDC* DC )
DrawPanel->ManageCurseur = ShowBoundingBoxMicroWaveInductor; DrawPanel->ManageCurseur = ShowBoundingBoxMicroWaveInductor;
DrawPanel->ForceCloseManageCurseur = Exit_Self; DrawPanel->ForceCloseManageCurseur = Exit_Self;
DrawPanel->ManageCurseur( DrawPanel, DC, 0 ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
} }
...@@ -181,7 +183,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC ) ...@@ -181,7 +183,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
int ll; int ll;
wxString msg; wxString msg;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
......
...@@ -187,7 +187,8 @@ TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer ); ...@@ -187,7 +187,8 @@ TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer );
/*************/ /*************/
int ChangeSideNumLayer( int oldlayer ); int ChangeSideNumLayer( int oldlayer );
void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module ); void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module );
void Montre_Position_Empreinte( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); void Montre_Position_Empreinte( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
/****************/ /****************/
...@@ -196,7 +197,8 @@ void Montre_Position_Empreinte( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); ...@@ -196,7 +197,8 @@ void Montre_Position_Empreinte( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase );
TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoint& aRef ); TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoint& aRef );
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
/* Determine coordinate for a segment direction of 0, 90 or 45 degrees, /* Determine coordinate for a segment direction of 0, 90 or 45 degrees,
* depending on it's position from the origin (ox, oy) and \a aPosiition.. * depending on it's position from the origin (ox, oy) and \a aPosiition..
......
...@@ -65,7 +65,7 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -65,7 +65,7 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
screen->ClrRefreshReq(); screen->ClrRefreshReq();
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
/* Redraw the cursor */ /* Redraw the cursor */
DrawPanel->DrawCursor( DC ); DrawPanel->DrawCursor( DC );
...@@ -103,7 +103,7 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -103,7 +103,7 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->ClrRefreshReq(); GetScreen()->ClrRefreshReq();
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
// Redraw the cursor // Redraw the cursor
DrawPanel->DrawCursor( DC ); DrawPanel->DrawCursor( DC );
......
...@@ -21,13 +21,15 @@ bool s_Verbose = false; // false if zone outline diags must not be shown ...@@ -21,13 +21,15 @@ bool s_Verbose = false; // false if zone outline diags must not be shown
// Outline creation: // Outline creation:
static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase ); static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase );
// Corner moving // Corner moving
static void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* panel, static void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel,
wxDC* DC, wxDC* aDC,
bool erase ); const wxPoint& aPosition,
bool aErase );
/* Local variables */ /* Local variables */
static wxPoint s_CornerInitialPosition; // Used to abort a move corner command static wxPoint s_CornerInitialPosition; // Used to abort a move corner command
...@@ -116,8 +118,9 @@ int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC ) ...@@ -116,8 +118,9 @@ int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC )
if( zone->GetNumCorners() > 2 ) if( zone->GetNumCorners() > 2 )
{ {
zone->m_Poly->DeleteCorner( zone->GetNumCorners() - 1 ); zone->m_Poly->DeleteCorner( zone->GetNumCorners() - 1 );
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false ); DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
} }
else else
{ {
...@@ -425,22 +428,21 @@ void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -425,22 +428,21 @@ void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC )
} }
/*************************************************************************************************/
void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* Panel, wxDC* DC, bool erase )
/*************************************************************************************************/
/* Redraws the zone outline when moving a corner according to the cursor position /* Redraws the zone outline when moving a corner according to the cursor position
*/ */
void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{ {
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->GetParent(); WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) aPanel->GetParent();
ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem(); ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem();
if( erase ) /* Undraw edge in old position*/ if( aErase ) /* Undraw edge in old position*/
{ {
zone->Draw( Panel, DC, GR_XOR ); zone->Draw( aPanel, aDC, GR_XOR );
} }
wxPoint pos = pcbframe->GetScreen()->m_Curseur; wxPoint pos = pcbframe->GetScreen()->m_Curseur;
if( zone->m_Flags == IS_MOVED ) if( zone->m_Flags == IS_MOVED )
{ {
wxPoint offset; wxPoint offset;
...@@ -458,7 +460,7 @@ void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* Panel, wxDC* ...@@ -458,7 +460,7 @@ void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* Panel, wxDC*
else else
zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y ); zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y );
zone->Draw( Panel, DC, GR_XOR ); zone->Draw( aPanel, aDC, GR_XOR );
} }
...@@ -722,14 +724,12 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC ) ...@@ -722,14 +724,12 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC )
} }
/******************************************************************************************/
static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
/******************************************************************************************/
/* Redraws the zone outlines when moving mouse /* Redraws the zone outlines when moving mouse
*/ */
static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{ {
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) panel->GetParent(); WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) aPanel->GetParent();
wxPoint c_pos = pcbframe->GetScreen()->m_Curseur; wxPoint c_pos = pcbframe->GetScreen()->m_Curseur;
ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour; ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour;
...@@ -737,12 +737,13 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* panel, wxDC* DC, boo ...@@ -737,12 +737,13 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* panel, wxDC* DC, boo
return; return;
int icorner = zone->GetNumCorners() - 1; int icorner = zone->GetNumCorners() - 1;
if ( icorner < 1 ) if ( icorner < 1 )
return; // We must have 2 (or more) corners return; // We must have 2 (or more) corners
if( erase ) /* Undraw edge in old position*/ if( aErase ) /* Undraw edge in old position*/
{ {
zone->DrawWhileCreateOutline( panel, DC ); zone->DrawWhileCreateOutline( aPanel, aDC );
} }
/* Redraw the curent edge in its new position */ /* Redraw the curent edge in its new position */
...@@ -755,7 +756,7 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* panel, wxDC* DC, boo ...@@ -755,7 +756,7 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* panel, wxDC* DC, boo
zone->SetCornerPosition( icorner, c_pos ); zone->SetCornerPosition( icorner, c_pos );
zone->DrawWhileCreateOutline( panel, DC ); zone->DrawWhileCreateOutline( aPanel, aDC );
} }
......
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