Commit 28d702f6 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: fix a *very subtle* bug noticeable only in complex hierachies, for...

Eeschema: fix a *very subtle* bug noticeable only in complex hierachies, for multiple parts per package:
sometimes, the modified flag was set for these components just when switching from a sheet to an other sheet.
Pcbnew: fix Bug #1197414 (dragged track segments does not show clearance area)
parent 26bd37e0
......@@ -249,6 +249,11 @@ void SCH_COMPONENT::SetUnit( int aUnit )
}
}
void SCH_COMPONENT::UpdateUnit( int aUnit )
{
m_unit = aUnit;
}
void SCH_COMPONENT::SetConvert( int aConvert )
{
......
......@@ -130,8 +130,23 @@ public:
int GetUnit() const { return m_unit; }
/**
* change the unit id to aUnit
* has maening only for multiple parts per package
* Also set the modified flag bit
* @param aUnit = the new unit Id
*/
void SetUnit( int aUnit );
/**
* change the unit id to aUnit
* has maening only for multiple parts per package
* Do not change the modified flag bit, and should be used when
* change is not due to an edition command
* @param aUnit = the new unit Id
*/
void UpdateUnit( int aUnit );
int GetConvert() const { return m_convert; }
void SetConvert( int aConvert );
......
......@@ -234,7 +234,7 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences()
{
SCH_COMPONENT* component = (SCH_COMPONENT*) t;
component->GetField( REFERENCE )->SetText( component->GetRef( this ) );
component->SetUnit( component->GetUnitSelection( this ) );
component->UpdateUnit( component->GetUnitSelection( this ) );
}
t = t->Next();
......
......@@ -409,6 +409,7 @@ void UndrawAndMarkSegmentsToDrag( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
track->Draw( aCanvas, aDC, GR_XOR );
track->SetState( IN_EDIT, false );
track->SetFlags( IS_DRAGGED );
if( g_DragSegmentList[ii].m_Flag & STARTPOINT )
track->SetFlags( STARTPOINT );
......
......@@ -180,6 +180,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
pt_segm = g_DragSegmentList[ii].m_Track;
pt_segm->Draw( Panel, DC, GR_XOR );
pt_segm->SetState( IN_EDIT, false );
pt_segm->ClearFlags();
g_DragSegmentList[ii].RestoreInitialValues();
pt_segm->Draw( Panel, DC, GR_OR );
}
......@@ -405,6 +406,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat
{
TRACK * track = g_DragSegmentList[ii].m_Track;
track->SetState( IN_EDIT, false );
track->ClearFlags();
if( aDC )
track->Draw( m_canvas, aDC, GR_OR );
......
......@@ -44,11 +44,12 @@ static void Abort_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC )
// Pad move in progress: restore origin of dragged tracks, if any.
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{
TRACK* Track = g_DragSegmentList[ii].m_Track;
Track->Draw( Panel, DC, GR_XOR );
Track->SetState( IN_EDIT, false );
TRACK* track = g_DragSegmentList[ii].m_Track;
track->Draw( Panel, DC, GR_XOR );
track->SetState( IN_EDIT, false );
track->ClearFlags();
g_DragSegmentList[ii].RestoreInitialValues();
Track->Draw( Panel, DC, GR_OR );
track->Draw( Panel, DC, GR_OR );
}
EraseDragList();
......@@ -122,7 +123,7 @@ void PCB_BASE_FRAME::StartMovePad( D_PAD* aPad, wxDC* aDC, bool aDragConnectedTr
void PCB_BASE_FRAME::PlacePad( D_PAD* aPad, wxDC* DC )
{
int dX, dY;
TRACK* Track;
TRACK* track;
if( aPad == NULL )
return;
......@@ -135,16 +136,16 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* aPad, wxDC* DC )
// Save dragged track segments in undo list
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{
Track = g_DragSegmentList[ii].m_Track;
track = g_DragSegmentList[ii].m_Track;
// Set the old state
if( g_DragSegmentList[ii].m_Pad_Start )
Track->SetStart( Pad_OldPos );
track->SetStart( Pad_OldPos );
if( g_DragSegmentList[ii].m_Pad_End )
Track->SetEnd( Pad_OldPos );
track->SetEnd( Pad_OldPos );
picker.SetItem( Track );
picker.SetItem( track );
pickList.PushItem( picker );
}
......@@ -169,19 +170,23 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* aPad, wxDC* DC )
// Redraw dragged track segments
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
{
Track = g_DragSegmentList[ii].m_Track;
track = g_DragSegmentList[ii].m_Track;
// Set the new state
if( g_DragSegmentList[ii].m_Pad_Start )
Track->SetStart( aPad->GetPosition() );
track->SetStart( aPad->GetPosition() );
if( g_DragSegmentList[ii].m_Pad_End )
Track->SetEnd( aPad->GetPosition() );
track->SetEnd( aPad->GetPosition() );
if( DC )
track->Draw( m_canvas, DC, GR_XOR );
Track->SetState( IN_EDIT, false );
track->SetState( IN_EDIT, false );
track->ClearFlags();
if( DC )
Track->Draw( m_canvas, DC, GR_OR );
track->Draw( m_canvas, DC, GR_OR );
}
// Compute local coordinates (i.e refer to module position and for module orient = 0)
......
......@@ -107,7 +107,7 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
{
wxPoint moveVector;
BASE_SCREEN* screen = aPanel->GetScreen();
int track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
int tmp = DisplayOpt.DisplayPcbTrackFill;
GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT;
DisplayOpt.DisplayPcbTrackFill = false;
......@@ -145,7 +145,7 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
track->Draw( aPanel, aDC, draw_mode );
}
DisplayOpt.DisplayPcbTrackFill = track_fill_copy;
DisplayOpt.DisplayPcbTrackFill = tmp;
// Display track length
if( track )
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2007-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2007-2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -467,7 +468,9 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
{
if( Track->Type() == PCB_VIA_T )
{
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, _( "Drag Via" ),
msg = AddHotkeyName( _( "Drag Via" ), g_Board_Editor_Hokeys_Descr,
HK_DRAG_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, msg,
KiBitmap( move_xpm ) );
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment