More encapsulation work and other minor improvements.

* EDA_RECT and EDA_ITEM completely encapsulated.
* Removed unnecessary EDA_ITEM member m_Selected and replaced functionality
  with SELECTED flag bit.
This commit is contained in:
Wayne Stambaugh 2011-12-21 08:42:02 -05:00
parent 98fa228302
commit 6c28cdc62c
76 changed files with 530 additions and 499 deletions

View File

@ -70,7 +70,6 @@ EDA_ITEM::EDA_ITEM( const EDA_ITEM& base )
m_Flags = base.m_Flags;
SetTimeStamp( base.m_TimeStamp );
m_Status = base.m_Status;
m_Selected = base.m_Selected;
}
@ -86,9 +85,7 @@ void EDA_ITEM::InitVars()
m_Flags = 0; // flags for editions and other
SetTimeStamp( 0 ); // Time stamp used for logical links
m_Status = 0;
m_Selected = 0; // Used by block commands, and selective editing
m_forceVisible = false; // true to override the visibility setting of the item.
}

View File

@ -1,3 +1,28 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file block_commande.cpp
* @brief Common routines for managing on block commands.
@ -155,7 +180,7 @@ void BLOCK_SELECTOR::ClearListAndDeleteItems()
*/
void BLOCK_SELECTOR::PushItem( ITEM_PICKER& aItem )
{
m_ItemsSelection.PushItem( aItem );
m_ItemsSelection.PushItem( aItem );
}
@ -181,7 +206,7 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
if( ( Block->m_Command != BLOCK_IDLE ) || ( Block->m_State != STATE_NO_BLOCK ) )
return false;
Block->m_Flags = 0;
Block->ClearFlags();
Block->m_Command = (CmdBlockType) ReturnBlockCommand( key );
if( Block->m_Command == 0 )
@ -298,7 +323,7 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
screen->m_BlockLocate.ClearItemsList();
}
screen->m_BlockLocate.m_Flags = 0;
screen->m_BlockLocate.ClearFlags();
screen->m_BlockLocate.m_State = STATE_NO_BLOCK;
screen->m_BlockLocate.m_Command = BLOCK_ABORT;
Panel->GetParent()->HandleBlockEnd( DC );

View File

@ -421,15 +421,15 @@ void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect )
clipBox.Inflate( CLIP_BOX_PADDING );
// Convert from device units to drawing units.
m_ClipBox.m_Pos = wxPoint( aDC.DeviceToLogicalX( clipBox.x ),
aDC.DeviceToLogicalY( clipBox.y ) );
m_ClipBox.m_Size = wxSize( aDC.DeviceToLogicalXRel( clipBox.width ),
aDC.DeviceToLogicalYRel( clipBox.height ) );
m_ClipBox.SetOrigin( wxPoint( aDC.DeviceToLogicalX( clipBox.x ),
aDC.DeviceToLogicalY( clipBox.y ) ) );
m_ClipBox.SetSize( wxSize( aDC.DeviceToLogicalXRel( clipBox.width ),
aDC.DeviceToLogicalYRel( clipBox.height ) ) );
wxLogTrace( KICAD_TRACE_COORDS,
wxT( "Device clip box=(%d, %d, %d, %d), Logical clip box=(%d, %d, %d, %d)" ),
clipBox.x, clipBox.y, clipBox.width, clipBox.height,
m_ClipBox.m_Pos.x, m_ClipBox.m_Pos.y, m_ClipBox.m_Size.x, m_ClipBox.m_Size.y );
m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetWidth(), m_ClipBox.GetHeight() );
}
@ -573,7 +573,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
screenGridSize.x = aDC->LogicalToDeviceXRel( wxRound( gridSize.x ) );
screenGridSize.y = aDC->LogicalToDeviceYRel( wxRound( gridSize.y ) );
org = m_ClipBox.m_Pos;
org = m_ClipBox.GetPosition();
if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE )
{
@ -667,7 +667,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
for( double x = (double) org.x; x <= right; x += gridSize.x )
{
aDC->Blit( scaleDC.LogicalToDeviceX( wxRound( x ) ),
scaleDC.LogicalToDeviceY( m_ClipBox.m_Pos.y ),
scaleDC.LogicalToDeviceY( m_ClipBox.GetY() ),
1, tmpBM.GetHeight(), &tmpDC, 0, 0, wxCOPY, true );
}
#endif

View File

@ -309,7 +309,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( ! nextcmd )
{
block->m_Flags = 0;
block->ClearFlags();
block->m_State = STATE_NO_BLOCK;
block->m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL );

View File

@ -201,7 +201,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY && m_component )
m_component->ClearSelectedItems();
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.ClearFlags();
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL );
@ -298,7 +298,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
OnModify();
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.ClearFlags();
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL );

View File

@ -48,7 +48,7 @@ SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* DC, int entry_type )
// Create and place a new bus entry at cursor position
SCH_BUS_ENTRY* BusEntry = new SCH_BUS_ENTRY( GetScreen()->GetCrossHairPosition(), s_LastShape,
entry_type );
BusEntry->m_Flags = IS_NEW;
BusEntry->SetFlags( IS_NEW );
BusEntry->Place( this, DC );
OnModify();
return BusEntry;
@ -69,7 +69,7 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int en
}
/* Put old item in undo list if it is not currently in edit */
if( BusEntry->m_Flags == 0 )
if( BusEntry->GetFlags() == 0 )
SaveCopyInUndoList( BusEntry, UR_CHANGED );
s_LastShape = entry_shape == '/' ? '/' : '\\';

View File

@ -293,7 +293,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
if( drawItem.m_Fill != FILLED_WITH_BG_BODYCOLOR )
continue;
if( aOnlySelected && drawItem.m_Selected == 0 )
if( aOnlySelected && !drawItem.IsSelected() )
continue;
// Do not draw an item while moving (the cursor handler does that)
@ -323,7 +323,7 @@ void LIB_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOff
BOOST_FOREACH( LIB_ITEM& drawItem, drawings )
{
if( aOnlySelected && drawItem.m_Selected == 0 )
if( aOnlySelected && !drawItem.IsSelected() )
continue;
// Do not draw an item while moving (the cursor handler does that)
@ -1199,7 +1199,6 @@ void LIB_COMPONENT::ClearStatus()
BOOST_FOREACH( LIB_ITEM& item, drawings )
{
item.m_Flags = 0;
item.m_Selected = 0;
}
}
@ -1210,7 +1209,7 @@ int LIB_COMPONENT::SelectItems( EDA_RECT& aRect, int aUnit, int aConvert, bool a
BOOST_FOREACH( LIB_ITEM& item, drawings )
{
item.m_Selected = 0;
item.ClearFlags( SELECTED );
if( ( item.m_Unit && item.m_Unit != aUnit )
|| ( item.m_Convert && item.m_Convert != aConvert ) )
@ -1226,7 +1225,7 @@ int LIB_COMPONENT::SelectItems( EDA_RECT& aRect, int aUnit, int aConvert, bool a
if( item.Inside( aRect ) )
{
item.m_Selected = IS_SELECTED;
item.SetFlags( SELECTED );
itemCount++;
}
}
@ -1239,11 +1238,11 @@ void LIB_COMPONENT::MoveSelectedItems( const wxPoint& aOffset )
{
BOOST_FOREACH( LIB_ITEM& item, drawings )
{
if( item.m_Selected == 0 )
if( !item.IsSelected() )
continue;
item.SetOffset( aOffset );
item.m_Flags = item.m_Selected = 0;
item.m_Flags = 0;
}
drawings.sort();
@ -1253,7 +1252,9 @@ void LIB_COMPONENT::MoveSelectedItems( const wxPoint& aOffset )
void LIB_COMPONENT::ClearSelectedItems()
{
BOOST_FOREACH( LIB_ITEM& item, drawings )
item.m_Flags = item.m_Selected = 0;
{
item.m_Flags = 0;
}
}
@ -1272,13 +1273,14 @@ void LIB_COMPONENT::DeleteSelectedItems()
{
#if 0 // Set to 1 to allows fields deletion on block delete or other global command
LIB_FIELD& field = ( LIB_FIELD& ) *item;
if( (field.GetId() == REFERENCE) || (field.m_FieldId == VALUE) ||
(field.m_Attributs & TEXT_NO_VISIBLE) )
#endif
item->m_Selected = 0;
item->ClearFlags( SELECTED );
}
if( item->m_Selected == 0 )
if( !item->IsSelected() )
item++;
else
item = drawings.erase( item );
@ -1298,17 +1300,18 @@ void LIB_COMPONENT::CopySelectedItems( const wxPoint& aOffset )
for( unsigned ii = 0; ii < icnt; ii++ )
{
LIB_ITEM& item = drawings[ii];
// We *do not* copy fields because they are unique for the whole component
// so skip them (do not duplicate) if they are flagged selected.
if( item.Type() == LIB_FIELD_T )
item.m_Selected = 0;
item.ClearFlags( SELECTED );
if( item.m_Selected == 0 )
if( !item.IsSelected() )
continue;
item.m_Selected = 0;
item.ClearFlags( SELECTED );
LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
newItem->m_Selected = IS_SELECTED;
newItem->SetFlags( SELECTED );
drawings.push_back( newItem );
}
@ -1322,11 +1325,11 @@ void LIB_COMPONENT::MirrorSelectedItemsH( const wxPoint& aCenter )
{
BOOST_FOREACH( LIB_ITEM& item, drawings )
{
if( item.m_Selected == 0 )
if( !item.IsSelected() )
continue;
item.MirrorHorizontal( aCenter );
item.m_Flags = item.m_Selected = 0;
item.m_Flags = 0;
}
drawings.sort();
@ -1336,11 +1339,11 @@ void LIB_COMPONENT::MirrorSelectedItemsV( const wxPoint& aCenter )
{
BOOST_FOREACH( LIB_ITEM& item, drawings )
{
if( item.m_Selected == 0 )
if( !item.IsSelected() )
continue;
item.MirrorVertical( aCenter );
item.m_Flags = item.m_Selected = 0;
item.m_Flags = 0;
}
drawings.sort();
@ -1350,11 +1353,11 @@ void LIB_COMPONENT::RotateSelectedItems( const wxPoint& aCenter )
{
BOOST_FOREACH( LIB_ITEM& item, drawings )
{
if( item.m_Selected == 0 )
if( !item.IsSelected() )
continue;
item.Rotate( aCenter );
item.m_Flags = item.m_Selected = 0;
item.m_Flags = 0;
}
drawings.sort();

View File

@ -225,7 +225,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
int value;
/* save old text in undo list if not already in edit */
if( m_CurrentText->m_Flags == 0 )
if( m_CurrentText->GetFlags() == 0 )
m_Parent->SaveCopyInUndoList( m_CurrentText, UR_CHANGED );
m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
@ -234,7 +234,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
if( !text.IsEmpty() )
m_CurrentText->m_Text = text;
else if( (m_CurrentText->m_Flags & IS_NEW) == 0 )
else if( !m_CurrentText->IsNew() )
DisplayError( this, _( "Empty Text!" ) );
m_CurrentText->SetOrientation( m_TextOrient->GetSelection() );
@ -266,7 +266,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
m_Parent->OnModify();
/* Make the text size as new default size if it is a new text */
if( (m_CurrentText->m_Flags & IS_NEW) != 0 )
if( m_CurrentText->IsNew() )
g_DefaultTextLabelSize = m_CurrentText->m_Size.x;
m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );

View File

@ -90,7 +90,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit
aPanel->SetMouseCapture( NULL, NULL ); // Avoid loop in redraw panel
int flgs = image->GetFlags();
image->m_Flags = 0;
image->ClearFlags();
aPanel->RefreshDrawingRect( dirty );
image->SetFlags( flgs );
aPanel->SetMouseCapture( moveBitmap, abortMoveBitmap );

View File

@ -18,7 +18,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
{
SCH_ITEM * curr_item = GetScreen()->GetCurItem();
if( !curr_item || curr_item->m_Flags )
if( !curr_item || curr_item->GetFlags() )
return;
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
@ -31,11 +31,10 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
newitem = new SCH_COMPONENT( *( (SCH_COMPONENT*) curr_item ) );
newitem->SetTimeStamp( GetNewTimeStamp() );
newitem->ClearAnnotation( NULL );
newitem->m_Flags = IS_NEW;
newitem->SetFlags( IS_NEW );
MoveItem( (SCH_ITEM*) newitem, &dc );
/* Redraw the original part, because StartMovePart() erased
* it from screen */
// Redraw the original part, because StartMovePart() erased it from screen.
curr_item->Draw( DrawPanel, &dc, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
}
break;

View File

@ -33,9 +33,6 @@ class TRANSFORM;
#define HIGHLIGHT_COLOR WHITE
/* Used for EDA_ITEM, .m_Select member */
#define IS_SELECTED 1
#define TEXT_NO_VISIBLE 1
//#define GR_DEFAULT_DRAWMODE GR_COPY

View File

@ -369,8 +369,9 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC )
return;
}
int flags = DrawComponent->m_Flags;
if( DrawComponent->m_Flags )
int flags = DrawComponent->GetFlags();
if( DrawComponent->GetFlags() )
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
@ -390,7 +391,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC )
DrawComponent->SetFlags( flags ); // Restore m_Flag (modified by SetConvert())
/* Redraw the component in the new position. */
if( DrawComponent->m_Flags & IS_MOVED )
if( DrawComponent->IsMoving() )
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
else
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );

View File

@ -387,7 +387,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
if( aColor < 0 ) // Used normal color or selected color
{
if( ( m_Selected & IS_SELECTED ) )
if( IsSelected() )
color = g_ItemSelectetColor;
}
else

View File

@ -316,7 +316,7 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( aColor < 0 ) // Used normal color or selected color
{
if( m_Selected & IS_SELECTED )
if( IsSelected() )
color = g_ItemSelectetColor;
}
else

View File

@ -228,7 +228,7 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( aColor < 0 ) // Used normal color or selected color
{
if( ( m_Selected & IS_SELECTED ) )
if( IsSelected() )
color = g_ItemSelectetColor;
}
else

View File

@ -292,7 +292,7 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
{
color = g_InvisibleItemColor;
}
else if( ( m_Selected & IS_SELECTED ) && ( aColor < 0 ) )
else if( IsSelected() && ( aColor < 0 ) )
{
color = g_ItemSelectetColor;
}

View File

@ -882,7 +882,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
if( aColor < 0 ) // Used normal color or selected color
{
if( (m_Selected & IS_SELECTED) )
if( IsSelected() )
color = g_ItemSelectetColor;
}
else
@ -1104,7 +1104,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
GRSetDrawMode( DC, DrawMode );
/* Get the num and name colors */
if( (Color < 0) && (m_Selected & IS_SELECTED) )
if( (Color < 0) && IsSelected() )
Color = g_ItemSelectetColor;
NameColor = (EDA_Colors) ( Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color );

View File

@ -282,7 +282,7 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint
if( aColor < 0 ) // Used normal color or selected color
{
if( m_Selected & IS_SELECTED )
if( IsSelected() )
color = g_ItemSelectetColor;
}
else

View File

@ -214,7 +214,7 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( aColor < 0 ) // Used normal color or selected color
{
if( m_Selected & IS_SELECTED )
if( IsSelected() )
color = g_ItemSelectetColor;
}
else

View File

@ -350,7 +350,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
if( aColor < 0 ) // Used normal color or selected color
{
if( ( m_Selected & IS_SELECTED ) )
if( IsSelected() )
color = g_ItemSelectetColor;
}
else

View File

@ -22,7 +22,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
if( m_component == NULL ) // No component loaded !
return;
if( item == NULL || item->m_Flags == 0 )
if( item == NULL || item->GetFlags() == 0 )
{
item = LocateItemUsingCursor( aPosition );
@ -40,7 +40,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( item && item->m_Flags ) // moved object
if( item && item->GetFlags() ) // moved object
{
switch( item->Type() )
{
@ -56,7 +56,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
break;
case ID_LIBEDIT_PIN_BUTT:
if( m_drawItem == NULL || m_drawItem->m_Flags == 0 )
if( m_drawItem == NULL || m_drawItem->GetFlags() == 0 )
{
CreatePin( DC );
}
@ -71,7 +71,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
case ID_LIBEDIT_BODY_RECT_BUTT:
case ID_LIBEDIT_BODY_TEXT_BUTT:
if( m_drawItem == NULL || m_drawItem->m_Flags == 0 )
if( m_drawItem == NULL || m_drawItem->GetFlags() == 0 )
{
m_drawItem = CreateGraphicItem( m_component, DC );
}
@ -118,7 +118,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
if( m_component == NULL )
return;
if( ( m_drawItem == NULL ) || ( m_drawItem->m_Flags == 0 ) )
if( ( m_drawItem == NULL ) || ( m_drawItem->GetFlags() == 0 ) )
{ // We can locate an item
m_drawItem = LocateItemUsingCursor( aPosition );
@ -140,7 +140,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
switch( m_drawItem->Type() )
{
case LIB_PIN_T:
if( m_drawItem->m_Flags == 0 )
if( m_drawItem->GetFlags() == 0 )
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
@ -151,14 +151,14 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
case LIB_ARC_T:
case LIB_CIRCLE_T:
case LIB_RECTANGLE_T:
if( m_drawItem->m_Flags == 0 )
if( m_drawItem->GetFlags() == 0 )
{
EditGraphicSymbol( DC, m_drawItem );
}
break;
case LIB_POLYLINE_T:
if( m_drawItem->m_Flags == 0 )
if( m_drawItem->GetFlags() == 0 )
{
EditGraphicSymbol( DC, m_drawItem );
}
@ -169,14 +169,14 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
break;
case LIB_TEXT_T:
if( m_drawItem->m_Flags == 0 )
if( m_drawItem->GetFlags() == 0 )
{
EditSymbolText( DC, m_drawItem );
}
break;
case LIB_FIELD_T:
if( m_drawItem->m_Flags == 0 )
if( m_drawItem->GetFlags() == 0 )
{
EditField( DC, (LIB_FIELD*) m_drawItem );
}

View File

@ -234,8 +234,8 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame )
{
bool selected = (Pin->m_Selected & IS_SELECTED) != 0;
bool not_in_move = (Pin->GetFlags() == 0);
bool selected = Pin->IsSelected();
bool not_in_move = !Pin->IsMoving();
wxString msg;
if( not_in_move )

View File

@ -72,7 +72,7 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
* the margin is 10% the size of the component size
*/
wxSize pagesize = GetScreen()->ReturnPageSize( );
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).m_Size;
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
componentSize.x = (int)(componentSize.x * 1.2);

View File

@ -248,7 +248,7 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* aDrawStruct, bool aClone )
if( aClone )
NewDrawStruct->SetTimeStamp( aDrawStruct->GetTimeStamp() );
NewDrawStruct->m_Image = aDrawStruct;
NewDrawStruct->SetImage( aDrawStruct );
return NewDrawStruct;
}

View File

@ -70,7 +70,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
if( m_drawItem == NULL || m_drawItem->Type() != LIB_PIN_T )
return;
int item_flags = m_drawItem->m_Flags; // save flags to restore them after editing
int item_flags = m_drawItem->GetFlags(); // save flags to restore them after editing
LIB_PIN* pin = (LIB_PIN*) m_drawItem;
DIALOG_LIB_EDIT_PIN dlg( this, pin );
@ -115,7 +115,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
{
if( pin->IsNew() )
{
pin->m_Flags |= IS_CANCELLED;
pin->SetFlags( IS_CANCELLED );
DrawPanel->EndMouseCapture();
}
return;
@ -158,7 +158,8 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
pin->EnableEditMode( false, m_editPinsPerPartOrConvert );
// Restore pin flags, that can be changed by the dialog editor
pin->m_Flags = item_flags;
pin->ClearFlags();
pin->SetFlags( item_flags );
}
@ -214,7 +215,7 @@ void LIB_EDIT_FRAME::PlacePin( wxDC* DC )
// Test for an other pin in same new position:
for( Pin = m_component->GetNextPin(); Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
{
if( Pin == CurrentPin || newpos != Pin->GetPosition() || Pin->m_Flags )
if( Pin == CurrentPin || newpos != Pin->GetPosition() || Pin->GetFlags() )
continue;
if( ask_for_pin && SynchronizePins() )
@ -260,11 +261,11 @@ another pin. Continue?" ) );
/* Put linked pins in new position, and clear flags */
for( Pin = m_component->GetNextPin(); Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
{
if( Pin->m_Flags == 0 )
if( Pin->GetFlags() == 0 )
continue;
Pin->SetPosition( CurrentPin->GetPosition() );
Pin->m_Flags = 0;
Pin->ClearFlags();
}
DrawPanel->CrossHairOff( DC );
@ -296,7 +297,7 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
for( ; Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
{
Pin->m_Flags = 0;
Pin->ClearFlags();
if( Pin == CurrentPin )
continue;
@ -304,10 +305,10 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
if( ( Pin->GetPosition() == CurrentPin->GetPosition() )
&& ( Pin->GetOrientation() == CurrentPin->GetOrientation() )
&& SynchronizePins() )
Pin->m_Flags |= IS_LINKED | IS_MOVED;
Pin->SetFlags( IS_LINKED | IS_MOVED );
}
CurrentPin->m_Flags |= IS_LINKED | IS_MOVED;
CurrentPin->SetFlags( IS_LINKED | IS_MOVED );
PinPreviousPos = OldPos = CurrentPin->GetPosition();
startPos.x = OldPos.x;
@ -378,13 +379,13 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
m_drawItem = pin;
pin->m_Flags = IS_NEW;
pin->SetFlags( IS_NEW );
pin->SetUnit( m_unit );
pin->SetConvert( m_convert );
/* Flag pins to consider */
if( SynchronizePins() )
pin->m_Flags |= IS_LINKED;
pin->SetFlags( IS_LINKED );
pin->SetPosition( GetScreen()->GetCrossHairPosition( true ) );
pin->SetLength( LastPinLength );
@ -404,7 +405,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
DrawPanel->MoveCursorToCrossHair();
DrawPanel->m_IgnoreMouseEvents = false;
if( pin->m_Flags & IS_CANCELLED )
if( pin->GetFlags() & IS_CANCELLED )
{
deleteItem( DC );
}
@ -480,7 +481,7 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
{
LIB_PIN* Pin;
bool selected = ( MasterPin->m_Selected & IS_SELECTED ) != 0;
bool selected = MasterPin->IsSelected();
bool showPinText = true;
if( ( m_component == NULL ) || ( MasterPin == NULL ) )
@ -499,7 +500,7 @@ void LIB_EDIT_FRAME::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
continue;
// Is it the "selected mode" ?
if( selected && ( Pin->m_Selected & IS_SELECTED ) == 0 )
if( selected && !Pin->IsSelected() )
continue;
Pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &showPinText, DefaultTransform );
@ -535,7 +536,8 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
return;
Pin = (LIB_PIN*) SourcePin->Clone();
Pin->m_Flags = IS_NEW;
Pin->ClearFlags();
Pin->SetFlags( IS_NEW );
Pin->SetPosition( Pin->GetPosition() + wxPoint( g_RepeatStep.x, -g_RepeatStep.y ) );
wxString nextName = Pin->GetName();
IncrementLabelMember( nextName );
@ -548,7 +550,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
m_drawItem = Pin;
if( SynchronizePins() )
Pin->m_Flags |= IS_LINKED;
Pin->SetFlags( IS_LINKED );
wxPoint savepos = GetScreen()->GetCrossHairPosition();
DrawPanel->CrossHairOff( DC );

View File

@ -313,7 +313,7 @@ void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset
SCH_FIELD* field = GetField( REFERENCE );
if( field->IsVisible() && !( field->m_Flags & IS_MOVED ) )
if( field->IsVisible() && !field->IsMoving() )
{
field->Draw( panel, DC, offset, DrawMode );
}
@ -322,7 +322,7 @@ void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset
{
field = GetField( ii );
if( field->m_Flags & IS_MOVED )
if( field->IsMoving() )
continue;
field->Draw( panel, DC, offset, DrawMode );

View File

@ -649,7 +649,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
/* Draw text : SheetLabel */
BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins )
{
if( !( sheetPin.m_Flags & IS_MOVED ) )
if( !sheetPin.IsMoving() )
sheetPin.Draw( aPanel, aDC, aOffset, aDrawMode, aColor );
}
}
@ -676,7 +676,7 @@ EDA_RECT SCH_SHEET::GetBoundingBox() const
end += m_pos;
// Move upper and lower limits to include texts:
box.m_Pos.y -= wxRound( m_sheetNameSize * 1.3 ) + 8;
box.SetY( box.GetY() - ( wxRound( m_sheetNameSize * 1.3 ) + 8 ) );
end.y += wxRound( m_fileNameSize * 1.3 ) + 8;
box.SetEnd( end );

View File

@ -54,7 +54,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
CMP_LIBRARY* Lib;
/* Exit if no library entry is selected or a command is in progress. */
if( m_component == NULL || ( m_drawItem && m_drawItem->m_Flags ) )
if( m_component == NULL || ( m_drawItem && m_drawItem->GetFlags() ) )
return;
DrawPanel->m_IgnoreMouseEvents = true;
@ -115,8 +115,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
if( item.GetConvert() )
item.SetConvert( m_convert );
item.m_Flags = IS_NEW;
item.m_Selected = IS_SELECTED;
item.SetFlags( IS_NEW | SELECTED );
LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
newItem->SetParent( m_component );
@ -126,7 +125,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
m_component->RemoveDuplicateDrawItems();
m_component->ClearSelectedItems();
OnModify( );
OnModify();
DrawPanel->Refresh();
delete Lib;

View File

@ -26,11 +26,11 @@ void GERBVIEW_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
if( GetToolId() == ID_NO_TOOL_SELECTED )
{
if( DrawStruct && DrawStruct->m_Flags )
if( DrawStruct && DrawStruct->GetFlags() )
{
msg.Printf( wxT( "GERBVIEW_FRAME::OnLeftClick err: Struct %d, m_Flags = %X" ),
(unsigned) DrawStruct->Type(),
(unsigned) DrawStruct->m_Flags );
(unsigned) DrawStruct->GetFlags() );
wxFAIL_MSG( msg );
}
else

View File

@ -23,7 +23,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
DrawPanel->m_CanStartBlock = -1;
// Simple location of elements where possible.
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
if( ( DrawStruct == NULL ) || ( DrawStruct->GetFlags() == 0 ) )
{
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
}
@ -31,7 +31,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
// If command in progress, end command.
if( GetToolId() != ID_NO_TOOL_SELECTED )
{
if( DrawStruct && DrawStruct->m_Flags )
if( DrawStruct && DrawStruct->GetFlags() )
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), KiBitmap( cancel_xpm ) );
else
@ -42,7 +42,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
}
else
{
if( (DrawStruct && DrawStruct->m_Flags) || BlockActive )
if( (DrawStruct && DrawStruct->GetFlags()) || BlockActive )
{
if( BlockActive )
{

View File

@ -185,7 +185,7 @@ public:
*/
class EDA_RECT
{
public:
private:
wxPoint m_Pos; // Rectangle Origin
wxSize m_Size; // Rectangle Size
@ -344,7 +344,7 @@ public:
#define BEGIN_ONPAD (1 << 22) ///< Pcbnew: flag set for track segment starting on a pad
#define END_ONPAD (1 << 23) ///< Pcbnew: flag set for track segment ending on a pad
#define BUSY (1 << 24) ///< Pcbnew: flag indicating that the structure has
// already been edited, in some functions
///< already been edited, in some functions
#define EDA_ITEM_ALL_FLAGS -1
@ -377,14 +377,12 @@ protected:
/// Set to true to override the visibility setting of the item.
bool m_forceVisible;
public:
int m_Flags; // flags for editing and other uses.
/// Flag bits for editing and other uses.
int m_Flags;
int m_Selected; /* Used by block commands, and selective editing */
// Link to an copy of the item use to save the item's state for undo/redo feature.
EDA_ITEM* m_Image;
// member used in undo/redo function
EDA_ITEM* m_Image; // Link to an image copy to save a copy of
// old parameters values
private:
void InitVars();
@ -462,6 +460,8 @@ public:
void ClearFlags( int aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; }
int GetFlags() const { return m_Flags; }
void SetImage( EDA_ITEM* aItem ) { m_Image = aItem; }
/**
* Function SetForceVisible
* is used to set and cleag force visible flag used to force the item to be drawn

View File

@ -405,11 +405,11 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
for( ii = 0; ii < Board.m_Nrows; ii++ )
{
oy = bbbox.m_Pos.y + ( ii * Board.m_GridRouting );
oy = bbbox.GetY() + ( ii * Board.m_GridRouting );
for( jj = 0; jj < Board.m_Ncols; jj++ )
{
ox = bbbox.m_Pos.x + (jj * Board.m_GridRouting);
ox = bbbox.GetX() + (jj * Board.m_GridRouting);
color = BLACK;
top_state = GetCell( ii, jj, TOP );
@ -455,8 +455,8 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
}
/* The boundary box must have its start point on placing grid: */
bbbox.m_Pos.x -= bbbox.m_Pos.x % Board.m_GridRouting;
bbbox.m_Pos.y -= bbbox.m_Pos.y % Board.m_GridRouting;
bbbox.SetX( bbbox.GetX() - ( bbbox.GetX() % Board.m_GridRouting ) );
bbbox.SetY( bbbox.GetY() - ( bbbox.GetY() % Board.m_GridRouting ) );
/* The boundary box must have its end point on placing grid: */
wxPoint end = bbbox.GetEnd();
@ -566,31 +566,31 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
int layerMask;
D_PAD* Pad;
ox = Module->m_BoundaryBox.m_Pos.x - marge;
ox = Module->m_BoundaryBox.GetX() - marge;
fx = Module->m_BoundaryBox.GetRight() + marge;
oy = Module->m_BoundaryBox.m_Pos.y - marge;
oy = Module->m_BoundaryBox.GetY() - marge;
fy = Module->m_BoundaryBox.GetBottom() + marge;
if( ox < bbbox.m_Pos.x )
ox = bbbox.m_Pos.x;
if( ox < bbbox.GetX() )
ox = bbbox.GetX();
if( ox > bbbox.GetRight() )
ox = bbbox.GetRight();
if( fx < bbbox.m_Pos.x )
fx = bbbox.m_Pos.x;
if( fx < bbbox.GetX() )
fx = bbbox.GetX();
if( fx > bbbox.GetRight() )
fx = bbbox.GetRight();
if( oy < bbbox.m_Pos.y )
oy = bbbox.m_Pos.y;
if( oy < bbbox.GetY() )
oy = bbbox.GetY();
if( oy > bbbox.GetBottom() )
oy = bbbox.GetBottom();
if( fy < bbbox.m_Pos.y )
fy = bbbox.m_Pos.y;
if( fy < bbbox.GetY() )
fy = bbbox.GetY();
if( fy > bbbox.GetBottom() )
fy = bbbox.GetBottom();
@ -636,17 +636,17 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
aModule->DisplayInfo( this );
LastPosOK.x = bbbox.m_Pos.x;
LastPosOK.y = bbbox.m_Pos.y;
LastPosOK.x = bbbox.GetX();
LastPosOK.y = bbbox.GetY();
cx = aModule->m_Pos.x; cy = aModule->m_Pos.y;
ox = aModule->m_BoundaryBox.m_Pos.x - cx;
fx = aModule->m_BoundaryBox.m_Size.x + ox;
oy = aModule->m_BoundaryBox.m_Pos.y - cy;
fy = aModule->m_BoundaryBox.m_Size.y + oy;
ox = aModule->m_BoundaryBox.GetX() - cx;
fx = aModule->m_BoundaryBox.GetWidth() + ox;
oy = aModule->m_BoundaryBox.GetY() - cy;
fy = aModule->m_BoundaryBox.GetHeight() + oy;
CurrPosition.x = bbbox.m_Pos.x - ox;
CurrPosition.y = bbbox.m_Pos.y - oy;
CurrPosition.x = bbbox.GetX() - ox;
CurrPosition.y = bbbox.GetY() - oy;
/* Module placement on grid. */
CurrPosition.x -= CurrPosition.x % Board.m_GridRouting;
@ -699,13 +699,13 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
}
cx = aModule->m_Pos.x; cy = aModule->m_Pos.y;
aModule->m_BoundaryBox.m_Pos.x = ox + CurrPosition.x;
aModule->m_BoundaryBox.m_Pos.y = oy + CurrPosition.y;
aModule->m_BoundaryBox.SetX( ox + CurrPosition.x );
aModule->m_BoundaryBox.SetY( oy + CurrPosition.y );
DrawModuleOutlines( DrawPanel, aDC, aModule );
g_Offset_Module.x = cx - CurrPosition.x;
CurrPosition.y = bbbox.m_Pos.y - oy;
CurrPosition.y = bbbox.GetY() - oy;
/* Placement on grid. */
CurrPosition.y -= CurrPosition.y % Board.m_GridRouting;
@ -722,8 +722,8 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
Compute_Ratsnest_PlaceModule( aDC );
showRat = 0;
aModule->m_BoundaryBox.m_Pos.x = ox + CurrPosition.x;
aModule->m_BoundaryBox.m_Pos.y = oy + CurrPosition.y;
aModule->m_BoundaryBox.SetX( ox + CurrPosition.x );
aModule->m_BoundaryBox.SetY( oy + CurrPosition.y );
g_Offset_Module.y = cy - CurrPosition.y;
DrawModuleOutlines( DrawPanel, aDC, aModule );
@ -763,8 +763,8 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
Compute_Ratsnest_PlaceModule( aDC );
/* Regeneration of the modified variable. */
aModule->m_BoundaryBox.m_Pos.x = ox + cx;
aModule->m_BoundaryBox.m_Pos.y = oy + cy;
aModule->m_BoundaryBox.SetX( ox + cx );
aModule->m_BoundaryBox.SetY( oy + cy );
CurrPosition = LastPosOK;
GetBoard()->m_Status_Pcb &= ~( RATSNEST_ITEM_LOCAL_OK | LISTE_PAD_OK );
@ -786,10 +786,10 @@ int TstRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1, int side )
int row_min, row_max, col_min, col_max;
unsigned int data;
ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->GetBoundingBox().m_Pos.y;
ux0 -= Pcb->GetBoundingBox().GetX();
uy0 -= Pcb->GetBoundingBox().GetY();
ux1 -= Pcb->GetBoundingBox().GetX();
uy1 -= Pcb->GetBoundingBox().GetY();
row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / Board.m_GridRouting;
@ -843,10 +843,10 @@ unsigned int CalculateKeepOutArea( BOARD* Pcb, int ux0, int uy0, int ux1, int uy
int row_min, row_max, col_min, col_max;
unsigned int keepOut;
ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->GetBoundingBox().m_Pos.y;
ux0 -= Pcb->GetBoundingBox().GetX();
uy0 -= Pcb->GetBoundingBox().GetY();
ux1 -= Pcb->GetBoundingBox().GetX();
uy1 -= Pcb->GetBoundingBox().GetY();
row_max = uy1 / Board.m_GridRouting;
col_max = ux1 / Board.m_GridRouting;
@ -902,9 +902,9 @@ int TstModuleOnBoard( BOARD* Pcb, MODULE* Module, bool TstOtherSide )
side = BOTTOM; otherside = TOP;
}
ox = Module->m_BoundaryBox.m_Pos.x;
ox = Module->m_BoundaryBox.GetX();
fx = Module->m_BoundaryBox.GetRight();
oy = Module->m_BoundaryBox.m_Pos.y;
oy = Module->m_BoundaryBox.GetY();
fy = Module->m_BoundaryBox.GetBottom();
error = TstRectangle( Pcb, ox, oy, fx, fy, side );
@ -1017,10 +1017,10 @@ static void CreateKeepOutRectangle( BOARD* Pcb,
if( trace == 0 )
return;
ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->GetBoundingBox().m_Pos.y;
ux0 -= Pcb->GetBoundingBox().GetX();
uy0 -= Pcb->GetBoundingBox().GetY();
ux1 -= Pcb->GetBoundingBox().GetX();
uy1 -= Pcb->GetBoundingBox().GetY();
ux0 -= marge; ux1 += marge;
uy0 -= marge; uy1 += marge;

View File

@ -610,7 +610,7 @@ void PCB_EDIT_FRAME::Block_Delete()
case PCB_MODULE_T:
{
MODULE* module = (MODULE*) item;
module->m_Flags = 0;
module->ClearFlags();
module->UnLink();
m_Pcb->m_Status_Pcb = 0;
}
@ -675,7 +675,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
switch( item->Type() )
{
case PCB_MODULE_T:
( (MODULE*) item )->m_Flags = 0;
( (MODULE*) item )->ClearFlags();
m_Pcb->m_Status_Pcb = 0;
break;
@ -736,7 +736,7 @@ void PCB_EDIT_FRAME::Block_Flip()
switch( item->Type() )
{
case PCB_MODULE_T:
item->m_Flags = 0;
item->ClearFlags();
m_Pcb->m_Status_Pcb = 0;
break;
@ -791,7 +791,7 @@ void PCB_EDIT_FRAME::Block_Move()
{
case PCB_MODULE_T:
m_Pcb->m_Status_Pcb = 0;
item->m_Flags = 0;
item->ClearFlags();
break;
/* Move track segments */
@ -851,7 +851,7 @@ void PCB_EDIT_FRAME::Block_Duplicate()
MODULE* module = (MODULE*) item;
MODULE* new_module;
m_Pcb->m_Status_Pcb = 0;
module->m_Flags = 0;
module->ClearFlags();
newitem = new_module = new MODULE( m_Pcb );
new_module->Copy( module );
new_module->SetTimeStamp( GetNewTimeStamp() );

View File

@ -55,7 +55,6 @@
#define BLOCK_COLOR BROWN
#define IS_SELECTED 1
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
@ -285,7 +284,7 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
OnModify();
GetScreen()->m_BlockLocate.m_Flags = 0;
GetScreen()->m_BlockLocate.ClearFlags();
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
SetCurItem( NULL );
@ -322,7 +321,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
for( ; item != NULL; item = item->Next() )
{
if( item->m_Selected == 0 )
if( !item->IsSelected() )
continue;
switch( item->Type() )
@ -341,7 +340,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
for( ; pad != NULL; pad = pad->Next() )
{
if( pad->m_Selected == 0 )
if( !pad->IsSelected() )
continue;
pad->Draw( aPanel, aDC, g_XorMode, move_offset );
@ -361,7 +360,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
for( ; item != NULL; item = item->Next() )
{
if( item->m_Selected == 0 )
if( !item->IsSelected() )
continue;
switch( item->Type() )
@ -380,7 +379,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
for( ; pad != NULL; pad = pad->Next() )
{
if( pad->m_Selected == 0 )
if( !pad->IsSelected() )
continue;
pad->Draw( aPanel, aDC, g_XorMode, move_offset );
@ -398,22 +397,22 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
if( pad->m_Selected == 0 )
if( !pad->IsSelected() )
continue;
pad->m_Selected = 0;
pad->ClearFlags( SELECTED );
D_PAD* NewPad = new D_PAD( module );
NewPad->Copy( pad );
NewPad->m_Selected = IS_SELECTED;
NewPad->SetFlags( SELECTED );
module->m_Pads.PushFront( NewPad );
}
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
{
if( item->m_Selected == 0 )
if( !item->IsSelected() )
continue;
item->m_Selected = 0;
item->ClearFlags( SELECTED );
switch( item->Type() )
{
@ -421,7 +420,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
TEXTE_MODULE * textm;
textm = new TEXTE_MODULE( module );
textm->Copy( (TEXTE_MODULE*) item );
textm->m_Selected = IS_SELECTED;
textm->SetFlags( SELECTED );
module->m_Drawings.PushFront( textm );
break;
@ -429,7 +428,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
EDGE_MODULE * edge;
edge = new EDGE_MODULE( module );
edge->Copy( (EDGE_MODULE*) item );
edge->m_Selected = IS_SELECTED;
edge->SetFlags( SELECTED );
module->m_Drawings.PushFront( edge );
break;
@ -456,7 +455,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
for( ; pad != NULL; pad = pad->Next() )
{
if( pad->m_Selected == 0 )
if( !pad->IsSelected() )
continue;
pad->SetPosition( pad->GetPosition() + offset );
@ -467,7 +466,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
for( ; item != NULL; item = item->Next() )
{
if( item->m_Selected == 0 )
if( !item->IsSelected() )
continue;
switch( item->Type() )
@ -494,7 +493,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
;
}
item->m_Flags = item->m_Selected = 0;
item->ClearFlags();
}
}
@ -517,7 +516,7 @@ void DeleteMarkedItems( MODULE* module )
{
next_pad = pad->Next();
if( pad->m_Selected == 0 )
if( !pad->IsSelected() )
continue;
pad->DeleteStructure();
@ -529,7 +528,7 @@ void DeleteMarkedItems( MODULE* module )
{
next_item = item->Next();
if( item->m_Selected == 0 )
if( !item->IsSelected() )
continue;
item->DeleteStructure();
@ -549,7 +548,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
if( pad->m_Selected == 0 )
if( pad->IsSelected() )
continue;
tmp = pad->GetPosition();
@ -565,7 +564,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() )
{
if( item->m_Selected == 0 )
if( !item->IsSelected() )
continue;
switch( item->Type() )
@ -603,8 +602,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
break;
}
item->m_Flags = 0;
item->m_Selected = 0;
item->ClearFlags();
}
}
@ -620,7 +618,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
if( pad->m_Selected == 0 )
if( !pad->IsSelected() )
continue;
wxPoint pos = pad->GetPosition();
@ -634,43 +632,43 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() )
{
if( item->m_Selected == 0 )
if( !item->IsSelected() )
continue;
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
wxPoint tmp = em->GetStart();
ROTATE( tmp );
em->SetStart( tmp );
em->SetStart0( tmp );
wxPoint tmp = em->GetStart();
ROTATE( tmp );
em->SetStart( tmp );
em->SetStart0( tmp );
tmp = em->GetEnd();
ROTATE( tmp );
em->SetEnd( tmp );
em->SetEnd0( tmp );
}
break;
tmp = em->GetEnd();
ROTATE( tmp );
em->SetEnd( tmp );
em->SetEnd0( tmp );
}
break;
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
wxPoint pos = tm->GetPosition();
ROTATE( pos );
tm->SetPosition( pos );
tm->SetPos0( tm->GetPosition() );
tm->SetOrientation( tm->GetOrientation() + 900 );
}
break;
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
wxPoint pos = tm->GetPosition();
ROTATE( pos );
tm->SetPosition( pos );
tm->SetPos0( tm->GetPosition() );
tm->SetOrientation( tm->GetOrientation() + 900 );
}
break;
default:
;
}
item->m_Flags = item->m_Selected = 0;
item->ClearFlags();
}
}
@ -685,12 +683,16 @@ void ClearMarkItems( MODULE* module )
item = module->m_Drawings;
for( ; item != NULL; item = item->Next() )
item->m_Flags = item->m_Selected = 0;
{
item->ClearFlags();
}
item = module->m_Pads;
for( ; item != NULL; item = item->Next() )
item->m_Flags = item->m_Selected = 0;
{
item->ClearFlags();
}
}
@ -711,12 +713,12 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
for( ; pad != NULL; pad = pad->Next() )
{
pad->m_Selected = 0;
pad->ClearFlags( SELECTED );
pos = pad->GetPosition();
if( Rect.Contains( pos ) )
{
pad->m_Selected = IS_SELECTED;
pad->SetFlags( SELECTED );
ItemsCount++;
}
}
@ -725,14 +727,14 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
for( ; item != NULL; item = item->Next() )
{
item->m_Selected = 0;
item->ClearFlags( SELECTED );
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
if( ((EDGE_MODULE*)item )->HitTest( Rect ) )
{
item->m_Selected = IS_SELECTED;
item->SetFlags( SELECTED );
ItemsCount++;
}
@ -743,7 +745,7 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
if( Rect.Contains( pos ) )
{
item->m_Selected = IS_SELECTED;
item->SetFlags( SELECTED );
ItemsCount++;
}

View File

@ -51,8 +51,7 @@ bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb )
// The boundary box must have its start point on routing grid:
m_BrdBox = aPcb->GetBoundingBox();
m_BrdBox.m_Pos.x -= m_BrdBox.m_Pos.x % m_GridRouting;
m_BrdBox.m_Pos.y -= m_BrdBox.m_Pos.y % m_GridRouting;
m_BrdBox.Offset( -(m_BrdBox.GetX() % m_GridRouting), -(m_BrdBox.GetY() % m_GridRouting) );
// The boundary box must have its end point on routing grid:
wxPoint end = m_BrdBox.GetEnd();
@ -63,15 +62,16 @@ bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb )
end.y -= end.y % m_GridRouting;
end.y += m_GridRouting;
m_BrdBox.SetEnd(end);
m_BrdBox.SetEnd( end );
aPcb->SetBoundingBox( m_BrdBox );
m_Nrows = Nrows = m_BrdBox.m_Size.y / m_GridRouting;
m_Ncols = Ncols = m_BrdBox.m_Size.x / m_GridRouting;
m_Nrows = Nrows = m_BrdBox.GetHeight() / m_GridRouting;
m_Ncols = Ncols = m_BrdBox.GetWidth() / m_GridRouting;
/* get a small margin for memory allocation: */
Ncols += 1; Nrows += 1;
Ncols += 1;
Nrows += 1;
return true;
}
@ -371,48 +371,45 @@ int Build_Work( BOARD* Pcb )
current_net_code = pt_pad->GetNet();
pt_ch = pt_rats;
r1 = ( pt_pad->GetPosition().y - bbbox.m_Pos.y
+ demi_pas ) / Board.m_GridRouting;
r1 = ( pt_pad->GetPosition().y - bbbox.GetY() + demi_pas ) / Board.m_GridRouting;
if( r1 < 0 || r1 >= Nrows )
{
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1,
pt_pad->GetPosition().y, bbbox.m_Pos.y );
pt_pad->GetPosition().y, bbbox.GetY() );
wxMessageBox( msg );
return 0;
}
c1 = ( pt_pad->GetPosition().x - bbbox.m_Pos.x
+ demi_pas ) / Board.m_GridRouting;
c1 = ( pt_pad->GetPosition().x - bbbox.GetX() + demi_pas ) / Board.m_GridRouting;
if( c1 < 0 || c1 >= Ncols )
{
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1,
pt_pad->GetPosition().x, bbbox.m_Pos.x );
pt_pad->GetPosition().x, bbbox.GetX() );
wxMessageBox( msg );
return 0;
}
pt_pad = pt_rats->m_PadEnd;
r2 = ( pt_pad->GetPosition().y - bbbox.m_Pos.y
r2 = ( pt_pad->GetPosition().y - bbbox.GetY()
+ demi_pas ) / Board.m_GridRouting;
if( r2 < 0 || r2 >= Nrows )
{
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2,
pt_pad->GetPosition().y, bbbox.m_Pos.y );
pt_pad->GetPosition().y, bbbox.GetY() );
wxMessageBox( msg );
return 0;
}
c2 = ( pt_pad->GetPosition().x - bbbox.m_Pos.x
+ demi_pas ) / Board.m_GridRouting;
c2 = ( pt_pad->GetPosition().x - bbbox.GetX() + demi_pas ) / Board.m_GridRouting;
if( c2 < 0 || c2 >= Ncols )
{
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2,
pt_pad->GetPosition().x, bbbox.m_Pos.x );
pt_pad->GetPosition().x, bbbox.GetX() );
wxMessageBox( msg );
return 0;
}

View File

@ -569,7 +569,7 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
}
}
item->m_Flags = 0;
item->ClearFlags();
// see if we must rebuild ratsnets and pointers lists
switch( item->Type() )

View File

@ -386,8 +386,8 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
if( ii == 0 )
p_end = pt;
bbox.m_Pos.x = MIN( bbox.m_Pos.x, pt.x );
bbox.m_Pos.y = MIN( bbox.m_Pos.y, pt.y );
bbox.SetX( MIN( bbox.GetX(), pt.x ) );
bbox.SetY( MIN( bbox.GetY(), pt.y ) );
p_end.x = MAX( p_end.x, pt.x );
p_end.y = MAX( p_end.y, pt.y );
}

View File

@ -213,12 +213,12 @@ void MODULE::Copy( MODULE* aModule )
*/
void MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoint& aOffset )
{
if( (m_Flags & DO_NOT_DRAW) || (m_Flags & IS_MOVED) )
if( (m_Flags & DO_NOT_DRAW) || (IsMoving()) )
return;
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
if( pad->m_Flags & IS_MOVED )
if( pad->IsMoving() )
continue;
pad->Draw( aPanel, aDC, aDrawMode, aOffset );
@ -232,19 +232,19 @@ void MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoi
/* Draw graphic items */
if( brd->IsElementVisible( MOD_REFERENCES_VISIBLE ) )
{
if( !(m_Reference->m_Flags & IS_MOVED) )
if( !(m_Reference->IsMoving()) )
m_Reference->Draw( aPanel, aDC, aDrawMode, aOffset );
}
if( brd->IsElementVisible( MOD_VALUES_VISIBLE ) )
{
if( !(m_Value->m_Flags & IS_MOVED) )
if( !(m_Value->IsMoving()) )
m_Value->Draw( aPanel, aDC, aDrawMode, aOffset );
}
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
{
if( item->m_Flags & IS_MOVED )
if( item->IsMoving() )
continue;
switch( item->Type() )
@ -303,7 +303,7 @@ EDA_RECT MODULE::GetFootPrintRect() const
{
EDA_RECT area;
area.m_Pos = m_Pos;
area.SetOrigin( m_Pos );
area.SetEnd( m_Pos );
area.Inflate( 50 ); // Give a min size
@ -425,10 +425,10 @@ bool MODULE::HitTest( const wxPoint& aRefPos )
bool MODULE::HitTest( EDA_RECT& aRefArea )
{
if( m_BoundaryBox.m_Pos.x < aRefArea.GetX() )
if( m_BoundaryBox.GetX() < aRefArea.GetX() )
return false;
if( m_BoundaryBox.m_Pos.y < aRefArea.GetY() )
if( m_BoundaryBox.GetY() < aRefArea.GetY() )
return false;
if( m_BoundaryBox.GetRight() > aRefArea.GetRight() )
@ -576,8 +576,8 @@ void MODULE::Show( int nestLevel, std::ostream& os ) const
" layer=\"" << board->GetLayerName( m_Layer ).mb_str() << '"' <<
">\n";
NestedSpace( nestLevel + 1, os ) <<
"<boundingBox" << m_BoundaryBox.m_Pos << m_BoundaryBox.m_Size << "/>\n";
NestedSpace( nestLevel + 1, os ) << "<boundingBox" << m_BoundaryBox.GetPosition()
<< m_BoundaryBox.GetSize() << "/>\n";
NestedSpace( nestLevel + 1, os ) << "<orientation tenths=\"" << m_Orient
<< "\"/>\n";

View File

@ -58,7 +58,7 @@ static bool ShowClearance( const TRACK* aTrack )
return aTrack->GetLayer() <= LAST_COPPER_LAYER
&& ( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_VIA_T )
&& ( ( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS
&& ( aTrack->m_Flags & IS_DRAGGED || aTrack->m_Flags & IS_MOVED || aTrack->m_Flags & IS_NEW ) )
&& ( aTrack->IsDragging() || aTrack->IsMoving() || aTrack->IsNew() ) )
|| ( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS )
);

View File

@ -312,7 +312,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
EDA_ITEM* DrawStruct = GetScreen()->GetCurItem();
if( DrawStruct && DrawStruct->m_Flags )
if( DrawStruct && DrawStruct->GetFlags() )
keep_on_grid = true;
if( keep_on_grid )

View File

@ -451,7 +451,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
wxPoint modpos;
wxString msg;
if( m_CurrentModule->m_Flags == 0 ) // this is a simple edition, we
if( m_CurrentModule->GetFlags() == 0 ) // this is a simple edition, we
// must create an undo entry
m_Parent->SaveCopyInUndoList( m_CurrentModule, UR_CHANGED );

View File

@ -160,7 +160,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
if( m_dc ) //Erase old text on screen
{
m_currentText->Draw( m_parent->DrawPanel, m_dc, GR_XOR,
(m_currentText->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ) );
(m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) );
}
m_currentText->m_Text = m_Name->GetValue();
@ -212,9 +212,11 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
if( m_dc ) // Display new text
{
m_currentText->Draw( m_parent->DrawPanel, m_dc, GR_XOR,
(m_currentText->m_Flags & IS_MOVED) ? MoveVector : wxPoint( 0, 0 ) );
(m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) );
}
m_parent->OnModify();
if( m_module )
m_module->m_LastEdit_Time = time( NULL );

View File

@ -599,13 +599,14 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
Module->m_LastEdit_Time = time( NULL );
// redraw the area where the pad was, without pad (delete pad on screen)
m_CurrentPad->m_Flags |= DO_NOT_DRAW;
m_CurrentPad->SetFlags( DO_NOT_DRAW );
m_Parent->DrawPanel->RefreshDrawingRect( m_CurrentPad->GetBoundingBox() );
m_CurrentPad->m_Flags &= ~DO_NOT_DRAW;
m_CurrentPad->ClearFlags( DO_NOT_DRAW );
// Update values
m_CurrentPad->m_PadShape = g_Pad_Master.m_PadShape;
m_CurrentPad->m_Attribut = g_Pad_Master.m_Attribut;
if( m_CurrentPad->m_Pos != g_Pad_Master.m_Pos )
{
m_CurrentPad->m_Pos = g_Pad_Master.m_Pos;

View File

@ -172,15 +172,15 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
// If no other command in progress, prepare undo command
// (for a command in progress, will be made later, at the completion of command)
if( m_SelectedPCBText->m_Flags == 0 )
if( m_SelectedPCBText->GetFlags() == 0 )
m_Parent->SaveCopyInUndoList( m_SelectedPCBText, UR_CHANGED );
/* set flag in edit to force undo/redo/abort proper operation,
* and avoid new calls to SaveCopyInUndoList for the same text
* this can occurs when a text is moved, and then rotated, edited ..
*/
if( m_SelectedPCBText->m_Flags != 0 )
m_SelectedPCBText->m_Flags |= IN_EDIT;
if( m_SelectedPCBText->GetFlags() != 0 )
m_SelectedPCBText->SetFlags( IN_EDIT );
// Erase old text on screen if context is available
if( m_DC )

View File

@ -224,7 +224,7 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
pos = GetScreen()->GetCrossHairPosition();
aDimension = new DIMENSION( GetBoard() );
aDimension->m_Flags = IS_NEW;
aDimension->SetFlags( IS_NEW );
aDimension->SetLayer( getActiveLayer() );
@ -276,7 +276,7 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
}
aDimension->Draw( DrawPanel, aDC, GR_OR );
aDimension->m_Flags = 0;
aDimension->ClearFlags();
/* ADD this new item in list */
GetBoard()->Add( aDimension );
@ -380,7 +380,7 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC )
initialTextPosition = aItem->m_Text.m_Pos;
aItem->Draw( DrawPanel, DC, GR_XOR );
aItem->m_Flags |= IS_MOVED;
aItem->SetFlags( IS_MOVED );
aItem->DisplayInfo( this );
GetScreen()->SetCrossHairPosition( aItem->m_Text.m_Pos );
@ -426,7 +426,7 @@ void AbortMoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
dimension->Draw( aPanel, aDC, GR_XOR );
dimension->m_Text.m_Pos = initialTextPosition;
dimension->m_Flags = 0;
dimension->ClearFlags();
dimension->Draw( aPanel, aDC, GR_OR );
}
@ -448,5 +448,5 @@ void PCB_EDIT_FRAME::PlaceDimensionText( DIMENSION* aItem, wxDC* DC )
SaveCopyInUndoList( aItem, UR_CHANGED );
EXCHG( aItem->m_Text.m_Pos, initialTextPosition );
aItem->m_Flags = 0;
aItem->ClearFlags();
}

View File

@ -148,10 +148,10 @@ void AddSegmentToDragList( EDA_DRAW_PANEL* panel, wxDC* DC, int flag, TRACK* Tra
Track->SetState( IN_EDIT, ON );
if( (flag & STARTPOINT) )
Track->m_Flags |= STARTPOINT;
Track->SetFlags( STARTPOINT );
if( (flag & ENDPOINT) )
Track->m_Flags |= ENDPOINT;
Track->SetFlags( ENDPOINT );
Track->Draw( panel, DC, GR_XOR );
g_DragSegmentList.push_back( wrapper );
@ -177,15 +177,15 @@ void Collect_TrackSegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC,
if( ( LayerMask & track->ReturnMaskLayer() ) == 0 )
continue; // Cannot be connected, not on the same layer
if( track->m_Flags & IS_DRAGGED )
if( track->IsDragging() )
continue; // already put in list
int flag = 0;
if( (track->m_Start == aRefPos) && ((track->m_Flags & STARTPOINT) == 0) )
if( (track->m_Start == aRefPos) && ((track->GetFlags() & STARTPOINT) == 0) )
flag |= STARTPOINT;
if( track->m_End == aRefPos && ((track->m_Flags & ENDPOINT) == 0) )
if( track->m_End == aRefPos && ((track->GetFlags() & ENDPOINT) == 0) )
flag |= ENDPOINT;
// Note: vias will be flagged with both STARTPOINT and ENDPOINT
@ -213,7 +213,7 @@ void Collect_TrackSegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC,
void EraseDragList()
{
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
g_DragSegmentList[ii].m_Segm->m_Flags = 0;
g_DragSegmentList[ii].m_Segm->ClearFlags();
g_DragSegmentList.clear();
}

View File

@ -40,7 +40,7 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
return;
Edge->Draw( DrawPanel, DC, GR_XOR );
Edge->m_Flags |= IS_MOVED;
Edge->SetFlags( IS_MOVED );
MoveVector.x = MoveVector.y = 0;
CursorInitialPosition = GetScreen()->GetCrossHairPosition();
DrawPanel->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline );
@ -60,7 +60,7 @@ void FOOTPRINT_EDIT_FRAME::Place_EdgeMod( EDGE_MODULE* aEdge )
aEdge->SetStart0( aEdge->GetStart0() - MoveVector );
aEdge->SetEnd0( aEdge->GetEnd0() - MoveVector );
aEdge->m_Flags = 0;
aEdge->ClearFlags();
DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
OnModify();
@ -278,7 +278,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
else // On aborting, move existing outline to its initial position.
{
Edge->Draw( Panel, DC, GR_XOR, MoveVector );
Edge->m_Flags = 0;
Edge->ClearFlags();
Edge->Draw( Panel, DC, GR_OR );
}
}
@ -308,7 +308,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
module->m_Drawings.PushFront( Edge );
// Update characteristics of the segment or arc.
Edge->m_Flags = IS_NEW;
Edge->SetFlags( IS_NEW );
Edge->SetAngle( angle );
Edge->SetShape( type_edge );
@ -357,11 +357,11 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
// insert _after_ Edge, which is the same as inserting before Edge->Next()
module->m_Drawings.Insert( newedge, Edge->Next() );
Edge->m_Flags = 0;
Edge->ClearFlags();
Edge = newedge; // point now new item
Edge->m_Flags = IS_NEW;
Edge->SetFlags( IS_NEW );
Edge->SetWidth( g_ModuleSegmentWidth );
Edge->SetStart( GetScreen()->GetCrossHairPosition() );
Edge->SetEnd( Edge->GetStart() );
@ -398,7 +398,7 @@ void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* Edge )
if( Edge )
{
Edge->m_Flags = 0;
Edge->ClearFlags();
/* If last segment length is 0: remove it */
if( Edge->GetStart() == Edge->GetEnd() )

View File

@ -319,10 +319,12 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE:
DrawPanel->MoveCursorToCrossHair();
if( GetCurItem()->m_Flags & IS_DRAGGED )
if( GetCurItem()->IsDragging() )
{
PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
}
break;
case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
@ -346,7 +348,8 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_PLACE_VIA:
DrawPanel->MoveCursorToCrossHair();
if( GetCurItem()->m_Flags & IS_DRAGGED )
if( GetCurItem()->IsDragging() )
{
PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
}
@ -681,7 +684,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
/* This is a simple rotation, no other editing in progress */
if( !(GetCurItem()->m_Flags & IS_MOVED) )
if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList(GetCurItem(), UR_ROTATED, ((MODULE*)GetCurItem())->m_Pos);
Rotate_Module( &dc, (MODULE*) GetCurItem(), g_RotationAngle, true );
@ -709,7 +712,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
/* This is a simple rotation, no other editing in progress */
if( !(GetCurItem()->m_Flags & IS_MOVED) )
if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList( GetCurItem(), UR_ROTATED_CLOCKWISE,
((MODULE*)GetCurItem())->m_Pos );
@ -738,7 +741,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
/* This is a simple flip, no other editing in progress */
if( !(GetCurItem()->m_Flags & IS_MOVED) )
if( !GetCurItem()->IsMoving() )
SaveCopyInUndoList(GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->m_Pos);
Change_Side_Module( (MODULE*) GetCurItem(), &dc );
@ -958,7 +961,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
if( GetCurItem()->m_Flags != 0 )
if( GetCurItem()->GetFlags() != 0 )
break;
Delete_Drawings_All_Layer( GetCurItem()->GetLayer() );

View File

@ -51,7 +51,7 @@ void Abort_Edit_Pcb_Text( EDA_DRAW_PANEL* Panel, wxDC* DC )
SwapData(TextePcb, &s_TextCopy);
TextePcb->m_Flags = 0;
TextePcb->ClearFlags();
TextePcb->Draw( Panel, DC, GR_OR );
}
@ -73,12 +73,14 @@ void PCB_EDIT_FRAME::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
if( TextePcb->IsNew() ) // If new: prepare undo command
{
SaveCopyInUndoList( TextePcb, UR_NEW );
TextePcb->m_Flags = 0;
TextePcb->ClearFlags();
return;
}
if( TextePcb->m_Flags == IS_MOVED ) // If moved only
if( TextePcb->IsMoving() ) // If moved only
{
SaveCopyInUndoList( TextePcb, UR_MOVED, TextePcb->m_Pos - s_TextCopy.m_Pos );
}
else
{
// Restore initial params
@ -89,7 +91,7 @@ void PCB_EDIT_FRAME::Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
// Restore current params
}
TextePcb->m_Flags = 0;
TextePcb->ClearFlags();
}
@ -105,7 +107,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC )
s_TextCopy.Copy( TextePcb );
TextePcb->Draw( DrawPanel, DC, GR_XOR );
TextePcb->m_Flags |= IS_MOVED;
TextePcb->SetFlags( IS_MOVED );
TextePcb->DisplayInfo( this );
GetScreen()->SetCrossHairPosition( TextePcb->GetPosition() );
@ -159,7 +161,7 @@ TEXTE_PCB* PCB_EDIT_FRAME::Create_Texte_Pcb( wxDC* DC )
GetBoard()->Add( TextePcb );
/* Update text properties. */
TextePcb->m_Flags = IS_NEW;
TextePcb->SetFlags( IS_NEW );
TextePcb->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
TextePcb->m_Mirror = false;
@ -204,10 +206,10 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
TextePcb->Draw( DrawPanel, DC, drawmode );
TextePcb->DisplayInfo( this );
if( TextePcb->m_Flags == 0 ) // i.e. not edited, or moved
if( TextePcb->GetFlags() == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->m_Pos );
else // set flag edit, to show it was a complex command
TextePcb->m_Flags |= IN_EDIT;
TextePcb->SetFlags( IN_EDIT );
OnModify();
}

View File

@ -134,7 +134,7 @@ void PCB_EDIT_FRAME::Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem )
PICKED_ITEMS_LIST itemsListPicker;
bool change = SetTrackSegmentWidth( aTrackItem, &itemsListPicker, false );
if( change == 0 || aTrackItem->m_Flags )
if( change == 0 || aTrackItem->GetFlags() )
return; // No change
// The segment has changed: redraw it and save it in undo list

View File

@ -33,7 +33,7 @@ void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
return;
drawitem->Draw( DrawPanel, DC, GR_XOR );
drawitem->m_Flags |= IS_MOVED;
drawitem->SetFlags( IS_MOVED );
s_InitialPosition = s_LastPosition = GetScreen()->GetCrossHairPosition();
drawitem->DisplayInfo( this );
DrawPanel->SetMouseCapture( Move_Segment, Abort_EditEdge );
@ -50,7 +50,7 @@ void PCB_EDIT_FRAME::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
if( drawitem == NULL )
return;
drawitem->m_Flags = 0;
drawitem->ClearFlags();
SaveCopyInUndoList(drawitem, UR_MOVED, s_LastPosition - s_InitialPosition);
drawitem->Draw( DrawPanel, DC, GR_OR );
DrawPanel->SetMouseCapture( NULL, NULL );
@ -106,10 +106,10 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
DisplayOpt.DisplayDrawItems = track_fill_copy;
SetCurItem( NULL );
}
else if( Segment->m_Flags == 0 )
else if( Segment->GetFlags() == 0 )
{
Segment->Draw( DrawPanel, DC, GR_XOR );
Segment->m_Flags = 0;
Segment->ClearFlags();
SaveCopyInUndoList(Segment, UR_DELETED);
Segment->UnLink();
SetCurItem( NULL );
@ -195,7 +195,7 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
Panel->GetScreen()->SetCrossHairPosition( s_InitialPosition );
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->SetCrossHairPosition( pos );
Segment->m_Flags = 0;
Segment->ClearFlags();
Segment->Draw( Panel, DC, GR_OR );
}
@ -221,7 +221,7 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
if( Segment == NULL ) /* Create new trace. */
{
SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
Segment->m_Flags = IS_NEW;
Segment->SetFlags( IS_NEW );
Segment->SetLayer( getActiveLayer() );
Segment->SetWidth( s_large );
Segment->SetShape( shape );
@ -243,7 +243,7 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
GetBoard()->Add( Segment );
OnModify();
Segment->m_Flags = 0;
Segment->ClearFlags();
Segment->Draw( DrawPanel, DC, GR_OR );
@ -251,7 +251,7 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
Segment->m_Flags = IS_NEW;
Segment->SetFlags( IS_NEW );
Segment->SetLayer( DrawItem->GetLayer() );
Segment->SetWidth( s_large );
Segment->SetShape( DrawItem->GetShape() );
@ -287,7 +287,7 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
}
else
{
Segment->m_Flags = 0;
Segment->ClearFlags();
GetBoard()->Add( Segment );
OnModify();
SaveCopyInUndoList( Segment, UR_NEW );

View File

@ -96,7 +96,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
/* create the via */
SEGVIA* via = new SEGVIA( GetBoard() );
via->m_Flags = IS_NEW;
via->SetFlags( IS_NEW );
via->m_Shape = GetBoard()->GetDesignSettings().m_CurrentViaType;
via->m_Width = GetBoard()->GetCurrentViaSize();
via->SetNet( GetBoard()->GetHighLightNetCode() );

View File

@ -114,7 +114,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
HighLight( aDC );
g_CurrentTrackList.PushBack( new TRACK( GetBoard() ) );
g_CurrentTrackSegment->m_Flags = IS_NEW;
g_CurrentTrackSegment->SetFlags( IS_NEW );
GetBoard()->SetHighLightNet( 0 );
@ -256,7 +256,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
TRACK* newTrack = g_CurrentTrackSegment->Copy();
g_CurrentTrackList.PushBack( newTrack );
newTrack->m_Flags = IS_NEW;
newTrack->SetFlags( IS_NEW );
newTrack->SetState( BEGIN_ONPAD | END_ONPAD, OFF );
@ -494,7 +494,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC )
for( track = firstTrack; track && i < newCount; ++i, track = track->Next() )
{
track->m_Flags = 0;
track->ClearFlags();
track->SetState( BUSY, OFF );
}

View File

@ -48,7 +48,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
if( Module )
Module->m_Drawings.PushFront( Text );
Text->m_Flags = IS_NEW;
Text->SetFlags( IS_NEW );
Text->m_Text = wxT( "text" );
@ -62,7 +62,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
InstallTextModOptionsFrame( Text, NULL );
DrawPanel->MoveCursorToCrossHair();
Text->m_Flags = 0;
Text->ClearFlags();
if( DC )
Text->Draw( DrawPanel, DC, GR_OR );
@ -82,7 +82,7 @@ void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
MODULE* module = (MODULE*) Text->GetParent();
if( module && module->m_Flags == 0 && Text->m_Flags == 0 ) // prepare undo command
if( module && module->GetFlags() == 0 && Text->GetFlags() == 0 ) // prepare undo command
{
if( this->m_Ident == PCB_FRAME )
SaveCopyInUndoList( module, UR_CHANGED );
@ -151,7 +151,7 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
// If the text was moved (the move does not change internal data)
// it could be rotated while moving. So set old value for orientation
if( (Text->m_Flags & IS_MOVED) )
if( Text->IsMoving() )
Text->m_Orient = TextInitialOrientation;
/* Redraw the text */
@ -160,8 +160,8 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
// leave it at (0,0) so we can use it Rotate when not moving.
MoveVector.x = MoveVector.y = 0;
Text->m_Flags = 0;
Module->m_Flags = 0;
Text->ClearFlags();
Module->ClearFlags();
screen->SetCurItem( NULL );
}
@ -178,8 +178,8 @@ void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
Module = (MODULE*) Text->GetParent();
Text->m_Flags |= IS_MOVED;
Module->m_Flags |= IN_EDIT;
Text->SetFlags( IS_MOVED );
Module->SetFlags( IN_EDIT );
MoveVector.x = MoveVector.y = 0;
@ -227,8 +227,8 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
wxPoint textRelPos = Text->m_Pos - Module->m_Pos;
RotatePoint( &textRelPos, -Module->m_Orient );
Text->SetPos0( textRelPos );
Text->m_Flags = 0;
Module->m_Flags = 0;
Text->ClearFlags();
Module->ClearFlags();
Module->m_LastEdit_Time = time( NULL );
OnModify();

View File

@ -203,9 +203,9 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
/* Erase module on screen */
if( aDraw )
{
Module->m_Flags |= DO_NOT_DRAW;
Module->SetFlags( DO_NOT_DRAW );
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
Module->m_Flags &= ~DO_NOT_DRAW;
Module->ClearFlags( DO_NOT_DRAW );
}
D_PAD* pt_pad = (D_PAD*) Module->m_Pads;

View File

@ -197,8 +197,8 @@ void TraceFilledCircle( BOARD* Pcb,
break;
}
cx -= Pcb->GetBoundingBox().m_Pos.x;
cy -= Pcb->GetBoundingBox().m_Pos.y;
cx -= Pcb->GetBoundingBox().GetX();
cy -= Pcb->GetBoundingBox().GetY();
distmin = radius;
@ -298,10 +298,10 @@ void TraceSegmentPcb( BOARD* Pcb, TRACK* pt_segm, int color, int marge, int op_l
half_width = ( pt_segm->m_Width / 2 ) + marge;
/* Calculate the bounding rectangle of the segment (if H, V or Via) */
ux0 = pt_segm->m_Start.x - Pcb->GetBoundingBox().m_Pos.x;
uy0 = pt_segm->m_Start.y - Pcb->GetBoundingBox().m_Pos.y;
ux1 = pt_segm->m_End.x - Pcb->GetBoundingBox().m_Pos.x;
uy1 = pt_segm->m_End.y - Pcb->GetBoundingBox().m_Pos.y;
ux0 = pt_segm->m_Start.x - Pcb->GetBoundingBox().GetX();
uy0 = pt_segm->m_Start.y - Pcb->GetBoundingBox().GetY();
ux1 = pt_segm->m_End.x - Pcb->GetBoundingBox().GetX();
uy1 = pt_segm->m_End.y - Pcb->GetBoundingBox().GetY();
/* Test if VIA (filled circle was drawn) */
if( pt_segm->Type() == PCB_VIA_T )
@ -558,10 +558,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
break;
}
ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->GetBoundingBox().m_Pos.y;
ux0 -= Pcb->GetBoundingBox().GetX();
uy0 -= Pcb->GetBoundingBox().GetY();
ux1 -= Pcb->GetBoundingBox().GetX();
uy1 -= Pcb->GetBoundingBox().GetY();
/* Calculating limits coord cells belonging to the rectangle. */
row_max = uy1 / Board.m_GridRouting;
@ -650,10 +650,10 @@ void TraceFilledRectangle( BOARD* Pcb, int ux0, int uy0, int ux1, int uy1,
break;
}
ux0 -= Pcb->GetBoundingBox().m_Pos.x;
uy0 -= Pcb->GetBoundingBox().m_Pos.y;
ux1 -= Pcb->GetBoundingBox().m_Pos.x;
uy1 -= Pcb->GetBoundingBox().m_Pos.y;
ux0 -= Pcb->GetBoundingBox().GetX();
uy0 -= Pcb->GetBoundingBox().GetY();
ux1 -= Pcb->GetBoundingBox().GetX();
uy1 -= Pcb->GetBoundingBox().GetY();
cx = (ux0 + ux1) / 2;
cy = (uy0 + uy1) / 2;

