← Back to team overview

kicad-developers team mailing list archive

[PATCH] Draw items in block move in pcbnew

 

Hi,

Currently block move in pcbnew shows only a rectangle being moved. The
attached patch adds drawing of the selected items instead of the
rectangle. To achieve that, the included items dialog is shown
immediately after the user draws the selection rectangle. The drawback
from this is that the dialog comes up also when one attempts to do a
window zoom using the right-click menu. When zooming with the middle
mouse button the dialog is not shown. All this is in block.cpp. The
rest of the patch edits the Draw methods of some board items. It seems
that the methods all already included an offset parameter, but in some
cases it was not used.

The ratsnest is shown during a block move. However, since
build_ratsnest_module in ratsnest.cpp assumes only one moving module
at a time, ratsnest lines originating from a given module in the block
are drawn to the original position of another module (if there's a
connection) in the block when, in fact, the other module is also
moving with the block. In my opinion that's not a deal breaker,
though. I think that a possible solution to this would be to flag all
modules in the block with IS_MOVED and apply g_Offset_Module to all
modules/pads with the flag in build_ratsnest_module.

Comments?

marco
=== modified file 'include/block_commande.h'
--- include/block_commande.h	2009-11-23 20:18:47 +0000
+++ include/block_commande.h	2010-10-31 17:22:46 +0000
@@ -110,6 +110,15 @@
     {
         return m_ItemsSelection.GetCount();
     }
+
+    /** Function SetLastCursorPosition
+     * sets m_BlockLastCursorPosition
+     * @param aPosition = new position
+     **/
+    void SetLastCursorPosition( wxPoint aPosition )
+    {
+        m_BlockLastCursorPosition = aPosition;
+    }
 };
 
 

=== modified file 'pcbnew/block.cpp'
--- pcbnew/block.cpp	2010-10-25 16:14:36 +0000
+++ pcbnew/block.cpp	2010-10-31 19:59:08 +0000
@@ -18,12 +18,22 @@
 
 #include "protos.h"
 
-
-#define BLOCK_COLOR BROWN
-
-
-static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
-                                     bool erase );
+/** Function drawPickedItems
+ * draws items currently selected in a block
+ * @param aPanel = Current draw panel
+ * @param aDC = Current device context
+ * @param aOffset = Drawing offset
+ **/
+static void drawPickedItems( WinEDA_DrawPanel* aPanel, wxDC* aDC,
+                             wxPoint aOffset );
+/** Function drawMovingBlock
+ * handles drawing of a moving block
+ * @param aPanel = Current draw panel
+ * @param aDC = Current device context
+ * @param aErase = Erase block at current position
+ **/
+static void drawMovingBlock( WinEDA_DrawPanel* aPanel, wxDC* aDC,
+                             bool aErase );
 
 
 static bool Block_Include_Modules     = TRUE;
@@ -150,7 +160,7 @@
     fgSizer1->Add( m_Include_Zones, 0, wxALL, 5 );
 
     m_Include_PcbTextes = new wxCheckBox( this, -1,
-                                          _( "Include Text on Copper Layers" ),
+                                          _( "Include Text Items" ),
                                           wxDefaultPosition,
                                           wxDefaultSize, 0 );
     m_Include_PcbTextes->SetValue( Block_Include_PcbTextes );
@@ -328,6 +338,82 @@
 {
     int endcommande = TRUE;
 
+    // If coming here after cancel block, clean up and exit
+    if( GetScreen()->m_BlockLocate.m_State == STATE_NO_BLOCK )
+    {
+        DrawPanel->ManageCurseur = NULL;
+        DrawPanel->ForceCloseManageCurseur = NULL;
+        GetScreen()->m_BlockLocate.m_Flags   = 0;
+        GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
+        GetScreen()->m_BlockLocate.ClearItemsList();
+        DisplayToolMsg( wxEmptyString );
+        return 0;
+    }
+
+    // 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, _( "Included Items" ) ) )
+        {
+            DrawPanel->ManageCurseur = NULL;
+            DrawPanel->ForceCloseManageCurseur = NULL;
+            GetScreen()->m_BlockLocate.m_Flags   = 0;
+            GetScreen()->m_BlockLocate.m_State   = STATE_NO_BLOCK;
+            GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
+            GetScreen()->m_BlockLocate.ClearItemsList();
+            DisplayToolMsg( wxEmptyString );
+            DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
+            return 0;
+        }
+        DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
+        Block_SelectItems();
+        // Exit if no items found
+        if( !GetScreen()->m_BlockLocate.GetCount() ) {
+            DrawPanel->ManageCurseur = NULL;
+            DrawPanel->ForceCloseManageCurseur = NULL;
+            GetScreen()->m_BlockLocate.m_Flags   = 0;
+            GetScreen()->m_BlockLocate.m_State   = STATE_NO_BLOCK;
+            GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
+            GetScreen()->m_BlockLocate.ClearItemsList();
+            DisplayToolMsg( wxEmptyString );
+            return 0;
+        }
+        // Move cursor to the center of the smallest rectangle
+        // containing the centers of all selected items
+        PICKED_ITEMS_LIST* itemsList = &DrawPanel->GetScreen()->m_BlockLocate.m_ItemsSelection;
+        wxPoint blockCenter;
+        int minX, minY, maxX, maxY;
+        int tempX, tempY;
+        BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( 0 );
+        minX = item->GetPosition().x;
+        minY = item->GetPosition().y;
+        maxX = minX;
+        maxY = minY;
+        for( unsigned ii = 1; ii < itemsList->GetCount(); ii++ )
+        {
+            item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
+            tempX = item->GetPosition().x;
+            tempY = item->GetPosition().y;
+            if( tempX > maxX )
+                maxX = tempX;
+            if( tempX < minX )
+                minX = tempX;
+            if( tempY > maxY )
+                maxY = tempY;
+            if( tempY < minY )
+                minY = tempY;
+        }
+        blockCenter.x = ( minX + maxX ) / 2;
+        blockCenter.y = ( minY + maxY ) / 2;
+        DrawPanel->CursorOff( DC );
+        GetScreen()->m_Curseur = blockCenter;
+        GetScreen()->m_BlockLocate.SetLastCursorPosition( blockCenter );
+        DrawPanel->MouseToCursorSchema();
+        DrawPanel->CursorOn( DC );
+    }
+
     if( DrawPanel->ManageCurseur )
         switch( GetScreen()->m_BlockLocate.m_Command )
         {
@@ -341,35 +427,25 @@
         case BLOCK_PRESELECT_MOVE:  /* Move with preselection list*/
             GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE;
             endcommande = FALSE;
-            DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
-            DrawPanel->ManageCurseur = DrawMovingBlockOutlines;
+            DrawPanel->ManageCurseur = drawMovingBlock;
             DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
             break;
 
         case BLOCK_DELETE: /* Delete */
-
-            // Turn off the block rectangle now so it is not redisplayed
             DrawPanel->ManageCurseur = NULL;
             GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
-            DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
             Block_Delete();
             break;
 
         case BLOCK_ROTATE: /* Rotation */
-
-            // Turn off the block rectangle now so it is not redisplayed
             DrawPanel->ManageCurseur = NULL;
             GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
-            DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
             Block_Rotate();
             break;
 
         case BLOCK_FLIP: /* Flip */
-
-            // Turn off the block rectangle now so it is not redisplayed
             DrawPanel->ManageCurseur = NULL;
             GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
-            DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
             Block_Flip();
             break;
 
@@ -377,8 +453,6 @@
             GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP;
             if( GetScreen()->m_BlockLocate.GetCount() )
             {
-                DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
-
 // TODO (if useful)         Save_Block( );
             }
             break;
@@ -553,49 +627,100 @@
     }
  }
 
-
-/* Traces the outline of the block structures during move.
- */
-static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
-                                     bool erase )
-{
-    int          Color;
-    BASE_SCREEN* screen = panel->GetScreen();
-
-    Color = YELLOW;
-
-    if( erase )
-    {
-        screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode,
-                                    Color );
+static void drawPickedItems( WinEDA_DrawPanel* aPanel, wxDC* aDC,
+                             wxPoint aOffset )
+{
+    PICKED_ITEMS_LIST* itemsList = &aPanel->GetScreen()->m_BlockLocate.m_ItemsSelection;
+    WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) aPanel->GetParent();
+    g_Offset_Module = -aOffset;
+    for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
+    {
+        BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
+        switch( item->Type() )
+        {
+        case TYPE_MODULE:
+        {
+            MODULE* module = (MODULE*) item;
+            frame->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
+            DrawModuleOutlines( aPanel, aDC, module );
+            break;
+        }
+        case TYPE_DRAWSEGMENT:
+        {
+            DRAWSEGMENT* segment = (DRAWSEGMENT*) item;
+            segment->Draw( aPanel, aDC, GR_XOR, aOffset );
+            break;
+        }
+        case TYPE_TEXTE:
+        {
+            TEXTE_PCB* text = (TEXTE_PCB*) item;
+            text->Draw( aPanel, aDC, GR_XOR, aOffset );
+            break;
+        }
+        case TYPE_TRACK:
+        case TYPE_VIA:
+        {
+            TRACK* track = (TRACK*) item;
+            track->Draw( aPanel, aDC, GR_XOR, aOffset );
+            break;
+        }
+        case TYPE_MIRE:
+        {
+            MIREPCB* mire = (MIREPCB*) item;
+            mire->Draw( aPanel, aDC, GR_XOR, aOffset );
+            break;
+        }
+        case TYPE_DIMENSION:
+        {
+            DIMENSION* dimension = (DIMENSION*) item;
+            dimension->Draw( aPanel, aDC, GR_XOR, aOffset );
+            break;
+        }
+        case TYPE_ZONE_CONTAINER:
+        {
+            ZONE_CONTAINER* zoneContainer = (ZONE_CONTAINER*) item;
+            zoneContainer->Draw( aPanel, aDC, GR_XOR, aOffset );
+            zoneContainer->DrawFilledArea( aPanel, aDC, GR_XOR, aOffset );
+            break;
+        }
+        // Currently markers are not affected by block commands
+        case TYPE_MARKER_PCB:
+        {
+            MARKER_PCB* pcbMarker = (MARKER_PCB*) item;
+            pcbMarker->Draw( aPanel, aDC, GR_XOR, aOffset );
+            break;
+        }
+        }
+    }
+    g_Offset_Module = wxPoint( 0, 0 );
+}
+
+static void drawMovingBlock( WinEDA_DrawPanel* aPanel, wxDC* aDC,
+                             bool aErase )
+{
+    BASE_SCREEN* screen = aPanel->GetScreen();
+
+    if( aErase )
+    {
         if( screen->m_BlockLocate.m_MoveVector.x
             || screen->m_BlockLocate.m_MoveVector.y )
         {
-            screen->m_BlockLocate.Draw( panel,
-                                        DC,
-                                        screen->m_BlockLocate.m_MoveVector,
-                                        g_XorMode,
-                                        Color );
+            drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector );
         }
     }
 
     if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP )
     {
         screen->m_BlockLocate.m_MoveVector.x = screen->m_Curseur.x -
-                                               screen->m_BlockLocate.GetRight();
+                                               screen->m_BlockLocate.m_BlockLastCursorPosition.x;
         screen->m_BlockLocate.m_MoveVector.y = screen->m_Curseur.y -
-                                               screen->m_BlockLocate.GetBottom();
+                                               screen->m_BlockLocate.m_BlockLastCursorPosition.y;
     }
 
-    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( panel,
-                                    DC,
-                                    screen->m_BlockLocate.m_MoveVector,
-                                    g_XorMode,
-                                    Color );
+        drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector );
     }
 }
 
@@ -605,13 +730,6 @@
  */
 void WinEDA_PcbFrame::Block_Delete()
 {
-    if( !InstallBlockCmdFrame( this, _( "Delete Block" ) ) )
-        return;
-
-    Block_SelectItems();
-    if( GetScreen()->m_BlockLocate.GetCount() == 0 )
-        return;
-
     OnModify();
     SetCurItem( NULL );
 
@@ -681,13 +799,6 @@
     wxPoint centre;         // rotation cent-re for the rotation transform
     int rotAngle = 900;     // rotation angle in 0.1 deg.
 
-    if( !InstallBlockCmdFrame( this, _( "Rotate Block" ) ) )
-        return;
-
-    Block_SelectItems();
-    if( GetScreen()->m_BlockLocate.GetCount() == 0 )
-        return;
-
     oldpos = GetScreen()->m_Curseur;
     centre = GetScreen()->m_BlockLocate.Centre();
 
@@ -753,13 +864,6 @@
     wxPoint memo;
     wxPoint center; /* Position of the axis for inversion of all elements */
 
-    if( !InstallBlockCmdFrame( this, _( "Flip Block" ) ) )
-        return;
-
-    Block_SelectItems();
-    if( GetScreen()->m_BlockLocate.GetCount() == 0 )
-        return;
-
     OnModify();
 
     PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection;
@@ -823,13 +927,6 @@
  */
 void WinEDA_PcbFrame::Block_Move()
 {
-    if( !InstallBlockCmdFrame( this, _( "Move Block" ) ) )
-        return;
-
-    Block_SelectItems();
-    if( GetScreen()->m_BlockLocate.GetCount() == 0 )
-        return;
-
     OnModify();
 
     wxPoint MoveVector = GetScreen()->m_BlockLocate.m_MoveVector;
@@ -893,13 +990,6 @@
 {
     wxPoint MoveVector = GetScreen()->m_BlockLocate.m_MoveVector;
 
-    if( !InstallBlockCmdFrame( this, _( "Copy Block" ) ) )
-        return;
-
-    Block_SelectItems();
-    if( GetScreen()->m_BlockLocate.GetCount() == 0 )
-        return;
-
     OnModify();
 
     PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection;

=== modified file 'pcbnew/class_dimension.cpp'
--- pcbnew/class_dimension.cpp	2010-05-02 19:35:46 +0000
+++ pcbnew/class_dimension.cpp	2010-10-31 17:21:08 +0000
@@ -532,8 +532,8 @@
 {
     int ox, oy, typeaff, width, gcolor;
 
-    ox = offset.x;
-    oy = offset.y;
+    ox = -offset.x;
+    oy = -offset.y;
 
     m_Text->Draw( panel, DC, mode_color, offset );
 

=== modified file 'pcbnew/class_drawsegment.cpp'
--- pcbnew/class_drawsegment.cpp	2010-10-25 07:43:50 +0000
+++ pcbnew/class_drawsegment.cpp	2010-10-29 17:45:13 +0000
@@ -229,7 +229,7 @@
 
 
 void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
-                        int draw_mode, const wxPoint& notUsed )
+                        int draw_mode, const wxPoint& aOffset )
 {
     int ux0, uy0, dx, dy;
     int l_piste;
@@ -246,12 +246,12 @@
     l_piste = m_Width >> 1;  /* half trace width */
 
     // Line start point or Circle and Arc center
-    ux0 = m_Start.x;
-    uy0 = m_Start.y;
+    ux0 = m_Start.x + aOffset.x;
+    uy0 = m_Start.y + aOffset.y;
 
     // Line end point or circle and arc start point
-    dx = m_End.x;
-    dy = m_End.y;
+    dx = m_End.x + aOffset.x;
+    dy = m_End.y + aOffset.y;
 
     mode = DisplayOpt.DisplayDrawItems;
     if( m_Flags & FORCE_SKETCH )

=== modified file 'pcbnew/class_drawsegment.h'
--- pcbnew/class_drawsegment.h	2010-10-25 07:43:50 +0000
+++ pcbnew/class_drawsegment.h	2010-10-29 17:45:13 +0000
@@ -65,7 +65,7 @@
 
 
     void         Draw( WinEDA_DrawPanel* panel, wxDC* DC,
-                       int aDrawMode, const wxPoint& offset = ZeroOffset );
+                       int aDrawMode, const wxPoint& aOffset = ZeroOffset );
 
     /**
      * Function DisplayInfo

=== modified file 'pcbnew/class_track.cpp'
--- pcbnew/class_track.cpp	2010-10-16 14:51:22 +0000
+++ pcbnew/class_track.cpp	2010-10-31 17:26:15 +0000
@@ -554,7 +554,8 @@
 
 
 /*********************************************************************/
-void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoint& notUsed )
+void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
+                  const wxPoint& aOffset )
 /*********************************************************************/
 {
     int l_piste;
@@ -610,7 +611,8 @@
         if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
 #endif
         {
-            GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color );
+            GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                      m_Start.y + aOffset.y, rayon, color );
         }
         else
         {
@@ -621,16 +623,20 @@
             if( panel->GetScreen()->Scale( l_piste ) <= 1 ) /* Sketch mode if l_piste/zoom <= 1 */
 #endif
             {
-                GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color );
+                GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                          m_Start.y + aOffset.y, rayon, color );
             }
             else if( ( !DisplayOpt.DisplayPcbTrackFill) || GetState( FORCE_SKETCH ) )
             {
-                GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon - l_piste, color );
-                GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon + l_piste, color );
+                GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                          m_Start.y + aOffset.y, rayon - l_piste, color );
+                GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                          m_Start.y + aOffset.y, rayon + l_piste, color );
             }
             else
             {
-                GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon,
+                GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                          m_Start.y + aOffset.y, rayon,
                           m_Width, color );
             }
         }
@@ -643,20 +649,23 @@
     if( panel->GetScreen()->Scale( l_piste ) < L_MIN_DESSIN )
 #endif
     {
-        GRLine( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
-                m_End.x, m_End.y, 0, color );
+        GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                m_Start.y + aOffset.y,
+                m_End.x + aOffset.x, m_End.y + aOffset.y, 0, color );
         return;
     }
 
     if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
     {
-        GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
-                 m_End.x, m_End.y, m_Width, color );
+        GRCSegm( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                 m_Start.y + aOffset.y,
+                 m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );
     }
     else
     {
-        GRFillCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
-                     m_End.x, m_End.y, m_Width, color );
+        GRFillCSegm( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                     m_Start.y + aOffset.y,
+                     m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );
     }
 
     if( panel->GetScreen()->m_IsPrinting )
@@ -665,8 +674,9 @@
     // Show clearance for tracks, not for zone segments
     if( ShowClearance( this ) )
     {
-        GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
-                 m_End.x, m_End.y,
+        GRCSegm( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                 m_Start.y + aOffset.y,
+                 m_End.x + aOffset.x, m_End.y + aOffset.y,
                  m_Width + (GetClearance() * 2), color );
     }
 
@@ -683,10 +693,12 @@
         return;
 
     #define THRESHOLD 10
-    if( (m_End.x - m_Start.x) != 0 &&  (m_End.y - m_Start.y) != 0 )
+    if( (m_End.x - m_Start.x) != 0
+        &&  (m_End.y - m_Start.y) != 0 )
         return;
 
-    int len = ABS( (m_End.x - m_Start.x) + (m_End.y - m_Start.y) );
+    int len = ABS( (m_End.x - m_Start.x)
+                   + (m_End.y - m_Start.y) );
 
     if( len < THRESHOLD * m_Width )
         return;
@@ -738,7 +750,8 @@
 
 
 /*******************************************************************************************/
-void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoint& notUsed )
+void SEGVIA::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode,
+                   const wxPoint& aOffset )
 /*******************************************************************************************/
 {
     int color;
@@ -811,14 +824,17 @@
     }
 
     if( fillvia )
-        GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, 0, color, color );
+        GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                        m_Start.y + aOffset.y, rayon, 0, color, color );
 
     else
     {
-        GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y, rayon, color );
+        GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                  m_Start.y + aOffset.y, rayon, color );
         if ( fast_draw )
             return;
-        GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
+        GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                  m_Start.y + aOffset.y,
                   inner_rayon, color );
     }
 
@@ -850,8 +866,8 @@
 #else
                 if( screen->Scale( drill_rayon ) > 1 )     /* draw hole if its size is enought */
 #endif
-                    GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x,
-                                    m_Start.y, drill_rayon, 0, color, color );
+                    GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                                    m_Start.y + aOffset.y, drill_rayon, 0, color, color );
 
                 if( screen->m_IsPrinting )
                     GRForceBlackPen( blackpenstate );
@@ -859,14 +875,16 @@
             else
             {
                 if( drill_rayon < inner_rayon )         // We can show the via hole
-                    GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
+                    GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                              m_Start.y + aOffset.y,
                               drill_rayon, color );
             }
         }
     }
 
     if( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS )
-        GRCircle( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
+        GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
+                  m_Start.y + aOffset.y,
                   rayon + GetClearance(), color );
 
     // for Micro Vias, draw a partial cross :
@@ -888,16 +906,24 @@
         }
 
         /* lines | or \ */
-        GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay,
-                m_Start.x - bx, m_Start.y - by, 0, color );
-        GRLine( &panel->m_ClipBox, DC, m_Start.x + bx, m_Start.y + by,
-                m_Start.x + ax, m_Start.y + ay, 0, color );
+        GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - ax,
+                m_Start.y + aOffset.y - ay,
+                m_Start.x + aOffset.x - bx,
+                m_Start.y + aOffset.y - by, 0, color );
+        GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x + bx,
+                m_Start.y + aOffset.y + by,
+                m_Start.x + aOffset.x + ax,
+                m_Start.y + aOffset.y + ay, 0, color );
 
         /* lines - or / */
-        GRLine( &panel->m_ClipBox, DC, m_Start.x + ay, m_Start.y - ax,
-                m_Start.x + by, m_Start.y - bx, 0, color );
-        GRLine( &panel->m_ClipBox, DC, m_Start.x - by, m_Start.y + bx,
-                m_Start.x - ay, m_Start.y + ax, 0, color );
+        GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x + ay,
+                m_Start.y + aOffset.y - ax,
+                m_Start.x + aOffset.x + by,
+                m_Start.y + aOffset.y - bx, 0, color );
+        GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - by,
+                m_Start.y + aOffset.y + bx,
+                m_Start.x + aOffset.x - ay,
+                m_Start.y + aOffset.y + ax, 0, color );
     }
 
     // for Buried Vias, draw a partial line :
@@ -913,15 +939,19 @@
         /* lines for the top layer */
         RotatePoint( &ax, &ay, layer_top * 3600 / brd->GetCopperLayerCount( ) );
         RotatePoint( &bx, &by, layer_top * 3600 / brd->GetCopperLayerCount( ) );
-        GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay,
-                m_Start.x - bx, m_Start.y - by, 0, color );
+        GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - ax,
+                m_Start.y + aOffset.y - ay,
+                m_Start.x + aOffset.x - bx,
+                m_Start.y + aOffset.y - by, 0, color );
 
         /* lines for the bottom layer */
         ax = 0; ay = rayon; bx = 0; by = drill_rayon;
         RotatePoint( &ax, &ay, layer_bottom * 3600 / brd->GetCopperLayerCount( ) );
         RotatePoint( &bx, &by, layer_bottom * 3600 / brd->GetCopperLayerCount( ) );
-        GRLine( &panel->m_ClipBox, DC, m_Start.x - ax, m_Start.y - ay,
-                m_Start.x - bx, m_Start.y - by, 0, color );
+        GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x - ax,
+                m_Start.y + aOffset.y - ay,
+                m_Start.x + aOffset.x - bx,
+                m_Start.y + aOffset.y - by, 0, color );
     }
 
     // Display the short netname:

=== modified file 'pcbnew/class_track.h'
--- pcbnew/class_track.h	2010-04-08 11:33:43 +0000
+++ pcbnew/class_track.h	2010-10-29 17:45:13 +0000
@@ -144,7 +144,7 @@
 
 
     /* Display on screen: */
-    void    Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset );
+    void    Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& aOffset = ZeroOffset );
 
     /* divers */
     int Shape() const { return m_Shape & 0xFF; }
@@ -341,7 +341,7 @@
     }
 
 
-    void    Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset );
+    void    Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& aOffset = ZeroOffset );
 
 
     /**


Follow ups