From 50f063da0750c11aad209df0caefc508c2fed031 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Thu, 3 Feb 2011 14:27:28 -0500 Subject: [PATCH] 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. --- common/block_commande.cpp | 20 ++++--- common/drawframe.cpp | 12 ++++ common/sch_item_struct.cpp | 28 ++++----- cvpcb/class_DisplayFootprintsFrame.cpp | 2 +- eeschema/block.cpp | 51 +++++++++-------- eeschema/block_libedit.cpp | 40 +++++++------ eeschema/bus-wire-junction.cpp | 52 ++++++++--------- eeschema/busentry.cpp | 11 ++-- eeschema/controle.cpp | 6 +- eeschema/edit_component_in_schematic.cpp | 17 +++--- eeschema/edit_label.cpp | 18 +++--- eeschema/eeredraw.cpp | 2 +- eeschema/getpart.cpp | 16 +++--- eeschema/libedit.cpp | 2 +- eeschema/onleftclick.cpp | 73 ++++++++++++------------ eeschema/pinedit.cpp | 15 ++--- eeschema/sheet.cpp | 12 ++-- eeschema/sheetlab.cpp | 22 +++---- eeschema/symbdraw.cpp | 41 +++++++------ eeschema/template_fieldnames.cpp | 4 +- gerbview/block.cpp | 43 +++++++------- gerbview/controle.cpp | 2 +- gerbview/draw_gerber_screen.cpp | 10 ++-- include/block_commande.h | 3 +- include/class_drawpanel.h | 5 +- include/wxEeschemaStruct.h | 11 +++- include/wxstruct.h | 11 ++++ pcbnew/block.cpp | 25 ++++---- pcbnew/block_module_editor.cpp | 39 +++++++------ pcbnew/controle.cpp | 22 +++---- pcbnew/deltrack.cpp | 7 +-- pcbnew/dimension.cpp | 22 +++---- pcbnew/edgemod.cpp | 27 +++++---- pcbnew/edit.cpp | 7 ++- pcbnew/edit_pcb_text.cpp | 18 +++--- pcbnew/editedge.cpp | 44 +++++++------- pcbnew/editrack-part2.cpp | 6 +- pcbnew/editrack.cpp | 62 +++++++++----------- pcbnew/edtxtmod.cpp | 21 ++++--- pcbnew/mirepcb.cpp | 18 +++--- pcbnew/moduleframe.cpp | 2 +- pcbnew/modules.cpp | 19 +++--- pcbnew/move-drag_pads.cpp | 21 ++++--- pcbnew/move_or_drag_track.cpp | 70 ++++++++++++++--------- pcbnew/muonde.cpp | 26 +++++---- pcbnew/protos.h | 6 +- pcbnew/tracepcb.cpp | 12 ++-- pcbnew/zones_by_polygon.cpp | 43 +++++++------- 48 files changed, 569 insertions(+), 477 deletions(-) diff --git a/common/block_commande.cpp b/common/block_commande.cpp index 41a9fdba76..a1022316f7 100644 --- a/common/block_commande.cpp +++ b/common/block_commande.cpp @@ -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 ); diff --git a/common/drawframe.cpp b/common/drawframe.cpp index 993057ced5..2939a9ce6b 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -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; diff --git a/common/sch_item_struct.cpp b/common/sch_item_struct.cpp index f1fcb7bcd0..90d7a7944d 100644 --- a/common/sch_item_struct.cpp +++ b/common/sch_item_struct.cpp @@ -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 } } diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index df5445d703..0727c13f89 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -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 ); } } diff --git a/eeschema/block.cpp b/eeschema/block.cpp index ee000668ff..92b6f33a5e 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -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 ); } } diff --git a/eeschema/block_libedit.cpp b/eeschema/block_libedit.cpp index 802718ba25..6ebbbce5b7 100644 --- a/eeschema/block_libedit.cpp +++ b/eeschema/block_libedit.cpp @@ -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 ); } diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 24dac6fb7e..a6270e581a 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -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; } diff --git a/eeschema/busentry.cpp b/eeschema/busentry.cpp index 7ed7c0027f..d88b97c9f2 100644 --- a/eeschema/busentry.cpp +++ b/eeschema/busentry.cpp @@ -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 ); } diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index d6447dc5ab..4042d17b91 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -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 ); } } diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index ded38c40f4..8dd59e9ca5 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -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 ); } diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 7a0277fe59..30e0987fe8 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -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 ); } diff --git a/eeschema/eeredraw.cpp b/eeschema/eeredraw.cpp index 330fd627e2..8fc3e97fb2 100644 --- a/eeschema/eeredraw.cpp +++ b/eeschema/eeredraw.cpp @@ -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 ); diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 00b607da56..982a1f331b 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -22,7 +22,8 @@ #include -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 ); } diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index 3d922db407..82694fca7a 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -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 ); diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index 2850c82c61..ba5d0ce5f6 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -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; diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index fc6d7591c2..5d94c591e0 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -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(); diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 266bfe9428..65e5a2f34a 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -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 diff --git a/eeschema/sheetlab.cpp b/eeschema/sheetlab.cpp index 0ae9d0fc79..7d2dc31c4d 100644 --- a/eeschema/sheetlab.cpp +++ b/eeschema/sheetlab.cpp @@ -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; } diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index 880e5481f3..bd7afd67e5 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -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,29 +232,31 @@ 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, - DefaultTransform ); + 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 ); } diff --git a/eeschema/template_fieldnames.cpp b/eeschema/template_fieldnames.cpp index bee3ebce1e..cf9e656b4a 100644 --- a/eeschema/template_fieldnames.cpp +++ b/eeschema/template_fieldnames.cpp @@ -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 diff --git a/gerbview/block.cpp b/gerbview/block.cpp index b53715351a..68420b509c 100644 --- a/gerbview/block.cpp +++ b/gerbview/block.cpp @@ -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 ); diff --git a/gerbview/controle.cpp b/gerbview/controle.cpp index 891e8501cc..a0ff4606a5 100644 --- a/gerbview/controle.cpp +++ b/gerbview/controle.cpp @@ -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 ); } } diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index 634593df17..f88dcc87c5 100644 --- a/gerbview/draw_gerber_screen.cpp +++ b/gerbview/draw_gerber_screen.cpp @@ -97,12 +97,12 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) break; } GetBoard()->Draw( DrawPanel, DC, - drawMode, // this needs to be GR_COPY or GR_OR, set from a toggle button. - wxPoint( 0, 0 ) ); + drawMode, // this needs to be GR_COPY or GR_OR, set from a toggle button. + 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 ); diff --git a/include/block_commande.h b/include/block_commande.h index 61db0cad7e..52887a697e 100644 --- a/include/block_commande.h +++ b/include/block_commande.h @@ -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__ */ diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h index 85b0b7653a..72756931bb 100644 --- a/include/class_drawpanel.h +++ b/include/class_drawpanel.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: diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index 894b360008..9476fed196 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -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, diff --git a/include/wxstruct.h b/include/wxstruct.h index 92bc292447..763425065e 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -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. diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index 96c150332c..71509d6c29 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -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 ); diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index a14d33c78c..a86bed34b8 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -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 ); } } } diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index e1e104fd94..8a2b4df29f 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -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 diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index c84ec87012..8cf57e1257 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -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; } diff --git a/pcbnew/dimension.cpp b/pcbnew/dimension.cpp index e36ba3d6ab..74363eaea1 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -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(); - DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem(); + 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 ); } diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index 9d12db0f6d..8f504208e9 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -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(); } diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 18d455ef1b..9c673dd093 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -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: diff --git a/pcbnew/edit_pcb_text.cpp b/pcbnew/edit_pcb_text.cpp index cd5001fb8a..bcbfe7985f 100644 --- a/pcbnew/edit_pcb_text.cpp +++ b/pcbnew/edit_pcb_text.cpp @@ -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 ); } diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 12c754fdc4..6c2bc900e6 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -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; } diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index a987294618..9ab7ee3cd9 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -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(); diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 2ff0c090fd..fcaa6dd354 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -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& 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 ); } diff --git a/pcbnew/edtxtmod.cpp b/pcbnew/edtxtmod.cpp index c90f4881bb..402d278b84 100644 --- a/pcbnew/edtxtmod.cpp +++ b/pcbnew/edtxtmod.cpp @@ -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 ) diff --git a/pcbnew/mirepcb.cpp b/pcbnew/mirepcb.cpp index 11950f369a..3618f49b51 100644 --- a/pcbnew/mirepcb.cpp +++ b/pcbnew/mirepcb.cpp @@ -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 ); } diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 81e4efa810..37fbc1d274 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -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 ); } } diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 7f17a06306..96eba559d1 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -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 ) + 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 ); } diff --git a/pcbnew/move-drag_pads.cpp b/pcbnew/move-drag_pads.cpp index db2d688b8f..be321ba839 100644 --- a/pcbnew/move-drag_pads.cpp +++ b/pcbnew/move-drag_pads.cpp @@ -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 ); } } diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 64ea69ad81..1aa9ce9072 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -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,17 +266,21 @@ 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 ) + if( s_EndSegmentPresent ) { // Get the segment connected to the end point 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 ); } diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index e51ff000d3..7deef8339d 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -30,9 +30,10 @@ static void gen_arc( std::vector & 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 & 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; diff --git a/pcbnew/protos.h b/pcbnew/protos.h index 854e987dd6..11b60becd3 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -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.. diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index dd855a119f..0cb2f61568 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -56,8 +56,8 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) #ifdef USE_WX_OVERLAY if(IsShown()) { - DrawPanel->m_overlay.Reset(); - wxDCOverlay overlaydc( DrawPanel->m_overlay, (wxWindowDC*)DC ); + DrawPanel->m_overlay.Reset(); + wxDCOverlay overlaydc( DrawPanel->m_overlay, (wxWindowDC*)DC ); overlaydc.Clear(); } #endif @@ -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 ); @@ -94,8 +94,8 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) #ifdef USE_WX_OVERLAY if(IsShown()) { - DrawPanel->m_overlay.Reset(); - wxDCOverlay overlaydc( DrawPanel->m_overlay, (wxWindowDC*)DC ); + DrawPanel->m_overlay.Reset(); + wxDCOverlay overlaydc( DrawPanel->m_overlay, (wxWindowDC*)DC ); overlaydc.Clear(); } #endif @@ -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 ); diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index e5e39158e4..532f890174 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -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 ); }