View File

@ -90,7 +90,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
if( aHotkeyCode == 0 )
return;
bool itemCurrentlyEdited = (GetCurItem() && GetCurItem()->m_Flags);
bool itemCurrentlyEdited = (GetCurItem() && GetCurItem()->GetFlags());
MODULE* module = NULL;
int evt_type = 0; //Used to post a wxCommandEvent on demand
PCB_SCREEN* screen = GetScreen();
@ -625,7 +625,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
{
BOARD_ITEM* item = GetCurItem();
bool ItemFree = (item == NULL) || (item->m_Flags == 0);
bool ItemFree = (item == NULL) || (item->GetFlags() == 0);
switch( GetToolId() )
{
@ -696,7 +696,7 @@ bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags;
bool itemCurrentlyEdited = item && item->GetFlags();
if( itemCurrentlyEdited )
return false;
@ -791,7 +791,7 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags;
bool itemCurrentlyEdited = item && item->GetFlags();
if( itemCurrentlyEdited )
return false;
@ -902,7 +902,7 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC )
{
BOARD_ITEM* item = GetCurItem();
bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
bool itemCurrentlyEdited = item && item->m_Flags;
bool itemCurrentlyEdited = item && item->GetFlags();
DrawPanel->m_AutoPAN_Request = false;
@ -915,7 +915,7 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC )
{
case PCB_TRACE_T:
case PCB_VIA_T:
if( item->m_Flags & IS_DRAGGED )
if( item->IsDragging() )
PlaceDraggedOrMovedTrackSegment( (TRACK*) item, aDC );
break;
@ -963,7 +963,7 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC )
bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags;
bool itemCurrentlyEdited = item && item->GetFlags();
int evt_type = 0; // Used to post a wxCommandEvent on demand
if( !itemCurrentlyEdited )

View File

@ -27,7 +27,7 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
BOARD_ITEM* item = GetCurItem();
bool ItemFree = (item == 0) || (item->m_Flags == 0);
bool ItemFree = (item == 0) || (item->GetFlags() == 0);
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
@ -119,7 +119,7 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
bool FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags;
bool itemCurrentlyEdited = item && item->GetFlags();
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
if( itemCurrentlyEdited || blockActive )
@ -174,7 +174,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
bool FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags;
bool itemCurrentlyEdited = item && item->GetFlags();
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
if( itemCurrentlyEdited || blockActive )
@ -229,8 +229,8 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem( int aIdCommand )
bool FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags;
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
bool itemCurrentlyEdited = item && item->GetFlags();
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
if( itemCurrentlyEdited || blockActive )
return false;
@ -284,7 +284,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
bool FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->m_Flags;
bool itemCurrentlyEdited = item && item->GetFlags();
int evt_type = 0; // Used to post a wxCommandEvent on demand
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;

View File

@ -84,7 +84,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
GetBoard()->Add( aModule );
aModule->m_Flags = 0;
aModule->ClearFlags();
GetBoard()->BuildListOfNets();
@ -183,7 +183,7 @@ MODULE* PCB_BASE_FRAME::Load_Module_From_Library( const wxString& library, wxDC*
lastCommponentName = moduleName;
AddHistoryComponentName( HistoryList, moduleName );
module->m_Flags = IS_NEW;
module->SetFlags( IS_NEW );
module->m_Link = 0;
module->SetTimeStamp( GetNewTimeStamp() );
GetBoard()->m_Status_Pcb = 0;

View File

@ -120,7 +120,7 @@ bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize gr
// D( printf( "currTrack=%p currItem=%p currTrack->Type()=%d currItem->Type()=%d\n", currTrack, currItem, currTrack ? currTrack->Type() : 0, currItem ? currItem->Type() : 0 ); )
if( !currTrack && currItem && currItem->Type()==PCB_VIA_T && currItem->m_Flags )
if( !currTrack && currItem && currItem->Type()==PCB_VIA_T && currItem->GetFlags() )
{
// moving a VIA
currTrack = (TRACK*) currItem;

View File

@ -139,19 +139,19 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event )
m_Target->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
// Save old item in undo list, if is is not currently edited (will be later if so)
if( m_Target->m_Flags == 0 )
if( m_Target->GetFlags() == 0 )
m_Parent->SaveCopyInUndoList( m_Target, UR_CHANGED );
if( m_Target->m_Flags != 0 ) // other edition in progress (MOVE, NEW ..)
m_Target->m_Flags |= IN_EDIT; // set flag in edit to force
// undo/redo/abort proper operation
if( m_Target->GetFlags() != 0 ) // other edition in progress (MOVE, NEW ..)
m_Target->SetFlags( IN_EDIT ); // set flag in edit to force
// undo/redo/abort proper operation
m_Target->SetWidth( m_MireWidthCtrl->GetValue() );
MireDefaultSize = m_MireSizeCtrl->GetValue();
m_Target->SetSize( m_MireSizeCtrl->GetValue() );
m_Target->SetShape( m_MireShape->GetSelection() ? 1 : 0 );
m_Target->Draw( m_Parent->DrawPanel, m_DC, ( m_Target->m_Flags & IS_MOVED ) ? GR_XOR : GR_OR );
m_Target->Draw( m_Parent->DrawPanel, m_DC, ( m_Target->IsMoving() ) ? GR_XOR : GR_OR );
m_Parent->OnModify();
EndModal( 1 );
@ -191,14 +191,14 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
}
else // it is an existing item: retrieve initial values of parameters
{
if( ( target->m_Flags & (IN_EDIT | IS_MOVED) ) )
if( ( target->GetFlags() & (IN_EDIT | IS_MOVED) ) )
{
target->SetPosition( s_TargetCopy.GetPosition() );
target->SetWidth( s_TargetCopy.GetWidth() );
target->SetSize( s_TargetCopy.GetSize() );
target->SetShape( s_TargetCopy.GetShape() );
}
target->m_Flags = 0;
target->ClearFlags();
target->Draw( Panel, DC, GR_OR );
}
}
@ -210,7 +210,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
{
PCB_TARGET* target = new PCB_TARGET( GetBoard() );
target->m_Flags = IS_NEW;
target->SetFlags( IS_NEW );
GetBoard()->Add( target );
@ -233,7 +233,7 @@ void PCB_EDIT_FRAME::BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC )
return;
s_TargetCopy = *aTarget;
aTarget->m_Flags |= IS_MOVED;
aTarget->SetFlags( IS_MOVED );
DrawPanel->SetMouseCapture( ShowTargetShapeWhileMovingMouse, AbortMoveAndEditTarget );
SetCurItem( aTarget );
}
@ -252,25 +252,26 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
if( aTarget->IsNew() )
{
SaveCopyInUndoList( aTarget, UR_NEW );
aTarget->m_Flags = 0;
aTarget->ClearFlags();
return;
}
if( aTarget->m_Flags == IS_MOVED )
if( aTarget->GetFlags() == IS_MOVED )
{
SaveCopyInUndoList( aTarget, UR_MOVED, aTarget->GetPosition() - s_TargetCopy.GetPosition() );
aTarget->m_Flags = 0;
SaveCopyInUndoList( aTarget, UR_MOVED,
aTarget->GetPosition() - s_TargetCopy.GetPosition() );
aTarget->ClearFlags();
return;
}
if( (aTarget->m_Flags & IN_EDIT) )
if( (aTarget->GetFlags() & IN_EDIT) )
{
SwapData( aTarget, &s_TargetCopy );
SaveCopyInUndoList( aTarget, UR_CHANGED );
SwapData( aTarget, &s_TargetCopy );
}
aTarget->m_Flags = 0;
aTarget->ClearFlags();
}

View File

@ -247,7 +247,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
module->SetPosition( wxPoint( 0, 0 ) );
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->m_Flags = 0;
GetBoard()->m_Modules->ClearFlags();
Zoom_Automatique( false );
}
@ -340,7 +340,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
}
newmodule->m_Flags = 0;
newmodule->ClearFlags();
GetScreen()->ClrModify();
pcbframe->SetCurItem( NULL );
mainpcb->m_Status_Pcb = 0;
@ -358,7 +358,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
redraw = true;
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->m_Flags = 0;
GetBoard()->m_Modules->ClearFlags();
GetScreen()->ClrModify();
Zoom_Automatique( false );
@ -402,7 +402,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->m_Flags = 0;
GetBoard()->m_Modules->ClearFlags();
// if either m_Reference or m_Value are gone, reinstall them -
// otherwise you cannot see what you are doing on board
@ -446,7 +446,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCurItem( GetBoard()->m_Modules );
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) GetScreen()-> GetCurItem() );
int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->m_Flags = 0;
GetScreen()->GetCurItem()->ClearFlags();
if( ret > 0 )
DrawPanel->Refresh();
@ -475,8 +475,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) GetScreen()->GetCurItem() );
int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->m_Flags = 0;
GetScreen()->GetCurItem()->m_Flags = 0;
GetScreen()->GetCurItem()->ClearFlags();
GetScreen()->GetCurItem()->ClearFlags();
DrawPanel->MoveCursorToCrossHair();
if( ret > 0 )
@ -560,7 +560,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
DrawPanel->MoveCursorToCrossHair();
if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) )
if( GetScreen()->GetCurItem()->IsNew() )
{
End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem() );
SetCurItem( NULL );

View File

@ -29,7 +29,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( GetToolId() == ID_NO_TOOL_SELECTED )
{
if( item && item->m_Flags ) // Move item command in progress
if( item && item->GetFlags() ) // Move item command in progress
{
switch( item->Type() )
{
@ -50,9 +50,9 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
wxString msg;
msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err:Struct %d, m_Flag %X" ),
item->Type(), item->m_Flags );
item->Type(), item->GetFlags() );
DisplayError( this, msg );
item->m_Flags = 0;
item->ClearFlags();
break;
}
}
@ -61,7 +61,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
item = GetCurItem();
if( !item || (item->m_Flags == 0) )
if( !item || (item->GetFlags() == 0) )
{
if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
&& !wxGetKeyState( WXK_CONTROL ) )
@ -78,7 +78,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_MODEDIT_CIRCLE_TOOL:
case ID_MODEDIT_ARC_TOOL:
case ID_MODEDIT_LINE_TOOL:
if( !item || item->m_Flags == 0 )
if( !item || item->GetFlags() == 0 )
{
int shape = S_SEGMENT;
@ -116,8 +116,8 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break;
case ID_MODEDIT_DELETE_TOOL:
if( item == NULL || // No item to delete
(item->m_Flags != 0) ) // Item in edit, cannot delete it
if( item == NULL || // No item to delete
(item->GetFlags() != 0) ) // Item in edit, cannot delete it
break;
if( item->Type() != PCB_MODULE_T ) // Cannot delete the module itself
@ -134,10 +134,10 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
MODULE* module = GetBoard()->m_Modules;
if( module == NULL // No module loaded
|| (module->m_Flags != 0) )
|| (module->GetFlags() != 0) )
break;
module->m_Flags = 0;
module->ClearFlags();
SaveCopyInUndoList( module, UR_MODEDIT );
Place_Ancre( module ); // set the new relatives internal coordinates of items
RedrawScreen( wxPoint( 0, 0 ), true );
@ -191,7 +191,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
// Simple location of elements where possible.
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{
SetCurItem( item = ModeditLocateAndDisplay() );
}
@ -199,16 +199,18 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
// End command in progress.
if( GetToolId() != ID_NO_TOOL_SELECTED )
{
if( item && item->m_Flags )
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), KiBitmap( cancel_xpm ) );
if( item && item->GetFlags() )
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
else
AddMenuItem( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ), KiBitmap( cancel_tool_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ),
KiBitmap( cancel_tool_xpm ) );
PopMenu->AppendSeparator();
}
else
{
if( (item && item->m_Flags) || blockActive )
if( (item && item->GetFlags()) || blockActive )
{
if( blockActive ) // Put block commands in list
{
@ -246,7 +248,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
if( (item == NULL) || blockActive )
return true;
int flags = item->m_Flags;
int flags = item->GetFlags();
switch( item->Type() )
{
@ -255,7 +257,8 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
wxMenu* transform_choice = new wxMenu;
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_ROTATE, _( "Rotate" ),
KiBitmap( rotate_module_pos_xpm ) );
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_MIRROR, _( "Mirror" ), KiBitmap( mirror_h_xpm ) );
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_MIRROR, _( "Mirror" ),
KiBitmap( mirror_h_xpm ) );
msg = AddHotkeyName( _( "Edit Module" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_MODULE, msg, KiBitmap( edit_module_xpm ) );
AddMenuItem( PopMenu, transform_choice, ID_MODEDIT_TRANSFORM_MODULE,
@ -398,12 +401,12 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( ( item == NULL ) || ( item->m_Flags == 0 ) )
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{
item = ModeditLocateAndDisplay();
}
if( ( item == NULL ) || ( item->m_Flags != 0 ) )
if( ( item == NULL ) || ( item->GetFlags() != 0 ) )
break;
// Item found
@ -420,7 +423,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item );
int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->m_Flags = 0;
GetScreen()->GetCurItem()->ClearFlags();
DrawPanel->MoveCursorToCrossHair();
if( ret > 0 )

View File

@ -33,7 +33,7 @@ void FOOTPRINT_EDIT_FRAME::SaveCopyInUndoList( BOARD_ITEM* aItem,
GetScreen()->PushCommandToUndoList( lastcmd );
/* Clear current flags (which can be temporary set by a current edit command) */
for( item = CopyItem->m_Drawings; item != NULL; item = item->Next() )
item->m_Flags = 0;
item->ClearFlags();
/* Clear redo list, because after new save there is no redo to do */
GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );

View File

@ -76,11 +76,11 @@ void PCB_EDIT_FRAME::StartMove_Module( MODULE* module, wxDC* DC )
// Creates a copy of the current module, for abort and undo commands
s_ModuleInitialCopy = new MODULE( GetBoard() );
s_ModuleInitialCopy->Copy( module );
s_ModuleInitialCopy->m_Flags = 0;
s_ModuleInitialCopy->ClearFlags();
SetCurItem( module );
GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
module->m_Flags |= IS_MOVED;
module->SetFlags( IS_MOVED );
/* Show ratsnest. */
if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
@ -110,10 +110,9 @@ void PCB_EDIT_FRAME::StartMove_Module( MODULE* module, wxDC* DC )
// Erase the module.
if( DC )
{
int tmp = module->m_Flags;
module->m_Flags |= DO_NOT_DRAW;
module->SetFlags( DO_NOT_DRAW );
DrawPanel->RefreshDrawingRect( module->GetBoundingBox() );
module->m_Flags = tmp;
module->ClearFlags( DO_NOT_DRAW );
}
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );
@ -162,7 +161,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
}
EraseDragList();
module->m_Flags &= ~IS_MOVED;
module->ClearFlags( IS_MOVED );
}
if( module->IsNew() ) // Copy command: delete new footprint
@ -278,16 +277,15 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC )
OnModify();
if( !( Module->m_Flags & IS_MOVED ) ) /* This is a simple flip, no other edition in progress */
if( !Module->IsMoving() ) /* This is a simple flip, no other edition in progress */
{
GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK );
if( DC )
{
int tmp = Module->m_Flags;
Module->m_Flags |= DO_NOT_DRAW;
Module->SetFlags( DO_NOT_DRAW );
DrawPanel->RefreshDrawingRect( Module->GetBoundingBox() );
Module->m_Flags = tmp;
Module->ClearFlags( DO_NOT_DRAW );
}
/* Show ratsnest if necessary. */
@ -312,7 +310,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC )
Module->DisplayInfo( this );
if( !( Module->m_Flags & IS_MOVED ) ) /* Inversion simple */
if( !Module->IsMoving() ) /* Inversion simple */
{
if( DC )
{
@ -350,7 +348,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat
{
SaveCopyInUndoList( aModule, UR_NEW );
}
else if( (aModule->m_Flags & IS_MOVED ) )
else if( aModule->IsMoving() )
{
ITEM_PICKER picker( aModule, UR_CHANGED );
picker.m_Link = s_ModuleInitialCopy;
@ -372,7 +370,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat
newpos = GetScreen()->GetCrossHairPosition();
aModule->SetPosition( newpos );
aModule->m_Flags = 0;
aModule->ClearFlags();
delete s_ModuleInitialCopy;
s_ModuleInitialCopy = NULL;
@ -423,15 +421,14 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool in
OnModify();
if( !( module->m_Flags & IS_MOVED ) ) /* This is a simple rotation, no other
if( !module->IsMoving() ) /* This is a simple rotation, no other
* edition in progress */
{
if( DC ) // Erase footprint to screen
{
int tmp = module->m_Flags;
module->m_Flags |= DO_NOT_DRAW;
module->SetFlags( DO_NOT_DRAW );
DrawPanel->RefreshDrawingRect( module->GetBoundingBox() );
module->m_Flags = tmp;
module->ClearFlags( DO_NOT_DRAW );
if( GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) )
DrawGeneralRatsnest( DC );
@ -457,7 +454,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool in
if( DC )
{
if( !( module->m_Flags & IS_MOVED ) )
if( !module->IsMoving() )
{
// not beiing moved: redraw the module and update ratsnest
module->Draw( DrawPanel, DC, GR_OR );
@ -472,7 +469,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool in
DrawSegmentWhileMovingFootprint( DrawPanel, DC );
}
if( module->m_Flags == 0 ) // module not in edit: redraw full screen
if( module->GetFlags() == 0 ) // module not in edit: redraw full screen
DrawPanel->Refresh();
}
}

View File

@ -38,7 +38,7 @@ static void Abort_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC )
return;
pad->Draw( Panel, DC, GR_XOR );
pad->m_Flags = 0;
pad->ClearFlags();
pad->m_Pos = Pad_OldPos;
pad->Draw( Panel, DC, GR_XOR );
@ -137,16 +137,15 @@ void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
{
if( aDraw )
{
aPad->m_Flags |= DO_NOT_DRAW;
aPad->SetFlags( DO_NOT_DRAW );
DrawPanel->RefreshDrawingRect( aPad->GetBoundingBox() );
aPad->m_Flags &= ~DO_NOT_DRAW;
aPad->ClearFlags( DO_NOT_DRAW );
}
aPad->m_PadShape = g_Pad_Master.m_PadShape;
aPad->m_PadShape = g_Pad_Master.m_PadShape;
aPad->m_layerMask = g_Pad_Master.m_layerMask;
aPad->m_Attribut = g_Pad_Master.m_Attribut;
aPad->m_Orient = g_Pad_Master.m_Orient +
( (MODULE*) aPad->GetParent() )->m_Orient;
aPad->m_Attribut = g_Pad_Master.m_Attribut;
aPad->m_Orient = g_Pad_Master.m_Orient + ( (MODULE*) aPad->GetParent() )->m_Orient;
aPad->m_Size = g_Pad_Master.m_Size;
aPad->m_DeltaSize = wxSize( 0, 0 );
aPad->m_Offset = g_Pad_Master.m_Offset;
@ -283,7 +282,7 @@ void PCB_BASE_FRAME::StartMovePad( D_PAD* Pad, wxDC* DC )
/* Draw the pad (SKETCH mode) */
Pad->Draw( DrawPanel, DC, GR_XOR );
Pad->m_Flags |= IS_MOVED;
Pad->SetFlags( IS_MOVED );
Pad->Draw( DrawPanel, DC, GR_XOR );
/* Build the list of track segments to drag if the command is a drag pad*/
@ -368,7 +367,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* Pad, wxDC* DC )
Pad->m_Pos0.x += dX;
s_CurrentSelectedPad->m_Pos0.y += dY;
Pad->m_Flags = 0;
Pad->ClearFlags();
if( DC )
Pad->Draw( DrawPanel, DC, GR_OR );

View File

@ -103,7 +103,7 @@ static void Exit_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
TRACK* Track = pt_drag->m_Segm;
pt_drag->SetInitialValues();
Track->SetState( EDIT, OFF );
Track->m_Flags = 0;
Track->ClearFlags();
Track->Draw( Panel, DC, GR_OR );
}
@ -249,7 +249,7 @@ bool WinEDA_PcbFrame::PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC )
}
// DRC Ok: place track segments
Track->m_Flags = 0;
Track->ClearFlags();
Track->Draw( DrawPanel, DC, GR_OR );
/* Tracage des segments dragges */
@ -258,7 +258,7 @@ bool WinEDA_PcbFrame::PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC )
{
Track = pt_drag->m_Segm;
Track->SetState( EDIT, OFF );
Track->m_Flags = 0;
Track->ClearFlags();
Track->Draw( DrawPanel, DC, GR_OR );
}

View File

