Commit 27ee8157 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

Minor flags and layer mask cleanup

parent c650c378
......@@ -90,7 +90,7 @@ void EDA_ITEM::InitVars()
void EDA_ITEM::SetModified()
{
m_Flags |= IS_CHANGED;
SetFlags( IS_CHANGED );
// If this a child object, then the parent modification state also needs to be set.
if( m_Parent )
......
......@@ -109,8 +109,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
dc.SetClippingRegion( DrawArea );
}
const int maskLayer = 0xFFFFFFFF;
aFrame->PrintPage( &dc, maskLayer, false );
aFrame->PrintPage( &dc, FULL_LAYERS, false );
screen->m_IsPrinting = false;
aFrame->GetCanvas()->SetClipBox( tmp );
wxMetafile* mf = dc.Close();
......
......@@ -42,33 +42,6 @@
class MODULE;
/* return a one bit layer mask from a layer number
* aLayerNumber = the layer number to convert (0 .. LAYER_COUNT-1)
*/
int GetLayerMask( int aLayerNumber )
{
wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 );
#if 0
// Look up Table for conversion one layer number -> one bit layer mask:
static int tabOneLayerMask[LAYER_COUNT] =
{
0x00000001, 0x00000002, 0x00000004, 0x00000008,
0x00000010, 0x00000020, 0x00000040, 0x00000080,
0x00000100, 0x00000200, 0x00000400, 0x00000800,
0x00001000, 0x00002000, 0x00004000, 0x00008000,
0x00010000, 0x00020000, 0x00040000, 0x00080000,
0x00100000, 0x00200000, 0x00400000, 0x00800000,
0x01000000, 0x02000000, 0x04000000, 0x08000000,
0x10000000, 0x20000000, 0x40000000, 0x80000000
};
return( tabOneLayerMask[aLayerNumber] );
#else
return 1 << aLayerNumber;
#endif
}
/* Look up Table for conversion copper layer count -> general copper layer
* mask: */
LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
......
......@@ -262,9 +262,7 @@ void LIB_PIN::SetNumber( const wxString& number )
SetPinNumFromString( tmp );
if( m_number != oldNumber )
{
m_Flags |= IS_CHANGED;
}
SetFlags( IS_CHANGED );
/* Others pin numbers marked by EnableEditMode() are not modified
* because each pin has its own number
......@@ -437,7 +435,7 @@ void LIB_PIN::SetConversion( int style )
return;
m_Convert = style;
m_Flags |= IS_CHANGED;
SetFlags( IS_CHANGED );
if( style == 0 )
{
......@@ -514,9 +512,9 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin )
&& !IsNew()
&& editPinByPin == false
&& enable )
pinList[i]->m_Flags |= IS_LINKED | IN_EDIT;
pinList[i]->SetFlags( IS_LINKED | IN_EDIT );
else
pinList[i]->m_Flags &= ~( IS_LINKED | IN_EDIT );
pinList[i]->ClearFlags( IS_LINKED | IN_EDIT );
}
}
......@@ -650,7 +648,7 @@ bool LIB_PIN::Save( OUTPUTFORMATTER& aFormatter )
if( aFormatter.Print( 0, "\n" ) < 0 )
return false;
m_Flags &= ~IS_CHANGED;
ClearFlags( IS_CHANGED );
return true;
}
......
......@@ -205,8 +205,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
return true;
}
int flags = item->GetFlags();
bool is_new = (flags & IS_NEW) ? true : false;
bool is_new = item->IsNew();
switch( item->Type() )
{
......
......@@ -255,9 +255,9 @@ bool SCH_BITMAP::IsSelectStateChanged( const wxRect& aRect )
bool previousState = IsSelected();
if( aRect.Contains( m_Pos ) )
m_Flags |= SELECTED;
SetFlags( SELECTED );
else
m_Flags &= ~SELECTED;
ClearFlags( SELECTED );
return previousState != IsSelected();
}
......
......@@ -1607,9 +1607,9 @@ bool SCH_COMPONENT::IsSelectStateChanged( const wxRect& aRect )
EDA_RECT boundingBox = GetBoundingBox();
if( aRect.Intersects( boundingBox ) )
m_Flags |= SELECTED;
SetFlags( SELECTED );
else
m_Flags &= ~SELECTED;
ClearFlags( SELECTED );
return previousState != IsSelected();
}
......
......@@ -168,9 +168,9 @@ bool SCH_JUNCTION::IsSelectStateChanged( const wxRect& aRect )
bool previousState = IsSelected();
if( aRect.Contains( m_pos ) )
m_Flags |= SELECTED;
SetFlags( SELECTED );
else
m_Flags &= ~SELECTED;
ClearFlags( SELECTED );
return previousState != IsSelected();
}
......
......@@ -436,22 +436,22 @@ bool SCH_LINE::IsSelectStateChanged( const wxRect& aRect )
if( aRect.Contains( m_start ) && aRect.Contains( m_end ) )
{
m_Flags |= SELECTED;
m_Flags &= ~(STARTPOINT | ENDPOINT);
SetFlags( SELECTED );
ClearFlags( STARTPOINT | ENDPOINT );
}
else if( aRect.Contains( m_start ) )
{
m_Flags &= ~STARTPOINT;
m_Flags |= ( SELECTED | ENDPOINT );
ClearFlags( STARTPOINT );
SetFlags( SELECTED | ENDPOINT );
}
else if( aRect.Contains( m_end ) )
{
m_Flags &= ~ENDPOINT;
m_Flags |= ( SELECTED | STARTPOINT );
ClearFlags( ENDPOINT );
SetFlags( SELECTED | STARTPOINT );
}
else
{
m_Flags &= ~( SELECTED | STARTPOINT | ENDPOINT );
ClearFlags( SELECTED | STARTPOINT | ENDPOINT );
}
return previousState != IsSelected();
......
......@@ -193,9 +193,9 @@ bool SCH_MARKER::IsSelectStateChanged( const wxRect& aRect )
bool previousState = IsSelected();
if( aRect.Contains( m_Pos ) )
m_Flags |= SELECTED;
SetFlags( SELECTED );
else
m_Flags &= ~SELECTED;
ClearFlags( SELECTED );
return previousState != IsSelected();
}
......
......@@ -174,9 +174,9 @@ bool SCH_NO_CONNECT::IsSelectStateChanged( const wxRect& aRect )
bool previousState = IsSelected();
if( aRect.Contains( m_pos ) )
m_Flags |= SELECTED;
SetFlags( SELECTED );
else
m_Flags &= ~SELECTED;
ClearFlags( SELECTED );
return previousState != IsSelected();
}
......
......@@ -992,9 +992,9 @@ bool SCH_SHEET::IsSelectStateChanged( const wxRect& aRect )
EDA_RECT boundingBox = GetBoundingBox();
if( aRect.Intersects( boundingBox ) )
m_Flags |= SELECTED;
SetFlags( SELECTED );
else
m_Flags &= ~SELECTED;
ClearFlags( SELECTED );
return previousState != IsSelected();
}
......
......@@ -543,7 +543,7 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
break;
}
if( m_isDangling == false )
if( !m_isDangling )
break;
}
......@@ -556,9 +556,9 @@ bool SCH_TEXT::IsSelectStateChanged( const wxRect& aRect )
bool previousState = IsSelected();
if( aRect.Contains( m_Pos ) )
m_Flags |= SELECTED;
SetFlags( SELECTED );
else
m_Flags &= ~SELECTED;
SetFlags( SELECTED );
return previousState != IsSelected();
}
......
......@@ -14,7 +14,7 @@ GBR_LAYOUT::GBR_LAYOUT()
{
PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo );
m_printLayersMask = -1;
m_printLayersMask = FULL_LAYERS;
}
......
......@@ -621,7 +621,7 @@ void GERBER_DRAW_ITEM::Show( int nestLevel, std::ostream& os ) const
" layer=\"" << m_Layer << '"' <<
" size=\"" << m_Size << '"' <<
" flags=\"" << m_Flags << '"' <<
" status=\"" << GetState( -1 ) << '"' <<
" status=\"" << GetStatus() << '"' <<
"<start" << m_Start << "/>" <<
"<end" << m_End << "/>";
......
......@@ -100,6 +100,7 @@ typedef unsigned LAYER_MSK;
*/
inline LAYER_MSK GetLayerMask( unsigned aLayerNumber )
{
wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 );
return 1 << aLayerNumber;
}
......
......@@ -1730,7 +1730,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
case 4:
int state;
state = hexParse( data );
dseg->SetState( state, ON );
dseg->SetState( state, true );
break;
// Bezier Control Points
......@@ -2046,7 +2046,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
}
newTrack->SetNet( net_code );
newTrack->SetState( flags, ON );
newTrack->SetState( flags, true );
}
THROW_IO_ERROR( "Missing '$EndTRACK'" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment