Commit 675f8d4a authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

Typedef STATUS_FLAGS to encapsulate EDA_ITEM bitmapped flags

parent cd18ff17
...@@ -195,7 +195,7 @@ UNDO_REDO_T PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx ) ...@@ -195,7 +195,7 @@ UNDO_REDO_T PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx )
} }
int PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx ) STATUS_FLAGS PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx )
{ {
if( aIdx < m_ItemsList.size() ) if( aIdx < m_ItemsList.size() )
return m_ItemsList[aIdx].GetFlags(); return m_ItemsList[aIdx].GetFlags();
...@@ -253,7 +253,7 @@ bool PICKED_ITEMS_LIST::SetPickedItemStatus( UNDO_REDO_T aStatus, unsigned aIdx ...@@ -253,7 +253,7 @@ bool PICKED_ITEMS_LIST::SetPickedItemStatus( UNDO_REDO_T aStatus, unsigned aIdx
} }
bool PICKED_ITEMS_LIST::SetPickerFlags( int aFlags, unsigned aIdx ) bool PICKED_ITEMS_LIST::SetPickerFlags( STATUS_FLAGS aFlags, unsigned aIdx )
{ {
if( aIdx < m_ItemsList.size() ) if( aIdx < m_ItemsList.size() )
{ {
......
...@@ -85,7 +85,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit ...@@ -85,7 +85,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit
dirty.Inflate( 4 ); // Give a margin dirty.Inflate( 4 ); // Give a margin
aPanel->SetMouseCapture( NULL, NULL ); // Avoid loop in redraw panel aPanel->SetMouseCapture( NULL, NULL ); // Avoid loop in redraw panel
int flgs = image->GetFlags(); STATUS_FLAGS flgs = image->GetFlags();
image->ClearFlags(); image->ClearFlags();
aPanel->RefreshDrawingRect( dirty ); aPanel->RefreshDrawingRect( dirty );
image->SetFlags( flgs ); image->SetFlags( flgs );
......
...@@ -360,7 +360,7 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent ) ...@@ -360,7 +360,7 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
if( unit > unitCount ) if( unit > unitCount )
unit = unitCount; unit = unitCount;
int flags = component->GetFlags(); STATUS_FLAGS flags = component->GetFlags();
if( !flags ) // No command in progress: save in undo list if( !flags ) // No command in progress: save in undo list
SaveCopyInUndoList( component, UR_CHANGED ); SaveCopyInUndoList( component, UR_CHANGED );
...@@ -405,7 +405,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC ) ...@@ -405,7 +405,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC )
return; return;
} }
int flags = DrawComponent->GetFlags(); STATUS_FLAGS flags = DrawComponent->GetFlags();
if( DrawComponent->GetFlags() ) if( DrawComponent->GetFlags() )
DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
......
...@@ -574,7 +574,7 @@ wxString LIB_ARC::GetSelectMenuText() const ...@@ -574,7 +574,7 @@ wxString LIB_ARC::GetSelectMenuText() const
} }
void LIB_ARC::BeginEdit( int aEditMode, const wxPoint aPosition ) void LIB_ARC::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition )
{ {
wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
wxT( "Invalid edit mode for LIB_ARC object." ) ); wxT( "Invalid edit mode for LIB_ARC object." ) );
......
...@@ -110,7 +110,7 @@ public: ...@@ -110,7 +110,7 @@ public:
int GetPenSize() const; int GetPenSize() const;
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
......
...@@ -296,7 +296,7 @@ wxString LIB_CIRCLE::GetSelectMenuText() const ...@@ -296,7 +296,7 @@ wxString LIB_CIRCLE::GetSelectMenuText() const
} }
void LIB_CIRCLE::BeginEdit( int aEditMode, const wxPoint aPosition ) void LIB_CIRCLE::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition )
{ {
wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
wxT( "Invalid edit mode for LIB_CIRCLE object." ) ); wxT( "Invalid edit mode for LIB_CIRCLE object." ) );
......
...@@ -71,7 +71,7 @@ public: ...@@ -71,7 +71,7 @@ public:
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
......
...@@ -175,7 +175,7 @@ public: ...@@ -175,7 +175,7 @@ public:
* started. This may or may not be required depending on the item * started. This may or may not be required depending on the item
* being edited and the edit mode. * being edited and the edit mode.
*/ */
virtual void BeginEdit( int aEditMode, const wxPoint aPosition = wxPoint( 0, 0 ) ) {} virtual void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition = wxPoint( 0, 0 ) ) {}
/** /**
* Continue an edit in progress at \a aPosition. * Continue an edit in progress at \a aPosition.
......
...@@ -659,7 +659,7 @@ wxString LIB_FIELD::GetSelectMenuText() const ...@@ -659,7 +659,7 @@ wxString LIB_FIELD::GetSelectMenuText() const
} }
void LIB_FIELD::BeginEdit( int aEditMode, const wxPoint aPosition ) void LIB_FIELD::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition )
{ {
wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED ) ) != 0, wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED ) ) != 0,
wxT( "Invalid edit mode for LIB_FIELD object." ) ); wxT( "Invalid edit mode for LIB_FIELD object." ) );
......
...@@ -207,7 +207,7 @@ public: ...@@ -207,7 +207,7 @@ public:
EDA_COLOR_T GetDefaultColor(); EDA_COLOR_T GetDefaultColor();
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
......
...@@ -420,7 +420,7 @@ wxString LIB_POLYLINE::GetSelectMenuText() const ...@@ -420,7 +420,7 @@ wxString LIB_POLYLINE::GetSelectMenuText() const
} }
void LIB_POLYLINE::BeginEdit( int aEditMode, const wxPoint aPosition ) void LIB_POLYLINE::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition )
{ {
wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
wxT( "Invalid edit mode for LIB_POLYLINE object." ) ); wxT( "Invalid edit mode for LIB_POLYLINE object." ) );
......
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
......
...@@ -333,7 +333,7 @@ wxString LIB_RECTANGLE::GetSelectMenuText() const ...@@ -333,7 +333,7 @@ wxString LIB_RECTANGLE::GetSelectMenuText() const
} }
void LIB_RECTANGLE::BeginEdit( int aEditMode, const wxPoint aPosition ) void LIB_RECTANGLE::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition )
{ {
wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0,
wxT( "Invalid edit mode for LIB_RECTANGLE object." ) ); wxT( "Invalid edit mode for LIB_RECTANGLE object." ) );
......
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
......
...@@ -495,7 +495,7 @@ wxString LIB_TEXT::GetSelectMenuText() const ...@@ -495,7 +495,7 @@ wxString LIB_TEXT::GetSelectMenuText() const
} }
void LIB_TEXT::BeginEdit( int aEditMode, const wxPoint aPosition ) void LIB_TEXT::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition )
{ {
wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED ) ) != 0, wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED ) ) != 0,
wxT( "Invalid edit mode for LIB_TEXT object." ) ); wxT( "Invalid edit mode for LIB_TEXT object." ) );
......
...@@ -100,7 +100,7 @@ public: ...@@ -100,7 +100,7 @@ public:
void Rotate(); void Rotate();
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
......
...@@ -754,7 +754,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -754,7 +754,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
int oldFlags = m_drawItem->GetFlags(); STATUS_FLAGS oldFlags = m_drawItem->GetFlags();
m_drawItem->ClearFlags(); m_drawItem->ClearFlags();
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform ); m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCrossHairPosition( true ) ); ( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCrossHairPosition( true ) );
......
...@@ -72,7 +72,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) ...@@ -72,7 +72,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
if( m_drawItem == NULL || m_drawItem->Type() != LIB_PIN_T ) if( m_drawItem == NULL || m_drawItem->Type() != LIB_PIN_T )
return; return;
int item_flags = m_drawItem->GetFlags(); // save flags to restore them after editing STATUS_FLAGS item_flags = m_drawItem->GetFlags(); // save flags to restore them after editing
LIB_PIN* pin = (LIB_PIN*) m_drawItem; LIB_PIN* pin = (LIB_PIN*) m_drawItem;
DIALOG_LIB_EDIT_PIN dlg( this, pin ); DIALOG_LIB_EDIT_PIN dlg( this, pin );
......
...@@ -383,6 +383,7 @@ public: ...@@ -383,6 +383,7 @@ public:
///< already been edited, in some functions ///< already been edited, in some functions
#define EDA_ITEM_ALL_FLAGS -1 #define EDA_ITEM_ALL_FLAGS -1
typedef unsigned STATUS_FLAGS;
/** /**
* Class EDA_ITEM * Class EDA_ITEM
...@@ -399,7 +400,7 @@ private: ...@@ -399,7 +400,7 @@ private:
* functions. * functions.
*/ */
KICAD_T m_StructType; KICAD_T m_StructType;
int m_Status; STATUS_FLAGS m_Status;
protected: protected:
EDA_ITEM* Pnext; ///< next in linked list EDA_ITEM* Pnext; ///< next in linked list
...@@ -414,7 +415,7 @@ protected: ...@@ -414,7 +415,7 @@ protected:
bool m_forceVisible; bool m_forceVisible;
/// Flag bits for editing and other uses. /// Flag bits for editing and other uses.
int m_Flags; STATUS_FLAGS m_Flags;
// Link to an copy of the item use to save the item's state for undo/redo feature. // Link to an copy of the item use to save the item's state for undo/redo feature.
EDA_ITEM* m_Image; EDA_ITEM* m_Image;
...@@ -475,12 +476,12 @@ public: ...@@ -475,12 +476,12 @@ public:
m_Status &= ~type; m_Status &= ~type;
} }
int GetStatus() const { return m_Status; } STATUS_FLAGS GetStatus() const { return m_Status; }
void SetStatus( int aStatus ) { m_Status = aStatus; } void SetStatus( STATUS_FLAGS aStatus ) { m_Status = aStatus; }
void SetFlags( int aMask ) { m_Flags |= aMask; } void SetFlags( STATUS_FLAGS aMask ) { m_Flags |= aMask; }
void ClearFlags( int aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; } void ClearFlags( STATUS_FLAGS aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; }
int GetFlags() const { return m_Flags; } STATUS_FLAGS GetFlags() const { return m_Flags; }
void SetImage( EDA_ITEM* aItem ) { m_Image = aItem; } void SetImage( EDA_ITEM* aItem ) { m_Image = aItem; }
......
...@@ -81,7 +81,7 @@ enum UNDO_REDO_T { ...@@ -81,7 +81,7 @@ enum UNDO_REDO_T {
class ITEM_PICKER class ITEM_PICKER
{ {
private: private:
int m_pickerFlags; /* a copy of m_Flags member. useful in mode/drag STATUS_FLAGS m_pickerFlags; /* a copy of m_Flags member. useful in mode/drag
* undo/redo commands */ * undo/redo commands */
UNDO_REDO_T m_undoRedoStatus; /* type of operation to undo/redo for this item */ UNDO_REDO_T m_undoRedoStatus; /* type of operation to undo/redo for this item */
EDA_ITEM* m_pickedItem; /* Pointer on the schematic or board item that is concerned EDA_ITEM* m_pickedItem; /* Pointer on the schematic or board item that is concerned
...@@ -113,9 +113,9 @@ public: ...@@ -113,9 +113,9 @@ public:
UNDO_REDO_T GetStatus() { return m_undoRedoStatus; } UNDO_REDO_T GetStatus() { return m_undoRedoStatus; }
void SetFlags( int aFlags ) { m_pickerFlags = aFlags; } void SetFlags( STATUS_FLAGS aFlags ) { m_pickerFlags = aFlags; }
int GetFlags() { return m_pickerFlags; } STATUS_FLAGS GetFlags() const { return m_pickerFlags; }
void SetLink( EDA_ITEM* aItem ) { m_link = aItem; } void SetLink( EDA_ITEM* aItem ) { m_link = aItem; }
...@@ -231,7 +231,7 @@ public: ...@@ -231,7 +231,7 @@ public:
* @param aIdx Index of the picker in the picked list * @param aIdx Index of the picker in the picked list
* @return The value stored in the picker, if the picker exists, or 0 if does not exist * @return The value stored in the picker, if the picker exists, or 0 if does not exist
*/ */
int GetPickerFlags( unsigned aIdx ); STATUS_FLAGS GetPickerFlags( unsigned aIdx );
/** /**
* Function SetPickedItem * Function SetPickedItem
...@@ -275,7 +275,7 @@ public: ...@@ -275,7 +275,7 @@ public:
* @param aIdx Index of the picker in the picked list * @param aIdx Index of the picker in the picked list
* @return True if the picker exists or false if does not exist * @return True if the picker exists or false if does not exist
*/ */
bool SetPickerFlags( int aFlags, unsigned aIdx ); bool SetPickerFlags( STATUS_FLAGS aFlags, unsigned aIdx );
/** /**
* Function RemovePicker * Function RemovePicker
......
...@@ -273,9 +273,9 @@ bool TRACK::IsNull() ...@@ -273,9 +273,9 @@ bool TRACK::IsNull()
} }
int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist ) STATUS_FLAGS TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
{ {
int result = 0; STATUS_FLAGS result = 0;
if( min_dist < 0 ) if( min_dist < 0 )
min_dist = m_Width / 2; min_dist = m_Width / 2;
...@@ -1408,15 +1408,15 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) ...@@ -1408,15 +1408,15 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
if( via ) if( via )
{ {
layerMask |= via->ReturnMaskLayer(); layerMask |= via->ReturnMaskLayer();
via->SetState( BUSY, ON ); via->SetState( BUSY, true );
} }
Track->SetState( BUSY, ON ); Track->SetState( BUSY, true );
segm = ::GetTrace( this, TrackListEnd, Track->m_Start, layerMask ); segm = ::GetTrace( this, TrackListEnd, Track->m_Start, layerMask );
Track->SetState( BUSY, OFF ); Track->SetState( BUSY, false );
if( via ) if( via )
via->SetState( BUSY, OFF ); via->SetState( BUSY, false );
if( segm == NULL ) if( segm == NULL )
{ {
...@@ -1434,13 +1434,13 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) ...@@ -1434,13 +1434,13 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
BeginPad = Track->GetState( BEGIN_ONPAD ); BeginPad = Track->GetState( BEGIN_ONPAD );
EndPad = Track->GetState( END_ONPAD ); EndPad = Track->GetState( END_ONPAD );
Track->SetState( BEGIN_ONPAD | END_ONPAD, OFF ); Track->SetState( BEGIN_ONPAD | END_ONPAD, false );
if( BeginPad ) if( BeginPad )
Track->SetState( END_ONPAD, ON ); Track->SetState( END_ONPAD, true );
if( EndPad ) if( EndPad )
Track->SetState( BEGIN_ONPAD, ON ); Track->SetState( BEGIN_ONPAD, true );
EXCHG( Track->m_Start, Track->m_End ); EXCHG( Track->m_Start, Track->m_End );
EXCHG( Track->start, Track->end ); EXCHG( Track->start, Track->end );
...@@ -1455,15 +1455,15 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) ...@@ -1455,15 +1455,15 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
if( via ) if( via )
{ {
layerMask |= via->ReturnMaskLayer(); layerMask |= via->ReturnMaskLayer();
via->SetState( BUSY, ON ); via->SetState( BUSY, true );
} }
Track->SetState( BUSY, ON ); Track->SetState( BUSY, true );
segm = ::GetTrace( this, TrackListEnd, Track->m_End, layerMask ); segm = ::GetTrace( this, TrackListEnd, Track->m_End, layerMask );
Track->SetState( BUSY, OFF ); Track->SetState( BUSY, false );
if( via ) if( via )
via->SetState( BUSY, OFF ); via->SetState( BUSY, false );
if( segm == NULL ) if( segm == NULL )
{ {
...@@ -1478,13 +1478,13 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) ...@@ -1478,13 +1478,13 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace )
BeginPad = Track->GetState( BEGIN_ONPAD ); BeginPad = Track->GetState( BEGIN_ONPAD );
EndPad = Track->GetState( END_ONPAD ); EndPad = Track->GetState( END_ONPAD );
Track->SetState( BEGIN_ONPAD | END_ONPAD, OFF ); Track->SetState( BEGIN_ONPAD | END_ONPAD, false );
if( BeginPad ) if( BeginPad )
Track->SetState( END_ONPAD, ON ); Track->SetState( END_ONPAD, true );
if( EndPad ) if( EndPad )
Track->SetState( BEGIN_ONPAD, ON ); Track->SetState( BEGIN_ONPAD, true );
EXCHG( Track->m_Start, Track->m_End ); EXCHG( Track->m_Start, Track->m_End );
EXCHG( Track->start, Track->end ); EXCHG( Track->start, Track->end );
...@@ -1543,7 +1543,7 @@ void TRACK::Show( int nestLevel, std::ostream& os ) const ...@@ -1543,7 +1543,7 @@ void TRACK::Show( int nestLevel, std::ostream& os ) const
" layer=\"" << m_Layer << '"' << " layer=\"" << m_Layer << '"' <<
" width=\"" << m_Width << '"' << " width=\"" << m_Width << '"' <<
" flags=\"" << m_Flags << '"' << " flags=\"" << m_Flags << '"' <<
" status=\"" << GetState( -1 ) << '"' << " status=\"" << GetStatus( ) << '"' <<
// " drill=\"" << GetDrillValue() << '"' << // " drill=\"" << GetDrillValue() << '"' <<
" netcode=\"" << GetNet() << "\">" << " netcode=\"" << GetNet() << "\">" <<
......
...@@ -229,7 +229,7 @@ public: ...@@ -229,7 +229,7 @@ public:
* (dist = min_dist) both ends, or 0 if none of the above. * (dist = min_dist) both ends, or 0 if none of the above.
* if min_dist < 0: min_dist = track_width/2 * if min_dist < 0: min_dist = track_width/2
*/ */
int IsPointOnEnds( const wxPoint& point, int min_dist = 0 ); STATUS_FLAGS IsPointOnEnds( const wxPoint& point, int min_dist = 0 );
/** /**
* Function IsNull * Function IsNull
......
...@@ -139,7 +139,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) ...@@ -139,7 +139,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( )
if( m_DelTracks->GetValue() ) if( m_DelTracks->GetValue() )
{ {
int track_mask_filter = 0; STATUS_FLAGS track_mask_filter = 0;
if( !m_TrackFilterLocked->GetValue() ) if( !m_TrackFilterLocked->GetValue() )
track_mask_filter |= TRACK_LOCKED; track_mask_filter |= TRACK_LOCKED;
......
...@@ -350,7 +350,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLaye ...@@ -350,7 +350,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLaye
if( track->IsDragging() ) if( track->IsDragging() )
continue; // already put in list continue; // already put in list
int flag = 0; STATUS_FLAGS flag = 0;
int maxdist = std::max( aMaxDist, track->GetWidth() / 2 ); int maxdist = std::max( aMaxDist, track->GetWidth() / 2 );
if( (track->GetFlags() & STARTPOINT) == 0 ) if( (track->GetFlags() & STARTPOINT) == 0 )
......
...@@ -1990,11 +1990,14 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) ...@@ -1990,11 +1990,14 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType )
int makeType; int makeType;
time_t timeStamp; time_t timeStamp;
int layer, type, flags, net_code; int layer, type, net_code, flags_int;
// parse the 2nd line to determine the type of object // parse the 2nd line to determine the type of object
// e.g. "De 15 1 7 0 0" for a via // e.g. "De 15 1 7 0 0" for a via
sscanf( line + SZ( "De" ), " %d %d %d %lX %X", &layer, &type, &net_code, &timeStamp, &flags ); sscanf( line + SZ( "De" ), " %d %d %d %lX %X", &layer, &type, &net_code,
&timeStamp, &flags_int );
STATUS_FLAGS flags;
flags = static_cast<STATUS_FLAGS>( flags_int );
if( aStructType==PCB_TRACE_T && type==1 ) if( aStructType==PCB_TRACE_T && type==1 )
makeType = PCB_VIA_T; makeType = PCB_VIA_T;
......
...@@ -253,7 +253,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen ...@@ -253,7 +253,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
if( item ) if( item )
{ {
int flags = item->GetFlags(); STATUS_FLAGS flags = item->GetFlags();
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_T: case PCB_MODULE_T:
......
...@@ -637,7 +637,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC ...@@ -637,7 +637,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
} }
else else
{ {
int diag = aTrack->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 ); STATUS_FLAGS diag = aTrack->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 );
wxPoint pos; wxPoint pos;
switch( aCommand ) switch( aCommand )
...@@ -766,7 +766,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ...@@ -766,7 +766,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
if( TrackToStartPoint ) if( TrackToStartPoint )
{ {
int flag = STARTPOINT; STATUS_FLAGS flag = STARTPOINT;
if( track->GetStart() != TrackToStartPoint->GetStart() ) if( track->GetStart() != TrackToStartPoint->GetStart() )
flag = ENDPOINT; flag = ENDPOINT;
...@@ -777,7 +777,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ...@@ -777,7 +777,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
if( TrackToEndPoint ) if( TrackToEndPoint )
{ {
int flag = STARTPOINT; STATUS_FLAGS flag = STARTPOINT;
if( track->GetEnd() != TrackToEndPoint->GetStart() ) if( track->GetEnd() != TrackToEndPoint->GetStart() )
flag = ENDPOINT; flag = ENDPOINT;
......
...@@ -53,7 +53,7 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ); ...@@ -53,7 +53,7 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard );
bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
{ {
wxString msg; wxString msg;
int flags = 0; STATUS_FLAGS flags = 0;
bool locate_track = false; bool locate_track = false;
bool blockActive = !GetScreen()->m_BlockLocate.IsIdle(); bool blockActive = !GetScreen()->m_BlockLocate.IsIdle();
......
...@@ -1282,7 +1282,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT() throw( IO_ERROR, PARSE_ERROR ) ...@@ -1282,7 +1282,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT() throw( IO_ERROR, PARSE_ERROR )
break; break;
case T_status: case T_status:
segment->SetStatus( parseHex() ); segment->SetStatus( static_cast<STATUS_FLAGS>( parseHex() ) );
break; break;
default: default:
...@@ -1966,7 +1966,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE() throw( IO_ERROR, PARSE_ERROR ) ...@@ -1966,7 +1966,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE() throw( IO_ERROR, PARSE_ERROR )
break; break;
case T_status: case T_status:
segment->SetStatus( parseHex() ); segment->SetStatus( static_cast<STATUS_FLAGS>( parseHex() ) );
break; break;
default: default:
...@@ -2263,7 +2263,7 @@ TRACK* PCB_PARSER::parseTRACK() throw( IO_ERROR, PARSE_ERROR ) ...@@ -2263,7 +2263,7 @@ TRACK* PCB_PARSER::parseTRACK() throw( IO_ERROR, PARSE_ERROR )
break; break;
case T_status: case T_status:
track->SetStatus( parseHex() ); track->SetStatus( static_cast<STATUS_FLAGS>( parseHex() ) );
break; break;
default: default:
...@@ -2343,7 +2343,7 @@ SEGVIA* PCB_PARSER::parseSEGVIA() throw( IO_ERROR, PARSE_ERROR ) ...@@ -2343,7 +2343,7 @@ SEGVIA* PCB_PARSER::parseSEGVIA() throw( IO_ERROR, PARSE_ERROR )
break; break;
case T_status: case T_status:
via->SetStatus( parseHex() ); via->SetStatus( static_cast<STATUS_FLAGS>( parseHex() ) );
NeedRIGHT(); NeedRIGHT();
break; break;
......
...@@ -41,7 +41,8 @@ ...@@ -41,7 +41,8 @@
#include <protos.h> #include <protos.h>
static void ListSetState( EDA_ITEM* Start, int NbItem, int State, int onoff ); static void ListSetState( EDA_ITEM* Start, int NbItem, STATUS_FLAGS State,
bool onoff );
void DrawTraces( EDA_DRAW_PANEL* panel, wxDC* DC, TRACK* aTrackList, int nbsegment, void DrawTraces( EDA_DRAW_PANEL* panel, wxDC* DC, TRACK* aTrackList, int nbsegment,
...@@ -311,7 +312,8 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, ...@@ -311,7 +312,8 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
/* Set the bits of .m_State member to on/off value, using bit mask State /* Set the bits of .m_State member to on/off value, using bit mask State
* of a list of EDA_ITEM * of a list of EDA_ITEM
*/ */
static void ListSetState( EDA_ITEM* Start, int NbItem, int State, int onoff ) static void ListSetState( EDA_ITEM* Start, int NbItem, STATUS_FLAGS State,
bool onoff )
{ {
for( ; (Start != NULL ) && ( NbItem > 0 ); NbItem--, Start = Start->Next() ) for( ; (Start != NULL ) && ( NbItem > 0 ); NbItem--, Start = Start->Next() )
{ {
......
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