@ -123,7 +123,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
Track->m_End.x -= dx;
Track->m_End.y -= dy;
Track->m_Flags = 0;
Track->ClearFlags();
}
DrawTraces( Panel, DC, NewTrack, NbPtNewTrack, GR_OR );
@ -140,7 +140,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
TRACK* Track = g_DragSegmentList[jj].m_Segm;
g_DragSegmentList[jj].SetInitialValues();
Track->SetState( IN_EDIT, OFF );
Track->m_Flags = 0;
Track->ClearFlags();
Track->Draw( Panel, DC, GR_OR );
}
@ -192,10 +192,10 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
for( ; (ii > 0) && (Track != NULL); ii--, Track = Track->Next() )
{
if( Track->m_Flags & STARTPOINT )
if( Track->GetFlags() & STARTPOINT )
Track->m_Start += moveVector;
if( Track->m_Flags & ENDPOINT )
if( Track->GetFlags() & ENDPOINT )
Track->m_End += moveVector;
}
@ -209,10 +209,10 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
if( aErase )
Track->Draw( aPanel, aDC, draw_mode );
if( Track->m_Flags & STARTPOINT )
if( Track->GetFlags() & STARTPOINT )
Track->m_Start += moveVector;
if( Track->m_Flags & ENDPOINT )
if( Track->GetFlags() & ENDPOINT )
Track->m_End += moveVector;
Track->Draw( aPanel, aDC, draw_mode );
@ -471,7 +471,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
if( tSegmentToEnd )
{
if( tSegmentToEnd->m_Flags & STARTPOINT )
if( tSegmentToEnd->GetFlags() & STARTPOINT )
tSegmentToEnd->m_Start = Track->m_End;
else
tSegmentToEnd->m_End = Track->m_End;
@ -479,7 +479,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
if( tSegmentToStart )
{
if( tSegmentToStart->m_Flags & STARTPOINT )
if( tSegmentToStart->GetFlags() & STARTPOINT )
tSegmentToStart->m_Start = Track->m_Start;
else
tSegmentToStart->m_End = Track->m_Start;
@ -558,7 +558,7 @@ bool InitialiseDragParameters()
// Init parameters for the starting point of the moved segment
if( tSegmentToStart )
{
if( tSegmentToStart->m_Flags & ENDPOINT )
if( tSegmentToStart->GetFlags() & ENDPOINT )
{
tx1 = (double) tSegmentToStart->m_Start.x;
ty1 = (double) tSegmentToStart->m_Start.y;
@ -601,7 +601,7 @@ bool InitialiseDragParameters()
if( tSegmentToEnd )
{
//check if second line is vertical
if( tSegmentToEnd->m_Flags & STARTPOINT )
if( tSegmentToEnd->GetFlags() & STARTPOINT )
{
tx1 = (double) tSegmentToEnd->m_Start.x;
ty1 = (double) tSegmentToEnd->m_Start.y;
@ -698,7 +698,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
if( aTrack->Type() == PCB_VIA_T ) // For a via: always drag it
{
aTrack->m_Flags = IS_DRAGGED | STARTPOINT | ENDPOINT;
aTrack->SetFlags( IS_DRAGGED | STARTPOINT | ENDPOINT );
if( aCommand != ID_POPUP_PCB_MOVE_TRACK_SEGMENT )
{
@ -719,8 +719,8 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
switch( aCommand )
{
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT: // Move segment
aTrack->m_Flags |= IS_DRAGGED | ENDPOINT | STARTPOINT;
AddSegmentToDragList( DrawPanel, aDC, aTrack->m_Flags, aTrack );
aTrack->SetFlags( IS_DRAGGED | ENDPOINT | STARTPOINT );
AddSegmentToDragList( DrawPanel, aDC, aTrack->GetFlags(), aTrack );
break;
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: // drag a segment
@ -729,7 +729,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
aTrack->ReturnMaskLayer(),
aTrack->GetNet() );
pos = aTrack->m_End;
aTrack->m_Flags |= IS_DRAGGED | ENDPOINT | STARTPOINT;
aTrack->SetFlags( IS_DRAGGED | ENDPOINT | STARTPOINT );
Collect_TrackSegmentsToDrag( DrawPanel, aDC, pos,
aTrack->ReturnMaskLayer(),
aTrack->GetNet() );
@ -744,7 +744,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
break;
}
aTrack->m_Flags |= IS_DRAGGED;
aTrack->SetFlags( IS_DRAGGED );
}
// Prepare the Undo command
@ -760,7 +760,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
s_ItemsListPicker.PushItem( picker );
draggedtrack = (TRACK*) picker.m_Link;
draggedtrack->SetStatus( 0 );
draggedtrack->m_Flags = 0;
draggedtrack->ClearFlags();
}
s_LastPos = PosInit;
@ -929,7 +929,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
NewTrack = NULL;
NbPtNewTrack = 0;
track->m_Flags = IS_DRAGGED;
track->SetFlags( IS_DRAGGED );
if( TrackToStartPoint )
{
@ -939,7 +939,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
flag = ENDPOINT;
AddSegmentToDragList( DrawPanel, DC, flag, TrackToStartPoint );
track->m_Flags |= STARTPOINT;
track->SetFlags( STARTPOINT );
}
if( TrackToEndPoint )
@ -950,10 +950,10 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
flag = ENDPOINT;
AddSegmentToDragList( DrawPanel, DC, flag, TrackToEndPoint );
track->m_Flags |= ENDPOINT;
track->SetFlags( ENDPOINT );
}
AddSegmentToDragList( DrawPanel, DC, track->m_Flags, track );
AddSegmentToDragList( DrawPanel, DC, track->GetFlags(), track );
PosInit = GetScreen()->GetCrossHairPosition();
@ -975,7 +975,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
s_ItemsListPicker.PushItem( picker );
draggedtrack = (TRACK*) picker.m_Link;
draggedtrack->SetStatus( 0 );
draggedtrack->m_Flags = 0;
draggedtrack->ClearFlags();
}
if( !InitialiseDragParameters() )
@ -1019,7 +1019,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
int draw_mode = GR_OR | GR_HIGHLIGHT;
// DRC Ok: place track segments
Track->m_Flags = 0;
Track->ClearFlags();
Track->SetState( IN_EDIT, OFF );
Track->Draw( DrawPanel, DC, draw_mode );
@ -1028,7 +1028,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
{
Track = g_DragSegmentList[ii].m_Segm;
Track->SetState( IN_EDIT, OFF );
Track->m_Flags = 0;
Track->ClearFlags();
Track->Draw( DrawPanel, DC, draw_mode );
/* Test the connections modified by the move

View File

@ -235,7 +235,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
// here the module is already in the BOARD, Create_1_Module() does that.
module->m_LibRef = wxT( "MuSelf" );
module->m_Attributs = MOD_VIRTUAL | MOD_CMS;
module->m_Flags = 0;
module->ClearFlags();
module->m_Pos = Mself.m_End;
// Generate segments

View File

@ -49,11 +49,11 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
bool exit = false;
bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
if( no_tool || ( DrawStruct && DrawStruct->m_Flags ) )
if( no_tool || ( DrawStruct && DrawStruct->GetFlags() ) )
{
DrawPanel->m_AutoPAN_Request = false;
if( DrawStruct && DrawStruct->m_Flags ) // Command in progress
if( DrawStruct && DrawStruct->GetFlags() ) // Command in progress
{
DrawPanel->m_IgnoreMouseEvents = true;
DrawPanel->CrossHairOff( aDC );
@ -76,7 +76,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case PCB_TRACE_T:
case PCB_VIA_T:
if( DrawStruct->m_Flags & IS_DRAGGED )
if( DrawStruct->IsDragging() )
{
PlaceDraggedOrMovedTrackSegment( (TRACK*) DrawStruct, aDC );
exit = true;
@ -209,7 +209,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_MIRE_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
{
SetCurItem( (BOARD_ITEM*) CreateTarget( aDC ) );
DrawPanel->MoveCursorToCrossHair();
@ -243,7 +243,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
{
DrawStruct = (BOARD_ITEM*) Begin_DrawSegment( NULL, shape, aDC );
SetCurItem( DrawStruct );
@ -267,7 +267,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
{
DrawStruct = (BOARD_ITEM*) Begin_Route( NULL, aDC );
SetCurItem( DrawStruct );
@ -295,7 +295,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
* this can be start a new zone or select and move an existing zone outline corner
* if found near the mouse cursor
*/
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
{
// there is no current item, try to find something under mouse
DrawStruct = PcbGeneralLocateAndDisplay();
@ -340,7 +340,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_ADD_TEXT_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
{
SetCurItem( Create_Texte_Pcb( aDC ) );
DrawPanel->MoveCursorToCrossHair();
@ -359,7 +359,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_MODULE_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
{
DrawPanel->MoveCursorToCrossHair();
DrawStruct = (BOARD_ITEM*) Load_Module_From_Library( wxEmptyString, aDC );
@ -387,7 +387,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
{
DrawStruct = (BOARD_ITEM*) EditDimension( NULL, aDC );
SetCurItem( DrawStruct );
@ -408,11 +408,11 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_DELETE_ITEM_BUTT:
if( !DrawStruct || (DrawStruct->m_Flags == 0) )
if( !DrawStruct || (DrawStruct->GetFlags() == 0) )
{
DrawStruct = PcbGeneralLocateAndDisplay();
if( DrawStruct && (DrawStruct->m_Flags == 0) )
if( DrawStruct && (DrawStruct->GetFlags() == 0) )
{
RemoveStruct( DrawStruct, aDC );
SetCurItem( DrawStruct = NULL );
@ -451,12 +451,12 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
{
DrawStruct = PcbGeneralLocateAndDisplay();
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() != 0) )
break;
SendMessageToEESCHEMA( DrawStruct );
@ -473,7 +473,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
if( End_Route( (TRACK*) DrawStruct, aDC ) )
DrawPanel->m_AutoPAN_Request = false;
}
else if( DrawStruct->m_Flags == 0 )
else if( DrawStruct->GetFlags() == 0 )
{
Edit_TrackSegm_Width( aDC, (TRACK*) DrawStruct );
}
@ -495,8 +495,9 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
break;
case PCB_ZONE_AREA_T:
if( DrawStruct->m_Flags )
if( DrawStruct->GetFlags() )
break;
OnEditItemRequest( aDC, DrawStruct );
break;

View File

@ -75,7 +75,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
if( GetToolId() != ID_NO_TOOL_SELECTED )
{
if( item && item->m_Flags )
if( item && item->GetFlags() )
{
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
@ -90,7 +90,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
}
else
{
if( item && item->m_Flags )
if( item && item->GetFlags() )
{
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), KiBitmap( cancel_xpm ) );
@ -113,7 +113,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
* not the current item being edited. In such case we cannot call
* PcbGeneralLocateAndDisplay().
*/
if( !item || (item->m_Flags == 0) )
if( !item || (item->GetFlags() == 0) )
{
// show "item selector" menu only if no item now or selected item was not
// previously picked at this position
@ -133,7 +133,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
item = GetCurItem();
if( item )
flags = item->m_Flags;
flags = item->GetFlags();
else
flags = 0;
@ -437,7 +437,7 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
updateTraceWidthSelectBox();
updateViaSizeSelectBox();
int flags = Track->m_Flags;
int flags = Track->GetFlags();
if( flags == 0 )
{
@ -581,14 +581,14 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
{
wxString msg;
if( edge_zone->m_Flags == IS_DRAGGED )
if( edge_zone->GetFlags() == IS_DRAGGED )
{
AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT,
_( "Place Edge Outline" ), KiBitmap( apply_xpm ) );
}
else if( edge_zone->m_Flags )
else if( edge_zone->GetFlags() )
{
if( (edge_zone->m_Flags & IN_EDIT ) )
if( (edge_zone->GetFlags() & IN_EDIT ) )
AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_CORNER,
_( "Place Corner" ), KiBitmap( apply_xpm ) );
else
@ -660,7 +660,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu )
{
wxMenu* sub_menu_footprint;
int flags = aModule->m_Flags;
int flags = aModule->GetFlags();
wxString msg;
sub_menu_footprint = new wxMenu;
@ -705,7 +705,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu
void PCB_EDIT_FRAME::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu )
{
wxMenu* sub_menu_Fp_text;
int flags = FpText->m_Flags;
int flags = FpText->GetFlags();
wxString msg = FpText->GetSelectMenuText();
@ -758,7 +758,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* me
void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
{
wxMenu* sub_menu_Pad;
int flags = Pad->m_Flags;
int flags = Pad->GetFlags();
if( flags ) // Currently in edit, no others commands possible
return;
@ -820,7 +820,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
{
wxMenu* sub_menu_Text;
int flags = Text->m_Flags;
int flags = Text->GetFlags();
wxString msg = Text->GetSelectMenuText();

View File

@ -317,10 +317,10 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int two_sides )
}
pt_cur_ch = pt_cur_ch;
segm_oX = GetBoard()->GetBoundingBox().m_Pos.x + (Board.m_GridRouting * col_source);
segm_oY = GetBoard()->GetBoundingBox().m_Pos.y + (Board.m_GridRouting * row_source);
segm_fX = GetBoard()->GetBoundingBox().m_Pos.x + (Board.m_GridRouting * col_target);
segm_fY = GetBoard()->GetBoundingBox().m_Pos.y + (Board.m_GridRouting * row_target);
segm_oX = GetBoard()->GetBoundingBox().GetX() + (Board.m_GridRouting * col_source);
segm_oY = GetBoard()->GetBoundingBox().GetY() + (Board.m_GridRouting * row_source);
segm_fX = GetBoard()->GetBoundingBox().GetX() + (Board.m_GridRouting * col_target);
segm_fY = GetBoard()->GetBoundingBox().GetY() + (Board.m_GridRouting * row_target);
/* Draw segment. */
GRLine( &DrawPanel->m_ClipBox,
@ -469,9 +469,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
*/
{
int cX = ( Board.m_GridRouting * col_source )
+ pcbframe->GetBoard()->GetBoundingBox().m_Pos.x;
+ pcbframe->GetBoard()->GetBoundingBox().GetX();
int cY = ( Board.m_GridRouting * row_source )
+ pcbframe->GetBoard()->GetBoundingBox().m_Pos.y;
+ pcbframe->GetBoard()->GetBoundingBox().GetY();
int dx = pt_cur_ch->m_PadStart->m_Size.x / 2;
int dy = pt_cur_ch->m_PadStart->m_Size.y / 2;
int px = pt_cur_ch->m_PadStart->GetPosition().x;
@ -484,9 +484,9 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
goto end_of_route;
cX = ( Board.m_GridRouting * col_target )
+ pcbframe->GetBoard()->GetBoundingBox().m_Pos.x;
+ pcbframe->GetBoard()->GetBoundingBox().GetX();
cY = ( Board.m_GridRouting * row_target )
+ pcbframe->GetBoard()->GetBoundingBox().m_Pos.y;
+ pcbframe->GetBoard()->GetBoundingBox().GetY();
dx = pt_cur_ch->m_PadEnd->m_Size.x / 2;
dy = pt_cur_ch->m_PadEnd->m_Size.y / 2;
px = pt_cur_ch->m_PadEnd->GetPosition().x;
@ -1170,11 +1170,11 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment->SetLayer( 0x0F );
g_CurrentTrackSegment->m_Start.x =
g_CurrentTrackSegment->m_End.x = pcb->GetBoundingBox().m_Pos.x +
g_CurrentTrackSegment->m_End.x = pcb->GetBoundingBox().GetX() +
( Board.m_GridRouting * row );
g_CurrentTrackSegment->m_Start.y =
g_CurrentTrackSegment->m_End.y = pcb->GetBoundingBox().m_Pos.y +
g_CurrentTrackSegment->m_End.y = pcb->GetBoundingBox().GetY() +
( Board.m_GridRouting * col );
g_CurrentTrackSegment->m_Width = pcb->GetCurrentViaSize();
@ -1194,9 +1194,9 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment->SetLayer( Route_Layer_TOP );
g_CurrentTrackSegment->SetState( TRACK_AR, ON );
g_CurrentTrackSegment->m_End.x = pcb->GetBoundingBox().m_Pos.x +
g_CurrentTrackSegment->m_End.x = pcb->GetBoundingBox().GetX() +
( Board.m_GridRouting * row );
g_CurrentTrackSegment->m_End.y = pcb->GetBoundingBox().m_Pos.y +
g_CurrentTrackSegment->m_End.y = pcb->GetBoundingBox().GetY() +
( Board.m_GridRouting * col );
g_CurrentTrackSegment->SetNet( current_net_code );

View File

@ -248,7 +248,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
{
pt_del->UnLink();
pt_del->SetStatus( 0 );
pt_del->m_Flags = 0;
pt_del->ClearFlags();
ITEM_PICKER picker( pt_del, UR_DELETED );
aItemsListPicker->PushItem( picker );
}

View File

@ -161,7 +161,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, int aDrawMode, const wxPoint
// Draw the graphic items
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
{
if( item->m_Flags & IS_MOVED )
if( item->IsMoving() )
continue;
switch( item->Type() )
@ -185,7 +185,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, int aDrawMode, const wxPoint
// Areas must be drawn here only if not moved or dragged,
// because these areas are drawn by ManageCursor() in a specific manner
if ( (zone->m_Flags & (IN_EDIT | IS_DRAGGED | IS_MOVED)) == 0 )
if ( (zone->GetFlags() & (IN_EDIT | IS_DRAGGED | IS_MOVED)) == 0 )
{
zone->Draw( aPanel, DC, aDrawMode );
zone->DrawFilledArea( aPanel, DC, aDrawMode );
@ -197,7 +197,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, int aDrawMode, const wxPoint
bool display = true;
int layerMask = ALL_CU_LAYERS;
if( module->m_Flags & IS_MOVED )
if( module->IsMoving() )
continue;
if( !IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) ) )

View File

@ -552,7 +552,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule,
}
GetBoard()->m_Status_Pcb = 0;
aNewModule->m_Flags = 0;
aNewModule->ClearFlags();
OnModify();
}

View File

@ -129,7 +129,7 @@ int PCB_EDIT_FRAME::Delete_LastCreatedCorner( wxDC* DC )
DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
zone->RemoveAllContours();
zone->m_Flags = 0;
zone->ClearFlags();
}
return zone->GetNumCorners();
@ -148,7 +148,7 @@ static void Abort_Zone_Create_Outline( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( zone )
{
zone->DrawWhileCreateOutline( Panel, DC, GR_XOR );
zone->m_Flags = 0;
zone->ClearFlags();
zone->RemoveAllContours();
}
@ -194,9 +194,9 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_cont
if ( IsNewCorner )
zone_container->m_Poly->InsertCorner(corner_id-1, cx, cy );
zone_container->m_Flags = IN_EDIT;
zone_container->SetFlags( IN_EDIT );
DrawPanel->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
Abort_Zone_Move_Corner_Or_Outlines );
Abort_Zone_Move_Corner_Or_Outlines );
s_CornerInitialPosition = zone_container->GetCornerPosition( corner_id );
s_CornerIsNew = IsNewCorner;
s_AddCutoutToCurrentZone = false;
@ -208,7 +208,7 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
ZONE_CONTAINER* zone_container,
int corner_id )
{
zone_container->m_Flags = IS_DRAGGED;
zone_container->SetFlags( IS_DRAGGED );
zone_container->m_CornerSelection = corner_id;
DrawPanel->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
Abort_Zone_Move_Corner_Or_Outlines );
@ -243,7 +243,7 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co
SaveCopyOfZones( s_PickedList, GetBoard(), zone_container->GetNet(),
zone_container->GetLayer() );
zone_container->m_Flags = IS_MOVED;
zone_container->SetFlags( IS_MOVED );
DrawPanel->SetMouseCapture( Show_Zone_Corner_Or_Outline_While_Move_Mouse,
Abort_Zone_Move_Corner_Or_Outlines );
s_CursorLastPosition = s_CornerInitialPosition = GetScreen()->GetCrossHairPosition();
@ -255,7 +255,7 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co
void PCB_EDIT_FRAME::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container )
{
zone_container->m_Flags = 0;
zone_container->ClearFlags();
DrawPanel->SetMouseCapture( NULL, NULL );
if( DC )
@ -359,13 +359,13 @@ void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC )
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent();
ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) pcbframe->GetCurItem();
if( zone_container->m_Flags == IS_MOVED )
if( zone_container->IsMoving() )
{
wxPoint offset;
offset = s_CornerInitialPosition - s_CursorLastPosition;
zone_container->Move( offset );
}
else if( zone_container->m_Flags == IS_DRAGGED )
else if( zone_container->IsDragging() )
{
wxPoint offset;
offset = s_CornerInitialPosition - s_CursorLastPosition;
@ -390,7 +390,7 @@ void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC )
Panel->Refresh();
pcbframe->SetCurItem( NULL );
zone_container->m_Flags = 0;
zone_container->ClearFlags();
s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL;
}
@ -411,14 +411,14 @@ void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC*
wxPoint pos = pcbframe->GetScreen()->GetCrossHairPosition();
if( zone->m_Flags == IS_MOVED )
if( zone->IsMoving() )
{
wxPoint offset;
offset = pos - s_CursorLastPosition;
zone->Move( offset );
s_CursorLastPosition = pos;
}
else if( zone->m_Flags == IS_DRAGGED )
else if( zone->IsDragging() )
{
wxPoint offset;
offset = pos - s_CursorLastPosition;
@ -533,7 +533,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
// if first segment
if( zone->GetNumCorners() == 0 )
{
zone->m_Flags = IS_NEW;
zone->SetFlags( IS_NEW );
zone->SetTimeStamp( GetNewTimeStamp() );
g_Zone_Default_Setting.ExportSetting( *zone );
zone->m_Poly->Start( g_Zone_Default_Setting.m_CurrentZone_Layer,
@ -544,7 +544,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
if( Drc_On && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() )
{
zone->m_Flags = 0;
zone->ClearFlags();
zone->RemoveAllContours();
// use the form of SetCurItem() which does not write to the msg panel,
@ -608,7 +608,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC )
}
}
zone->m_Flags = 0;
zone->ClearFlags();
zone->DrawWhileCreateOutline( DrawPanel, DC, GR_XOR );