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
Block->m_Flags = 0;
Block->m_Command = (CmdBlockType) ReturnBlockCommand( key );
if( Block->m_Command == 0 )
return FALSE;
......@@ -216,7 +217,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
return TRUE;
}
Block->m_State = STATE_BLOCK_MOVE;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, startpos, FALSE );
break;
default:
......@@ -240,21 +241,22 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
* by Initm_BlockLocateDatas().
* 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;
PtBlock = &panel->GetScreen()->m_BlockLocate;
PtBlock = &aPanel->GetScreen()->m_BlockLocate;
PtBlock->m_MoveVector = wxPoint( 0, 0 );
if( erase )
PtBlock->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
if( aErase )
PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color );
PtBlock->m_BlockLastCursorPosition = panel->GetScreen()->m_Curseur;
PtBlock->SetEnd( panel->GetScreen()->m_Curseur );
PtBlock->m_BlockLastCursorPosition = aPanel->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 )
{
......@@ -275,7 +277,7 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Panel->ManageCurseur ) /* Erase current drawing
* on screen */
{
Panel->ManageCurseur( Panel, DC, FALSE ); /* Clear block outline. */
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, false ); /* Clear block outline. */
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
screen->SetCurItem( NULL );
......
......@@ -78,6 +78,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype,
m_LastGridSizeId = 0;
m_DrawGrid = true; // hide/Show grid. default = show
m_GridColor = DARKGRAY; // Grid color
m_snapToGrid = true;
// Internal units per inch: = 1000 for schema, = 10000 for PCB
m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
......@@ -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 )
{
return 0;
......
......@@ -52,30 +52,30 @@ SCH_ITEM::~SCH_ITEM()
* for an "old" item, saving it in undo list must be done before editiing,
* 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 )
{
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 );
frame->SetRepeatItem( this );
frame->SaveCopyInUndoList( this, UR_NEW );
aFrame->SetRepeatItem( this );
aFrame->SaveCopyInUndoList( this, UR_NEW );
}
m_Flags = 0;
frame->GetScreen()->SetModify();
frame->GetScreen()->SetCurItem( NULL );
frame->DrawPanel->ManageCurseur = NULL;
frame->DrawPanel->ForceCloseManageCurseur = NULL;
screen->SetModify();
screen->SetCurItem( NULL );
aFrame->DrawPanel->ManageCurseur = NULL;
aFrame->DrawPanel->ForceCloseManageCurseur = NULL;
if( DC )
if( aDC )
{
frame->DrawPanel->CursorOff( DC ); // Erase schematic cursor
Draw( frame->DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
frame->DrawPanel->CursorOn( DC ); // Display schematic cursor
aFrame->DrawPanel->CursorOff( aDC ); // Erase schematic cursor
Draw( aFrame->DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
aFrame->DrawPanel->CursorOn( aDC ); // Display schematic cursor
}
}
......
......@@ -490,7 +490,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControle( wxDC* aDC, wxPoint aPosition )
if( DrawPanel->ManageCurseur )
{
DrawPanel->ManageCurseur( DrawPanel, aDC, 0 );
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, 0 );
}
}
......
......@@ -38,7 +38,8 @@ extern void DuplicateItemsInList( SCH_SCREEN* screen,
PICKED_ITEMS_LIST& aItemsList,
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
......@@ -130,7 +131,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
SaveCopyInUndoList( block->m_ItemsSelection, UR_MOVED, block->m_MoveVector );
MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector );
......@@ -140,7 +141,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_COPY: /* Copy */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DuplicateItemsInList( GetScreen(), block->m_ItemsSelection, block->m_MoveVector );
......@@ -152,7 +153,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_PASTE:
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
PasteListOfItems( DC );
block->ClearItemsList();
break;
......@@ -250,14 +251,14 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
{
nextcmd = true;
GetScreen()->SelectBlockItems();
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
block->m_State = STATE_BLOCK_MOVE;
}
else
{
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
}
......@@ -265,7 +266,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_DELETE: /* Delete */
GetScreen()->UpdatePickList();
DrawAndSizingBlockOutlines( DrawPanel, DC, false );
DrawAndSizingBlockOutlines( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() )
{
......@@ -280,7 +281,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_SAVE: /* Save */
GetScreen()->UpdatePickList();
DrawAndSizingBlockOutlines( DrawPanel, DC, false );
DrawAndSizingBlockOutlines( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() )
{
......@@ -370,7 +371,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_DRAG: /* move to Drag */
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:
block->ClearItemsList();
......@@ -384,7 +385,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
GetScreen()->SelectBlockItems();
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
block->m_State = STATE_BLOCK_MOVE;
}
......@@ -392,7 +393,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_DELETE: /* move to Delete */
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() )
{
......@@ -406,7 +407,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_SAVE: /* Save list in paste buffer*/
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() )
{
......@@ -425,7 +426,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_ROTATE:
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() )
{
/* Compute the rotation center and put it on grid */
......@@ -442,7 +443,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_MIRROR_X:
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() )
{
......@@ -459,7 +460,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
case BLOCK_MIRROR_Y:
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( block->GetCount() )
{
......@@ -496,33 +497,33 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
/* Traces the outline of the search block structures
* 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 = panel->GetScreen();
BASE_SCREEN* screen = aPanel->GetScreen();
BLOCK_SELECTOR* block = &screen->m_BlockLocate;;
SCH_ITEM* schitem;
/* 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++ )
{
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. */
block->m_MoveVector = screen->m_Curseur - block->m_BlockLastCursorPosition;
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++ )
{
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 @@
#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 )
nextCmd = true;
if( DrawPanel->ManageCurseur != NULL )
{
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
}
break;
......@@ -184,7 +185,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DrawPanel->ForceCloseManageCurseur = NULL;
GetScreen()->SetCurItem( NULL );
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 )
*/
void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
{
bool err = FALSE;
bool err = false;
wxPoint pt;
if( DrawPanel->ManageCurseur == NULL )
{
err = TRUE;
err = true;
DisplayError( this, wxT( "HandleBlockPLace : ManageCurseur = NULL" ) );
}
......@@ -214,7 +215,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
switch( GetScreen()->m_BlockLocate.m_Command )
{
case BLOCK_IDLE:
err = TRUE;
err = true;
break;
case BLOCK_DRAG: /* Drag */
......@@ -227,7 +228,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
pt.y *= -1;
if ( m_component )
m_component->MoveSelectedItems( pt );
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
break;
case BLOCK_COPY: /* Copy */
......@@ -270,7 +271,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL );
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
}
......@@ -280,14 +281,15 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
* Traces the outline of the search block structures
* 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;
BASE_SCREEN* screen = panel->GetScreen();
BASE_SCREEN* screen = aPanel->GetScreen();
wxPoint move_offset;
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 );
LIB_COMPONENT* component = parent->GetComponent();
......@@ -298,11 +300,11 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
int unit = parent->GetUnit();
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 );
}
......@@ -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.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
GRSetDrawMode( DC, g_XorMode );
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
GRSetDrawMode( aDC, g_XorMode );
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 );
}
......@@ -73,7 +73,8 @@ static void RestoreOldWires( SCH_SCREEN* screen )
/**
* 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* segment;
......@@ -149,7 +150,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
if( !newsegment ) /* first point : Create first wire or bus */
{
s_ConnexionStartPoint = cursorpos;
s_OldWiresList = GetScreen()->ExtractWires( TRUE );
s_OldWiresList = GetScreen()->ExtractWires( true );
GetScreen()->SchematicCleanUp( DrawPanel );
switch( type )
......@@ -203,7 +204,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
return;
}
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
/* Creates the new segment, or terminates the command
* if the end point is on a pin, junction or an other wire or bus */
......@@ -239,7 +240,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
oldsegment->m_Flags = SELECTED;
newsegment->m_Flags = IS_NEW;
GetScreen()->SetCurItem( newsegment );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
/* This is the first segment: Now we know the start segment position.
* Create a junction if needed. Note: a junction can be needed later,
......@@ -479,11 +480,11 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
/* Cancel trace in progress */
if( GetScreen()->GetCurItem()->Type() == SCH_POLYLINE_T )
{
Show_Polyline_in_Ghost( DrawPanel, DC, FALSE );
Show_Polyline_in_Ghost( DrawPanel, DC, false );
}
else
{
DrawSegment( DrawPanel, DC, FALSE );
DrawSegment( DrawPanel, DC, wxDefaultPosition, false );
}
EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), GetScreen() );
......@@ -519,17 +520,16 @@ SCH_JUNCTION* SCH_EDIT_FRAME::CreateNewJunctionStruct( wxDC* DC,
}
/* Routine to create new NoConnect struct. */
SCH_NO_CONNECT* SCH_EDIT_FRAME::CreateNewNoConnectStruct( wxDC* DC )
SCH_NO_CONNECT* SCH_EDIT_FRAME::AddNoConnect( wxDC* aDC, const wxPoint& aPosition )
{
SCH_NO_CONNECT* NewNoConnect;
NewNoConnect = new SCH_NO_CONNECT( GetScreen()->m_Curseur );
NewNoConnect = new SCH_NO_CONNECT( aPosition );
m_itemToRepeat = NewNoConnect;
DrawPanel->CursorOff( DC ); // Erase schematic cursor
NewNoConnect->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // Display schematic cursor
DrawPanel->CursorOff( aDC ); // Erase schematic cursor
NewNoConnect->Draw( DrawPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( aDC ); // Display schematic cursor
NewNoConnect->SetNext( GetScreen()->GetDrawItems() );
GetScreen()->SetDrawItems( NewNoConnect );
......@@ -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. :
* for a WIRE, if at pos is found:
* - a junction
......@@ -669,7 +669,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
item = PickStruct( pos, screen, BUS_T );
if( item )
return TRUE;
return true;
pinsheet = screen->GetSheetLabel( pos );
......@@ -678,21 +678,21 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
itempos = pinsheet->m_Pos;
if( (itempos.x == pos.x) && (itempos.y == pos.y) )
return TRUE;
return true;
}
break;
case LAYER_NOTES:
item = PickStruct( pos, screen, DRAW_ITEM_T );
if( item )
return TRUE;
return true;
break;
case LAYER_WIRE:
item = PickStruct( pos, screen, BUS_ENTRY_T | JUNCTION_T );
if( item )
return TRUE;
return true;
pin = screen->GetPin( pos, &LibItem );
......@@ -705,19 +705,19 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
itempos.y += LibItem->m_Pos.y;
if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) )
return TRUE;
return true;
}
item = PickStruct( pos, screen, WIRE_T );
if( item )
return TRUE;
return true;
item = PickStruct( pos, screen, LABEL_T );
if( item && (item->Type() != SCH_TEXT_T)
&& ( ( (SCH_GLOBALLABEL*) item )->m_Pos.x == pos.x )
&& ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) )
return TRUE;
return true;
pinsheet = screen->GetSheetLabel( pos );
......@@ -726,7 +726,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
itempos = pinsheet->m_Pos;
if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) )
return TRUE;
return true;
}
break;
......@@ -735,7 +735,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
break;
}
return FALSE;
return false;
}
......@@ -750,16 +750,16 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
bool IsJunctionNeeded( SCH_EDIT_FRAME* frame, wxPoint& pos )
{
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 | ENDPOINTS_ONLY_T ) )
return TRUE;
return 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 )
}
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
BASE_SCREEN* screen = panel->GetScreen();
BASE_SCREEN* screen = aPanel->GetScreen();
SCH_BUS_ENTRY* BusEntry = (SCH_BUS_ENTRY*) screen->GetCurItem();
if( BusEntry == NULL )
return;
/* Erase the last segment position. */
if( erase )
BusEntry->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( aErase )
BusEntry->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
/* Redraw at the new position. */
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 )
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 )
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 )
if( DrawPanel->ManageCurseur )
{
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE );
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, TRUE );
}
}
......
......@@ -17,7 +17,8 @@
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" ) );
/*
* 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;
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();
if( currentField == NULL )
......@@ -193,9 +195,10 @@ static void MoveCmpField( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
fieldNdx = currentField->m_FieldId;
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;
......@@ -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
// and we know the actual position.
// 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();
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 @@
#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 );
......@@ -69,7 +70,7 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
GetScreen()->SetCurItem( TextStruct );
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
DrawPanel->CursorOn( DC );
}
......@@ -184,13 +185,14 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* DC, int type )
/************************************/
/* 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*/
if( erase )
TextStruct->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( aErase )
TextStruct->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
/* redraw the text */
switch( TextStruct->Type() )
......@@ -199,14 +201,14 @@ static void ShowWhileMoving( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
case SCH_TEXT_T:
( (SCH_TEXT*) TextStruct )->m_Pos = panel->GetScreen()->m_Curseur;
( (SCH_TEXT*) TextStruct )->m_Pos = aPanel->GetScreen()->m_Curseur;
break;
default:
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 )
GetScreen()->ClrRefreshReq();
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->DrawCursor( DC );
......
......@@ -22,7 +22,8 @@
#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 TRANSFORM OldTransform;
......@@ -221,22 +222,21 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* DC,
/**
* 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;
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
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;
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 )
GetScreen()->ClrRefreshReq();
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->DrawCursor( DC );
......
......@@ -29,10 +29,11 @@ static wxArrayString s_PowerNameList;
void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{
SCH_ITEM* item = GetScreen()->GetCurItem();
wxPoint gridPosition = GetGridPosition( aPosition );
if( ( m_ID_current_state == 0 ) || ( item && item->m_Flags ) )
{
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
m_itemToRepeat = NULL;
if( item && item->m_Flags )
......@@ -52,7 +53,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
item->Place( this, aDC );
GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
return;
case SCH_SCREEN_T:
......@@ -103,35 +104,35 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_NOCONN_BUTT:
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
m_itemToRepeat = CreateNewNoConnectStruct( aDC );
m_itemToRepeat = AddNoConnect( aDC, gridPosition );
GetScreen()->SetCurItem( m_itemToRepeat );
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->m_AutoPAN_Request = true;
}
else
{
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
}
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
break;
case ID_JUNCTION_BUTT:
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 );
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->m_AutoPAN_Request = true;
}
else
{
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
}
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
break;
case ID_WIRETOBUS_ENTRY_BUTT:
......@@ -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 ) ?
WIRE_TO_BUS : BUS_TO_BUS );
GetScreen()->SetCurItem( item );
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->m_AutoPAN_Request = true;
}
else
{
......@@ -149,7 +150,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( true );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
}
break;
......@@ -158,34 +159,34 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
OnModify();
GetScreen()->SetCurItem( NULL );
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
break;
case ID_WIRE_BUTT:
BeginSegment( aDC, LAYER_WIRE );
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->m_AutoPAN_Request = true;
break;
case ID_BUS_BUTT:
BeginSegment( aDC, LAYER_BUS );
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->m_AutoPAN_Request = true;
break;
case ID_LINE_COMMENT_BUTT:
BeginSegment( aDC, LAYER_NOTES );
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->m_AutoPAN_Request = true;
break;
case ID_TEXT_COMMENT_BUTT:
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_NOTES ) );
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->m_AutoPAN_Request = true;
}
else
{
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
}
break;
......@@ -193,14 +194,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_LOCLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->m_AutoPAN_Request = true;
}
else
{
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
}
break;
......@@ -214,14 +215,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if(m_ID_current_state == ID_HIERLABEL_BUTT)
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) );
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->m_AutoPAN_Request = true;
}
else
{
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
}
break;
......@@ -229,14 +230,14 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
GetScreen()->SetCurItem( CreateSheet( aDC ) );
DrawPanel->m_AutoPAN_Request = TRUE;
DrawPanel->m_AutoPAN_Request = true;
}
else
{
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
}
break;
......@@ -259,22 +260,22 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
{
item->Place( this, aDC );
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
}
break;
case ID_COMPONENT_BUTT:
if( (item == NULL) || (item->m_Flags == 0) )
{
GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, TRUE ) );
DrawPanel->m_AutoPAN_Request = TRUE;
GetScreen()->SetCurItem( Load_Component( aDC, wxEmptyString, s_CmpNameList, true ) );
DrawPanel->m_AutoPAN_Request = true;
}
else
{
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
}
break;
......@@ -282,15 +283,15 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
{
GetScreen()->SetCurItem( Load_Component( aDC, wxT( "power" ),
s_PowerNameList, FALSE ) );
DrawPanel->m_AutoPAN_Request = TRUE;
s_PowerNameList, false ) );
DrawPanel->m_AutoPAN_Request = true;
}
else
{
item->Place( this, aDC );
DrawPanel->m_AutoPAN_Request = FALSE;
DrawPanel->m_AutoPAN_Request = false;
GetScreen()->TestDanglingEnds();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
}
break;
......
......@@ -22,7 +22,7 @@
static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, bool asDeMorgan );
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;
......@@ -336,9 +336,10 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
/* Move pin to the current mouse position. This function is called by the
* 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 )
return;
......@@ -352,16 +353,16 @@ static void DrawMovePin( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
bool showPinText = true;
/* Erase pin in old position */
if( erase )
if( aErase )
{
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 );
}
/* Redraw pin in new position */
CurrentPin->SetPosition( panel->GetScreen()->GetCursorDrawPosition() );
CurrentPin->Draw( panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform );
CurrentPin->SetPosition( aPanel->GetScreen()->GetCursorDrawPosition() );
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform );
PinPreviousPos = CurrentPin->GetPosition();
......
......@@ -221,7 +221,8 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
/* Move selected sheet with the cursor.
* 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;
BASE_SCREEN* screen = aPanel->GetScreen();
......@@ -264,7 +265,7 @@ static void ExitSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
wxPoint curspos = screen->m_Curseur;
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->m_Flags = 0;
screen->m_Curseur = curspos;
......@@ -307,8 +308,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
DrawPanel->ManageCurseur = MoveOrResizeSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, aDC, false );
DrawPanel->ManageCurseur( DrawPanel, aDC, wxDefaultPosition, false );
return sheet;
}
......@@ -343,7 +343,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
DrawPanel->ManageCurseur = MoveOrResizeSheet;
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
{
......@@ -366,7 +366,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
aSheet->m_Flags |= IS_MOVED;
DrawPanel->ManageCurseur = MoveOrResizeSheet;
DrawPanel->ForceCloseManageCurseur = ExitSheet;
DrawPanel->ManageCurseur( DrawPanel, aDC, true );
DrawPanel->ManageCurseur( DrawPanel, aDC, wxDefaultPosition, true );
DrawPanel->CursorOn( aDC );
if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo
......
......@@ -20,7 +20,8 @@
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;
......@@ -103,23 +104,24 @@ void SCH_EDIT_FRAME::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC )
DrawPanel->ManageCurseur = Move_PinSheet;
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 )
return;
if( erase )
SheetLabel->Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode );
if( aErase )
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 )
DrawPanel->ManageCurseur = Move_PinSheet;
DrawPanel->ForceCloseManageCurseur = ExitPinSheet;
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, true );
OnModify();
return NewSheetLabel;
......@@ -243,7 +245,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC )
GetScreen()->SetCurItem( NewSheetLabel );
DrawPanel->ManageCurseur = Move_PinSheet;
DrawPanel->ForceCloseManageCurseur = ExitPinSheet;
Move_PinSheet( DrawPanel, DC, FALSE );
Move_PinSheet( DrawPanel, DC, wxDefaultPosition, false );
return NewSheetLabel;
}
......
......@@ -23,8 +23,10 @@
#include "dialogs/dialog_lib_edit_draw_item.h"
static void SymbolDisplayDraw( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase );
static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase );
static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
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*
m_drawItem->SetConvert( m_convert );
// Draw initial symbol:
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
}
else
{
......@@ -230,28 +232,30 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC )
/*
* 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;
item = ( (LIB_EDIT_FRAME*) panel->GetParent() )->GetDrawItem();
item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
if( item == NULL )
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->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 );
item->Draw( panel, DC, Screen->GetCursorDrawPosition(), -1, g_XorMode, &text,
item->Draw( aPanel, aDC, Screen->GetCursorDrawPosition(), -1, g_XorMode, &text,
DefaultTransform );
}
else
item->Draw( panel, DC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL,
item->Draw( aPanel, aDC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL,
DefaultTransform );
}
......@@ -267,7 +271,7 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC )
m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCursorDrawPosition() );
DrawPanel->ManageCurseur = RedrawWhileMovingCursor;
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 )
m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCursorDrawPosition() );
DrawPanel->ManageCurseur = SymbolDisplayDraw;
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.
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();
LIB_DRAW_ITEM* item = ( (LIB_EDIT_FRAME*) panel->GetParent() )->GetDrawItem();
BASE_SCREEN* Screen = aPanel->GetScreen();
LIB_DRAW_ITEM* item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
if( item == NULL )
return;
item->SetEraseLastDrawItem( erase );
item->Draw( panel, DC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL,
item->SetEraseLastDrawItem( aErase );
item->Draw( aPanel, aDC, Screen->GetCursorDrawPosition(), -1, g_XorMode, NULL,
DefaultTransform );
}
......
......@@ -153,8 +153,8 @@ int TEMPLATES::AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName )
{
if( m_Fields[i].m_Name == aFieldName.m_Name )
{
// D(printf("inserting template fieldname:'%s' at %d\n",
// aFieldName.m_Name.utf8_str(), i );)
D( printf( "inserting template fieldname:'%s' at %d\n",
CONV_TO_UTF8( aFieldName.m_Name ), i ); )
m_Fields[i] = aFieldName;
return i; // return the container index
......
......@@ -41,7 +41,8 @@
#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
* the key (ALT, SHIFT ALT ..)
......@@ -106,14 +107,14 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
Block_Move( DC );
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_COPY: /* Copy */
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
Block_Duplicate( DC );
GetScreen()->m_BlockLocate.ClearItemsList();
break;
......@@ -180,14 +181,14 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list */
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
nextcmd = true;
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
break;
case BLOCK_DELETE: /* Delete */
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
Block_Delete( DC );
break;
......@@ -228,29 +229,29 @@ bool WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
/* 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;
BASE_SCREEN* screen = panel->GetScreen();
BASE_SCREEN* screen = aPanel->GetScreen();
Color = YELLOW;
if( erase )
if( aErase )
{
screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode,
Color );
if( screen->m_BlockLocate.m_MoveVector.x
|| screen->m_BlockLocate.m_MoveVector.y )
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 )
{
screen->m_BlockLocate.Draw( panel,
DC,
screen->m_BlockLocate.Draw( aPanel,
aDC,
screen->m_BlockLocate.m_MoveVector,
g_XorMode,
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.GetRight();
......@@ -258,12 +259,12 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase
screen->m_BlockLocate.GetBottom();
}
screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, Color );
if( screen->m_BlockLocate.m_MoveVector.x
|| screen->m_BlockLocate.m_MoveVector.y )
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 )
{
screen->m_BlockLocate.Draw( panel,
DC,
screen->m_BlockLocate.Draw( aPanel,
aDC,
screen->m_BlockLocate.m_MoveVector,
g_XorMode,
Color );
......
......@@ -83,7 +83,7 @@ void WinEDA_GerberFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
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 )
wxPoint( 0, 0 ) );
// 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
// mainly in COPY mode
// because most of time the actual background is erased by succesive drawings of each gerber
// layer mainly in COPY mode
DrawPanel->DrawBackGround( DC );
if( IsElementVisible( DCODES_VISIBLE ) )
......@@ -111,7 +111,7 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
TraceWorkSheet( DC, screen, 0 );
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
DrawPanel->DrawCursor( DC );
......
......@@ -144,7 +144,8 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC );
* by InitBlockLocateDatas().
* 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__ */
......@@ -71,10 +71,11 @@ public:
/* Cursor management (used in editing functions) */
/* 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. */
void (*ForceCloseManageCurseur)( EDA_DRAW_PANEL* panel, wxDC* DC );
void (*ForceCloseManageCurseur)( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
public:
......
......@@ -76,7 +76,6 @@ private:
wxString m_DefaultSchematicFileName;
SCH_FIELD* m_CurrentField;
int m_TextFieldSize;
bool m_ShowGrid;
PARAM_CFG_ARRAY m_projectFileParams;
PARAM_CFG_ARRAY m_configSettings;
wxPageSetupDialogData m_pageSetupData;
......@@ -448,8 +447,14 @@ private:
void StartMoveBusEntry( SCH_BUS_ENTRY* DrawLibItem,
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
SCH_JUNCTION* CreateNewJunctionStruct( wxDC* DC,
......
......@@ -243,6 +243,7 @@ protected:
private:
BASE_SCREEN* m_CurrentScreen; ///< current used SCREEN
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
protected:
void SetBaseScreen( BASE_SCREEN* aScreen )
......@@ -284,6 +285,7 @@ public:
void EraseMsgBox();
void Process_PageSettings( wxCommandEvent& event );
virtual void SetToolbars();
/**
* Function SetLanguage
* called on a language menu selection
......@@ -352,6 +354,15 @@ public:
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.
......
......@@ -35,9 +35,11 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset
* handles drawing of a moving block
* @param aPanel = Current draw panel
* @param aDC = Current device context
* @param aPosition The cursor position in logical (drawing) units.
* @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;
......@@ -219,14 +221,14 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
case BLOCK_MOVE: /* Move */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
Block_Move();
GetScreen()->m_BlockLocate.ClearItemsList();
break;
case BLOCK_COPY: /* Copy */
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
Block_Duplicate();
GetScreen()->m_BlockLocate.ClearItemsList();
break;
......@@ -285,19 +287,20 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
return false;
}
// Show dialog if there are no selected items and
// we're not zooming
// Show dialog if there are no selected items and we're not zooming
if( !GetScreen()->m_BlockLocate.GetCount()
&& GetScreen()->m_BlockLocate.m_Command != BLOCK_ZOOM )
{
if( !InstallBlockCmdFrame( this, _( "Block Operation" ) ) )
{
cancelCmd = true;
DrawPanel->ManageCurseur( DrawPanel, DC, false ); // undraw block outline
// undraw block outline
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
}
else
{
DrawAndSizingBlockOutlines( DrawPanel, DC, false );
DrawAndSizingBlockOutlines( DrawPanel, DC, wxDefaultPosition, false );
Block_SelectItems();
// Exit if no items found
......@@ -323,7 +326,7 @@ bool WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
nextcmd = true;
DrawPanel->ManageCurseur = drawMovingBlock;
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
break;
case BLOCK_DELETE: /* Delete */
......@@ -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();
if( aErase )
{
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( aPanel, aDC, screen->m_BlockLocate.m_MoveVector,
GR_XOR, BLOCK_OUTLINE_COLOR );
......
......@@ -24,7 +24,8 @@
#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 void ClearMarkItems( MODULE* module );
......@@ -128,9 +129,9 @@ bool WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
nextcmd = true;
if( DrawPanel->ManageCurseur != NULL )
{
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
}
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
DrawPanel->Refresh( TRUE );
......@@ -289,28 +290,29 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
/* Traces the outline of the search block structures
* 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;
BASE_SCREEN* screen = panel->GetScreen();
BASE_SCREEN* screen = aPanel->GetScreen();
BOARD_ITEM* item;
wxPoint move_offset;
MODULE* currentModule =
( (WinEDA_BasePcbFrame*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules;
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->m_Color );
PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
if( currentModule )
{
move_offset.x = -PtBlock->m_MoveVector.x;
move_offset.y = -PtBlock->m_MoveVector.y;
item = currentModule->m_Drawings;
for( ; item != NULL; item = item->Next() )
{
if( item->m_Selected == 0 )
......@@ -320,7 +322,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase
{
case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE:
item->Draw( panel, DC, g_XorMode, move_offset );
item->Draw( aPanel, aDC, g_XorMode, move_offset );
break;
default:
......@@ -329,27 +331,26 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase
}
D_PAD* pad = currentModule->m_Pads;
for( ; pad != NULL; pad = pad->Next() )
{
if( pad->m_Selected == 0 )
continue;
pad->Draw( panel, DC, g_XorMode, move_offset );
pad->Draw( aPanel, aDC, g_XorMode, move_offset );
}
}
}
/* Repaint new view. */
PtBlock->m_MoveVector =
screen->m_Curseur - PtBlock->m_BlockLastCursorPosition;
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode,
PtBlock->m_Color );
PtBlock->m_MoveVector = screen->m_Curseur - PtBlock->m_BlockLastCursorPosition;
PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
if( currentModule )
{
item = currentModule->m_Drawings;
move_offset = - PtBlock->m_MoveVector;
for( ; item != NULL; item = item->Next() )
{
if( item->m_Selected == 0 )
......@@ -359,7 +360,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase
{
case TYPE_TEXTE_MODULE:
case TYPE_EDGE_MODULE:
item->Draw( panel, DC, g_XorMode, move_offset );
item->Draw( aPanel, aDC, g_XorMode, move_offset );
break;
default:
......@@ -368,11 +369,13 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase
}
D_PAD* pad = currentModule->m_Pads;
for( ; pad != NULL; pad = pad->Next() )
{
if( pad->m_Selected == 0 )
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 )
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_.
* 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++ )
* 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.
* DrawPanel->m_IgnoreMouseEvents = TRUE;
* DrawPanel->m_IgnoreMouseEvents = true;
*/
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection()
......@@ -216,7 +216,7 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
DrawPanel->MouseToCursorSchema();
// DrawPanel->m_IgnoreMouseEvents = FALSE;
// DrawPanel->m_IgnoreMouseEvents = false;
// The function ProcessItemSelection() has set the current item, return it.
item = GetCurItem();
......@@ -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
* 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 )
keep_on_grid = FALSE;
keep_on_grid = false;
/* Cursor is left off grid if no block in progress and no moving object */
if( GetScreen()->m_BlockLocate.m_State != STATE_NO_BLOCK )
keep_on_grid = TRUE;
keep_on_grid = true;
EDA_ITEM* DrawStruct = GetScreen()->GetCurItem();
if( DrawStruct && DrawStruct->m_Flags )
keep_on_grid = TRUE;
keep_on_grid = true;
if( keep_on_grid )
{
......@@ -357,9 +357,9 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* aDC, const wxPoint& aPosition )
#ifdef USE_WX_OVERLAY
wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC );
oDC.Clear();
DrawPanel->ManageCurseur( DrawPanel, aDC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, false );
#else
DrawPanel->ManageCurseur( DrawPanel, aDC, TRUE );
DrawPanel->ManageCurseur( DrawPanel, aDC, aPosition, true );
#endif
}
#ifdef USE_WX_OVERLAY
......
......@@ -31,8 +31,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
return NULL;
}
if( aTrack->m_Flags & IS_NEW ) // Trace in progress, erase the last
// segment
if( aTrack->m_Flags & IS_NEW ) // Trace in progress, erase the last segment
{
if( g_CurrentTrackList.GetCount() > 0 )
{
......@@ -41,7 +40,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
D( g_CurrentTrackList.VerifyListIntegrity(); )
// Delete the current trace
ShowNewTrackWhenMovingCursor( DrawPanel, DC, FALSE );
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, FALSE );
// delete the most recently entered
delete g_CurrentTrackList.PopBack();
......@@ -98,7 +97,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
else
{
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
return g_CurrentTrackSegment;
}
......
......@@ -14,7 +14,8 @@
/* Loca functions */
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 : */
static int status_dimension; /* Used in cimension creation:
......@@ -295,25 +296,24 @@ DIMENSION* WinEDA_PcbFrame::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
}
/************************************************************************************/
static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
/************************************************************************************/
/* redessin du contour de la piste lors des deplacements de la souris */
static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{
PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetScreen();
PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem();
wxPoint pos = screen->m_Curseur;
if( Dimension == NULL )
return;
/* efface ancienne position */
if( erase )
// Erase previous dimension.
if( aErase )
{
Dimension->Draw( panel, DC, GR_XOR );
Dimension->Draw( aPanel, aDC, GR_XOR );
}
Dimension->SetLayer( screen->m_Active_Layer );
if( status_dimension == 1 )
{
Dimension->TraitD_ox = pos.x;
......@@ -346,7 +346,7 @@ static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* panel, wxDC* DC, bool
Dimension->AdjustDimensionDetails( );
}
Dimension->Draw( panel, DC, GR_XOR );
Dimension->Draw( aPanel, aDC, GR_XOR );
}
......
......@@ -19,9 +19,11 @@
#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 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;
static wxPoint MoveVector; // Move vector for move edge
......@@ -43,7 +45,7 @@ void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
DrawPanel->ManageCurseur = Move_Segment;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge_Module;
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 )
/* 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();
if( Edge == NULL )
......@@ -82,14 +84,14 @@ static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
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);
Edge->Draw( panel, DC, GR_XOR, MoveVector );
Edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
Module->Set_Rectangle_Encadrement();
}
......@@ -97,9 +99,10 @@ static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
/* 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();
if( Edge == NULL )
......@@ -109,7 +112,7 @@ static void ShowEdgeModule( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
// if( erase )
{
Edge->Draw( panel, DC, GR_XOR );
Edge->Draw( aPanel, aDC, GR_XOR );
}
Edge->m_End = screen->m_Curseur;
......@@ -118,7 +121,7 @@ static void ShowEdgeModule( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
Edge->m_End0 = Edge->m_End - Module->m_Pos;
RotatePoint( &Edge->m_End0, -Module->m_Orient );
Edge->Draw( panel, DC, GR_XOR );
Edge->Draw( aPanel, aDC, GR_XOR );
Module->Set_Rectangle_Encadrement();
}
......
......@@ -351,10 +351,13 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
* If a track is in progress, it will be redrawn
*/
if( DrawPanel->ManageCurseur == ShowNewTrackWhenMovingCursor )
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, false );
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false );
g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
if( DrawPanel->ManageCurseur == ShowNewTrackWhenMovingCursor )
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, false );
ShowNewTrackWhenMovingCursor( DrawPanel, &dc, wxDefaultPosition, false );
break;
case ID_POPUP_PCB_PLACE_MICROVIA:
......
......@@ -14,7 +14,8 @@
#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 );
......@@ -111,24 +112,25 @@ void WinEDA_PcbFrame::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
DrawPanel->ManageCurseur = Move_Texte_Pcb;
DrawPanel->ForceCloseManageCurseur = Abort_Edit_Pcb_Text;
SetCurItem( TextePcb );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
}
/* 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 )
return;
if( erase )
TextePcb->Draw( panel, DC, GR_XOR );
if( aErase )
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 @@
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 Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase );
static void Montre_Position_NewSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
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.
......@@ -35,7 +37,7 @@ void WinEDA_PcbFrame::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
DrawPanel->ManageCurseur = Move_Segment;
DrawPanel->ForceCloseManageCurseur = Exit_EditEdge;
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 )
/*
* 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;
if( Segment == NULL )
......@@ -69,16 +72,16 @@ static void Move_Segment( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
DisplayOpt.DisplayDrawItems = SKETCH;
if( erase )
Segment->Draw( panel, DC, GR_XOR );
if( aErase )
Segment->Draw( aPanel, aDC, GR_XOR );
wxPoint delta;
delta = panel->GetScreen()->m_Curseur - s_LastPosition;
delta = aPanel->GetScreen()->m_Curseur - s_LastPosition;
Segment->m_Start += 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;
}
......@@ -177,7 +180,7 @@ static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Segment->m_Flags & IS_NEW )
{
Panel->ManageCurseur( Panel, DC, FALSE );
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, false );
Segment ->DeleteStructure();
Segment = NULL;
}
......@@ -185,7 +188,7 @@ static void Exit_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
wxPoint pos = Panel->GetScreen()->m_Curseur;
Panel->GetScreen()->m_Curseur = s_InitialPosition;
Panel->ManageCurseur( Panel, DC, TRUE );
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->m_Curseur = pos;
Segment->m_Flags = 0;
Segment->Draw( Panel, DC, GR_OR );
......@@ -254,7 +257,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment,
Segment->m_Type = DrawItem->m_Type;
Segment->m_Angle = DrawItem->m_Angle;
Segment->m_Start = Segment->m_End = DrawItem->m_End;
Montre_Position_NewSegment( DrawPanel, DC, FALSE );
Montre_Position_NewSegment( DrawPanel, DC, wxDefaultPosition, false );
}
else
{
......@@ -293,9 +296,10 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
/* 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;
if( Segment == NULL )
......@@ -303,20 +307,20 @@ static void Montre_Position_NewSegment( EDA_DRAW_PANEL* panel, wxDC* DC, bool er
DisplayOpt.DisplayDrawItems = SKETCH;
if( erase )
Segment->Draw( panel, DC, GR_XOR );
if( aErase )
Segment->Draw( aPanel, aDC, GR_XOR );
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_End.x, &Segment->m_End.y );
}
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;
}
......@@ -142,7 +142,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
itmp = g_CurrentTrackList.GetCount();
Begin_Route( g_CurrentTrackSegment, DC );
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
/* create the via */
SEGVIA* via = new SEGVIA( GetBoard() );
......@@ -200,7 +200,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
/* DRC fault: the Via cannot be placed here ... */
delete via;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
// delete the track(s) added in Begin_Route()
while( g_CurrentTrackList.GetCount() > itmp )
......@@ -253,7 +253,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() );
}
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
via->DisplayInfo( this );
UpdateStatusBar();
......
......@@ -18,7 +18,8 @@
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 DeleteNullTrackSegments( BOARD* pcb, DLIST<TRACK>& aTrackList );
......@@ -41,7 +42,7 @@ static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( track && ( track->Type()==TYPE_VIA || track->Type()==TYPE_TRACK ) )
{
/* Erase the current drawing */
ShowNewTrackWhenMovingCursor( Panel, DC, false );
ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false );
if( g_HighLight_Status )
frame->High_Light( DC );
......@@ -192,7 +193,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
g_CurrentTrackSegment->DisplayInfoBase( this );
SetCurItem( g_CurrentTrackSegment, false );
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
if( Drc_On )
{
......@@ -203,8 +204,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
}
}
}
else /* Track in progress : segment coordinates are updated by
* ShowNewTrackWhenMovingCursor*/
else // Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor.
{
/* Tst for a D.R.C. error: */
if( Drc_On )
......@@ -241,7 +241,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
/* Erase old track on screen */
D( g_CurrentTrackList.VerifyListIntegrity(); );
ShowNewTrackWhenMovingCursor( DrawPanel, DC, false );
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
D( g_CurrentTrackList.VerifyListIntegrity(); );
......@@ -280,7 +280,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
D( g_CurrentTrackList.VerifyListIntegrity(); );
/* 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 )
if( Begin_Route( aTrack, DC ) == NULL )
return;
ShowNewTrackWhenMovingCursor( DrawPanel, DC, true );
ShowNewTrackWhenMovingCursor( DrawPanel, DC, false );
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, true );
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
trace_ratsnest_pad( DC );
/* cleanup
......@@ -669,18 +669,19 @@ static void PushTrack( EDA_DRAW_PANEL* panel )
/* 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(); );
PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetScreen();
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent();
PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) aPanel->GetParent();
bool Track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
DisplayOpt.DisplayPcbTrackFill = true;
int showTrackClearanceMode = DisplayOpt.ShowTrackClearanceMode;
if (g_FirstTrackSegment == NULL)
if ( g_FirstTrackSegment == NULL )
return;
NETCLASS* netclass = g_FirstTrackSegment->GetNetClass();
......@@ -689,22 +690,17 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
/* Erase old track */
if( erase )
if( aErase )
{
Trace_Une_Piste( panel,
DC,
g_FirstTrackSegment,
g_CurrentTrackList.GetCount(),
GR_XOR );
Trace_Une_Piste( aPanel, aDC, 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 )
{
int color =
g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
int color = 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,
( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(),
color );
......@@ -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
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
if( !frame->GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
g_CurrentTrackSegment->m_Width = frame->GetBoard()->GetCurrentTrackWidth();
if( g_TwoSegmentTrackBuild )
{
TRACK* previous_track = g_CurrentTrackSegment->Back();
if( previous_track && previous_track->Type()==TYPE_TRACK )
{
previous_track->SetLayer( screen->m_Active_Layer );
if( !frame->GetBoard()->GetBoardDesignSettings()->m_UseConnectedTrackWidth )
previous_track->m_Width =
frame->GetBoard()->GetCurrentTrackWidth();
previous_track->m_Width = frame->GetBoard()->GetCurrentTrackWidth();
}
}
......@@ -740,7 +737,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
g_CurrentTrackSegment->m_End = screen->m_Curseur;
if( Drc_On )
PushTrack( panel );
PushTrack( aPanel );
ComputeBreakPoint( g_CurrentTrackSegment,
g_CurrentTrackList.GetCount(),
......@@ -765,18 +762,13 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
/* Redraw the new track */
D( g_CurrentTrackList.VerifyListIntegrity(); );
Trace_Une_Piste( panel,
DC,
g_FirstTrackSegment,
g_CurrentTrackList.GetCount(),
GR_XOR );
Trace_Une_Piste( aPanel, aDC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
{
int color =
g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
int color = 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,
( netclass->GetViaDiameter() / 2 ) + netclass->GetClearance(),
color );
......@@ -811,7 +803,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
DisplayOpt.DisplayPcbTrackFill = Track_fill_copy;
frame->build_ratsnest_pad( NULL, g_CurrentTrackSegment->m_End, false );
frame->trace_ratsnest_pad( DC );
frame->trace_ratsnest_pad( aDC );
}
......
......@@ -13,7 +13,8 @@
#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 );
......@@ -190,7 +191,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
DrawPanel->ManageCurseur = Show_MoveTexte_Module;
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 )
}
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();
if( Text == NULL )
return;
// Erase umbilical and text if necessary
if( erase )
if( aErase )
{
Text->DrawUmbilical( panel, DC, GR_XOR, -MoveVector );
Text->Draw( panel, DC, GR_XOR, MoveVector );
Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );
Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
}
MoveVector = TextInitialPosition - screen->m_Curseur;
// Draw umbilical if text moved
if( MoveVector.x || MoveVector.y )
Text->DrawUmbilical( panel, DC, GR_XOR, -MoveVector );
Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );
// 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 )
......
......@@ -16,9 +16,10 @@
/* Routines Locales */
static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC );
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 );
/* Local variables : */
static int MireDefaultSize = 5000;
......@@ -279,18 +280,19 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
/* 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();
if( MirePcb == NULL )
return;
if( erase )
MirePcb->Draw( panel, DC, GR_XOR );
if( aErase )
MirePcb->Draw( aPanel, aDC, GR_XOR );
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
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 )
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 )
/* 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 )
return;
/* Erase current footprint. */
if( erase )
if( aErase )
{
DrawModuleOutlines( panel, DC, module );
DrawModuleOutlines( aPanel, aDC, module );
}
/* Redraw the module at the new position. */
g_Offset_Module = module->m_Pos - panel->GetScreen()->m_Curseur;
DrawModuleOutlines( panel, DC, module );
g_Offset_Module = module->m_Pos - aPanel->GetScreen()->m_Curseur;
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 )
/* 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;
BASE_SCREEN* screen = panel->GetScreen();
BASE_SCREEN* screen = aPanel->GetScreen();
D_PAD* pad = s_CurrentSelectedPad;
if( erase )
pad->Draw( panel, DC, GR_XOR );
if( aErase )
pad->Draw( aPanel, aDC, GR_XOR );
pad->m_Pos = screen->m_Curseur;
pad->Draw( panel, DC, GR_XOR );
pad->Draw( aPanel, aDC, GR_XOR );
if( !g_Drag_Pistes_On )
return;
......@@ -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++ )
{
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 )
{
Track->m_Start = pad->m_Pos;
}
if( g_DragSegmentList[ii].m_Pad_End )
{
Track->m_End = pad->m_Pos;
}
Track->Draw( panel, DC, GR_XOR );
Track->Draw( aPanel, aDC, GR_XOR );
}
}
......
......@@ -19,10 +19,12 @@
#include "protos.h"
static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase );
static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel,
wxDC* DC,
bool erase );
static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase );
static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aPosition,
bool aErase );
static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC );
static bool InitialiseDragParameters();
......@@ -59,7 +61,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
Panel->GetScreen()->m_Curseur = PosInit;
if( Panel->ManageCurseur )
Panel->ManageCurseur( Panel, DC, true );
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->m_Curseur = oldpos;
g_HighLight_Status = false;
......@@ -134,24 +136,25 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
/* 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;
wxPoint moveVector;
TRACK* Track;
BASE_SCREEN* screen = panel->GetScreen();
BASE_SCREEN* screen = aPanel->GetScreen();
int track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
int draw_mode = GR_XOR | GR_SURBRILL;
DisplayOpt.DisplayPcbTrackFill = false;
erase = true;
aErase = true;
/* erase the current moved track segments from screen */
if( erase )
if( aErase )
{
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 */
......@@ -162,22 +165,25 @@ static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
ii = NbPtNewTrack;
Track = NewTrack;
for( ; (ii > 0) && (Track != NULL); ii--, Track = Track->Next() )
{
if( Track->m_Flags & STARTPOINT )
Track->m_Start += moveVector;
if( Track->m_Flags & ENDPOINT )
Track->m_End += moveVector;
}
/* 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++ )
{
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 )
Track->m_Start += moveVector;
......@@ -185,13 +191,13 @@ static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
if( Track->m_Flags & ENDPOINT )
Track->m_End += moveVector;
Track->Draw( panel, DC, draw_mode );
Track->Draw( aPanel, aDC, draw_mode );
}
DisplayOpt.DisplayPcbTrackFill = track_fill_copy;
// Display track length
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent();
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) aPanel->GetParent();
Track->DisplayInfo( frame );
}
......@@ -236,15 +242,15 @@ static void Show_MoveNode( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
* when moving segments
* (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,
wxDC* DC, bool erase )
static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{
double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated
// intersection points
double tx1, tx2, ty1, ty2; // temporary storage of
// points
int dx, dy;
BASE_SCREEN* screen = panel->GetScreen();
BASE_SCREEN* screen = aPanel->GetScreen();
bool update = true;
TRACK* Track;
TRACK* tSegmentToStart = NULL, * tSegmentToEnd = NULL;
......@@ -260,9 +266,12 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel,
*/
int ii = g_DragSegmentList.size() - 1;
Track = g_DragSegmentList[ii].m_Segm;
if( Track == NULL )
return;
ii--;
if( ii >= 0)
{
if( s_EndSegmentPresent )
......@@ -271,6 +280,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel,
tSegmentToEnd = g_DragSegmentList[ii].m_Segm;
ii--;
}
if( s_StartSegmentPresent )
{
// 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,
}
int draw_mode = GR_XOR | GR_SURBRILL;
/* Undraw the current moved track segments before modification*/
// if( erase )
{
Track->Draw( panel, DC, draw_mode );
Track->Draw( aPanel, aDC, draw_mode );
if( tSegmentToStart )
tSegmentToStart->Draw( panel, DC, draw_mode );
tSegmentToStart->Draw( aPanel, aDC, draw_mode );
if( tSegmentToEnd )
tSegmentToEnd->Draw( panel, DC, draw_mode );
tSegmentToEnd->Draw( aPanel, aDC, draw_mode );
}
/* Compute the new track segment position */
......@@ -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_End.x = wxRound( xi2 );
Track->m_End.y = wxRound( yi2 );
if( tSegmentToEnd )
{
if( tSegmentToEnd->m_Flags & STARTPOINT )
......@@ -438,6 +451,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* panel,
else
tSegmentToEnd->m_End = Track->m_End;
}
if( tSegmentToStart )
{
if( tSegmentToStart->m_Flags & STARTPOINT )
......@@ -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 )
tSegmentToStart->Draw( panel, DC, draw_mode );
tSegmentToStart->Draw( aPanel, aDC, draw_mode );
if( tSegmentToEnd )
tSegmentToEnd->Draw( panel, DC, draw_mode );
tSegmentToEnd->Draw( aPanel, aDC, draw_mode );
// Display track length
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->GetParent();
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) aPanel->GetParent();
Track->DisplayInfo( frame );
}
......@@ -731,7 +747,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
g_HighLight_Status = true;
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,
wxPoint aStartPoint,
wxPoint aCenter,
int a_ArcAngle );
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 );
int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
......@@ -57,13 +58,14 @@ static int Self_On;
/* This function shows on screen the bounding box of the inductor that will be
* 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:
* the box is a rectangle with height = lenght/2
* the shape is defined by a rectangle, nor necessary horizontal or vertical
*/
GRSetDrawMode( DC, GR_XOR );
GRSetDrawMode( aDC, GR_XOR );
wxPoint poly[5];
wxPoint pt = Mself.m_End - Mself.m_Start;
......@@ -81,12 +83,12 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* panel, wxDC* DC, b
poly[3] = Mself.m_Start + pt;
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;
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 ) );
......@@ -102,7 +104,7 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* panel, wxDC* DC, b
poly[3] = Mself.m_Start + pt;
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 )
if( Self_On )
{
Self_On = 0;
Panel->ManageCurseur( Panel, DC, 0 );
Panel->ManageCurseur( Panel, DC, wxDefaultPosition, 0 );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
}
......@@ -137,7 +139,7 @@ void WinEDA_PcbFrame::Begin_Self( wxDC* DC )
DrawPanel->ManageCurseur = ShowBoundingBoxMicroWaveInductor;
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 )
int ll;
wxString msg;
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL;
......
......@@ -187,7 +187,8 @@ TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer );
/*************/
int ChangeSideNumLayer( int oldlayer );
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 );
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,
* 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 )
screen->ClrRefreshReq();
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
/* Redraw the cursor */
DrawPanel->DrawCursor( DC );
......@@ -103,7 +103,7 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
GetScreen()->ClrRefreshReq();
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, FALSE );
// Redraw the cursor
DrawPanel->DrawCursor( DC );
......
......@@ -21,13 +21,15 @@ bool s_Verbose = false; // false if zone outline diags must not be shown
// Outline creation:
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
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,
wxDC* DC,
bool erase );
static void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aPosition,
bool aErase );
/* Local variables */
static wxPoint s_CornerInitialPosition; // Used to abort a move corner command
......@@ -116,8 +118,9 @@ int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC )
if( zone->GetNumCorners() > 2 )
{
zone->m_Poly->DeleteCorner( zone->GetNumCorners() - 1 );
if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, false );
DrawPanel->ManageCurseur( DrawPanel, DC, wxDefaultPosition, false );
}
else
{
......@@ -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
*/
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();
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;
if( zone->m_Flags == IS_MOVED )
{
wxPoint offset;
......@@ -458,7 +460,7 @@ void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* Panel, wxDC*
else
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 )
}
/******************************************************************************************/
static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* panel, wxDC* DC, bool erase )
/******************************************************************************************/
/* 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;
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
return;
int icorner = zone->GetNumCorners() - 1;
if ( icorner < 1 )
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 */
......@@ -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->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