From 675f8d4a0b546e62dfe2239d244e3ae3b5e23a48 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Thu, 28 Mar 2013 20:12:46 +0100 Subject: [PATCH] Typedef STATUS_FLAGS to encapsulate EDA_ITEM bitmapped flags --- common/class_undoredo_container.cpp | 4 +-- eeschema/edit_bitmap.cpp | 2 +- eeschema/getpart.cpp | 4 +-- eeschema/lib_arc.cpp | 2 +- eeschema/lib_arc.h | 2 +- eeschema/lib_circle.cpp | 2 +- eeschema/lib_circle.h | 2 +- eeschema/lib_draw_item.h | 2 +- eeschema/lib_field.cpp | 2 +- eeschema/lib_field.h | 2 +- eeschema/lib_polyline.cpp | 2 +- eeschema/lib_polyline.h | 2 +- eeschema/lib_rectangle.cpp | 2 +- eeschema/lib_rectangle.h | 2 +- eeschema/lib_text.cpp | 2 +- eeschema/lib_text.h | 2 +- eeschema/libeditframe.cpp | 2 +- eeschema/pinedit.cpp | 2 +- include/base_struct.h | 15 +++++----- include/class_undoredo_container.h | 10 +++---- pcbnew/class_track.cpp | 34 +++++++++++------------ pcbnew/class_track.h | 2 +- pcbnew/dialogs/dialog_global_deletion.cpp | 2 +- pcbnew/dragsegm.cpp | 2 +- pcbnew/legacy_plugin.cpp | 7 +++-- pcbnew/modedit_onclick.cpp | 2 +- pcbnew/move_or_drag_track.cpp | 6 ++-- pcbnew/onrightclick.cpp | 2 +- pcbnew/pcb_parser.cpp | 8 +++--- pcbnew/tr_modif.cpp | 6 ++-- 30 files changed, 71 insertions(+), 65 deletions(-) diff --git a/common/class_undoredo_container.cpp b/common/class_undoredo_container.cpp index 51fa8d54ad..5d51e2216c 100644 --- a/common/class_undoredo_container.cpp +++ b/common/class_undoredo_container.cpp @@ -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() ) return m_ItemsList[aIdx].GetFlags(); @@ -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() ) { diff --git a/eeschema/edit_bitmap.cpp b/eeschema/edit_bitmap.cpp index b00de40b20..312edcff7c 100644 --- a/eeschema/edit_bitmap.cpp +++ b/eeschema/edit_bitmap.cpp @@ -85,7 +85,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit dirty.Inflate( 4 ); // Give a margin aPanel->SetMouseCapture( NULL, NULL ); // Avoid loop in redraw panel - int flgs = image->GetFlags(); + STATUS_FLAGS flgs = image->GetFlags(); image->ClearFlags(); aPanel->RefreshDrawingRect( dirty ); image->SetFlags( flgs ); diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 666c6ea3fb..327a11ccea 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -360,7 +360,7 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent ) if( unit > unitCount ) unit = unitCount; - int flags = component->GetFlags(); + STATUS_FLAGS flags = component->GetFlags(); if( !flags ) // No command in progress: save in undo list SaveCopyInUndoList( component, UR_CHANGED ); @@ -405,7 +405,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC ) return; } - int flags = DrawComponent->GetFlags(); + STATUS_FLAGS flags = DrawComponent->GetFlags(); if( DrawComponent->GetFlags() ) DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 2673290c61..2107bc715e 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -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, wxT( "Invalid edit mode for LIB_ARC object." ) ); diff --git a/eeschema/lib_arc.h b/eeschema/lib_arc.h index 49b66cb782..d32d000a72 100644 --- a/eeschema/lib_arc.h +++ b/eeschema/lib_arc.h @@ -110,7 +110,7 @@ public: 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 ); diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index c6357b1f1d..9e957863fc 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -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, wxT( "Invalid edit mode for LIB_CIRCLE object." ) ); diff --git a/eeschema/lib_circle.h b/eeschema/lib_circle.h index 3d5bb6c877..723acf4fe7 100644 --- a/eeschema/lib_circle.h +++ b/eeschema/lib_circle.h @@ -71,7 +71,7 @@ public: 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 ); diff --git a/eeschema/lib_draw_item.h b/eeschema/lib_draw_item.h index 26993b2b55..0e1d6d621f 100644 --- a/eeschema/lib_draw_item.h +++ b/eeschema/lib_draw_item.h @@ -175,7 +175,7 @@ public: * started. This may or may not be required depending on the item * 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. diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 5eb3dbdebf..b52414e7cb 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -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, wxT( "Invalid edit mode for LIB_FIELD object." ) ); diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index 8d4deb810a..2680ff1a82 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -207,7 +207,7 @@ public: 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 ); diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 6b3519b844..072fdda345 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -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, wxT( "Invalid edit mode for LIB_POLYLINE object." ) ); diff --git a/eeschema/lib_polyline.h b/eeschema/lib_polyline.h index 0d803bfe6c..2a0c5566b1 100644 --- a/eeschema/lib_polyline.h +++ b/eeschema/lib_polyline.h @@ -84,7 +84,7 @@ public: 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 ); diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 8a93e05e53..019f6f20ec 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -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, wxT( "Invalid edit mode for LIB_RECTANGLE object." ) ); diff --git a/eeschema/lib_rectangle.h b/eeschema/lib_rectangle.h index 11645a9478..2d0989b8e3 100644 --- a/eeschema/lib_rectangle.h +++ b/eeschema/lib_rectangle.h @@ -75,7 +75,7 @@ public: 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 ); diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index bd7dea54a7..320119c09a 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -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, wxT( "Invalid edit mode for LIB_TEXT object." ) ); diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h index 6da3c3b086..21ce2e9eb8 100644 --- a/eeschema/lib_text.h +++ b/eeschema/lib_text.h @@ -100,7 +100,7 @@ public: 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 ); diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index ce82d3c848..21f8d4716f 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -754,7 +754,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; m_canvas->MoveCursorToCrossHair(); - int oldFlags = m_drawItem->GetFlags(); + STATUS_FLAGS oldFlags = m_drawItem->GetFlags(); m_drawItem->ClearFlags(); m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform ); ( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCrossHairPosition( true ) ); diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index f03c6e3a4b..2095e17325 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -72,7 +72,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) if( m_drawItem == NULL || m_drawItem->Type() != LIB_PIN_T ) 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; DIALOG_LIB_EDIT_PIN dlg( this, pin ); diff --git a/include/base_struct.h b/include/base_struct.h index c258b17d47..56ce1a04e7 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -383,6 +383,7 @@ public: ///< already been edited, in some functions #define EDA_ITEM_ALL_FLAGS -1 +typedef unsigned STATUS_FLAGS; /** * Class EDA_ITEM @@ -399,7 +400,7 @@ private: * functions. */ KICAD_T m_StructType; - int m_Status; + STATUS_FLAGS m_Status; protected: EDA_ITEM* Pnext; ///< next in linked list @@ -414,7 +415,7 @@ protected: bool m_forceVisible; /// 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. EDA_ITEM* m_Image; @@ -475,12 +476,12 @@ public: m_Status &= ~type; } - int GetStatus() const { return m_Status; } - void SetStatus( int aStatus ) { m_Status = aStatus; } + STATUS_FLAGS GetStatus() const { return m_Status; } + void SetStatus( STATUS_FLAGS aStatus ) { m_Status = aStatus; } - void SetFlags( int aMask ) { m_Flags |= aMask; } - void ClearFlags( int aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; } - int GetFlags() const { return m_Flags; } + void SetFlags( STATUS_FLAGS aMask ) { m_Flags |= aMask; } + void ClearFlags( STATUS_FLAGS aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; } + STATUS_FLAGS GetFlags() const { return m_Flags; } void SetImage( EDA_ITEM* aItem ) { m_Image = aItem; } diff --git a/include/class_undoredo_container.h b/include/class_undoredo_container.h index 93a699166e..6c95bae24d 100644 --- a/include/class_undoredo_container.h +++ b/include/class_undoredo_container.h @@ -81,7 +81,7 @@ enum UNDO_REDO_T { class ITEM_PICKER { 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_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 @@ -113,9 +113,9 @@ public: 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; } @@ -231,7 +231,7 @@ public: * @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 */ - int GetPickerFlags( unsigned aIdx ); + STATUS_FLAGS GetPickerFlags( unsigned aIdx ); /** * Function SetPickedItem @@ -275,7 +275,7 @@ public: * @param aIdx Index of the picker in the picked list * @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 diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index dc80db4d1c..b8c2413614 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -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 ) min_dist = m_Width / 2; @@ -1408,15 +1408,15 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) if( via ) { 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 ); - Track->SetState( BUSY, OFF ); + Track->SetState( BUSY, false ); if( via ) - via->SetState( BUSY, OFF ); + via->SetState( BUSY, false ); if( segm == NULL ) { @@ -1434,13 +1434,13 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) BeginPad = Track->GetState( BEGIN_ONPAD ); EndPad = Track->GetState( END_ONPAD ); - Track->SetState( BEGIN_ONPAD | END_ONPAD, OFF ); + Track->SetState( BEGIN_ONPAD | END_ONPAD, false ); if( BeginPad ) - Track->SetState( END_ONPAD, ON ); + Track->SetState( END_ONPAD, true ); if( EndPad ) - Track->SetState( BEGIN_ONPAD, ON ); + Track->SetState( BEGIN_ONPAD, true ); EXCHG( Track->m_Start, Track->m_End ); EXCHG( Track->start, Track->end ); @@ -1455,15 +1455,15 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) if( via ) { 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 ); - Track->SetState( BUSY, OFF ); + Track->SetState( BUSY, false ); if( via ) - via->SetState( BUSY, OFF ); + via->SetState( BUSY, false ); if( segm == NULL ) { @@ -1478,13 +1478,13 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) BeginPad = Track->GetState( BEGIN_ONPAD ); EndPad = Track->GetState( END_ONPAD ); - Track->SetState( BEGIN_ONPAD | END_ONPAD, OFF ); + Track->SetState( BEGIN_ONPAD | END_ONPAD, false ); if( BeginPad ) - Track->SetState( END_ONPAD, ON ); + Track->SetState( END_ONPAD, true ); if( EndPad ) - Track->SetState( BEGIN_ONPAD, ON ); + Track->SetState( BEGIN_ONPAD, true ); EXCHG( Track->m_Start, Track->m_End ); EXCHG( Track->start, Track->end ); @@ -1543,7 +1543,7 @@ void TRACK::Show( int nestLevel, std::ostream& os ) const " layer=\"" << m_Layer << '"' << " width=\"" << m_Width << '"' << " flags=\"" << m_Flags << '"' << - " status=\"" << GetState( -1 ) << '"' << + " status=\"" << GetStatus( ) << '"' << // " drill=\"" << GetDrillValue() << '"' << " netcode=\"" << GetNet() << "\">" << diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index df6aed9c37..8ac2836061 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -229,7 +229,7 @@ public: * (dist = min_dist) both ends, or 0 if none of the above. * 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 diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 47d0a20831..89e65bc54f 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -139,7 +139,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) if( m_DelTracks->GetValue() ) { - int track_mask_filter = 0; + STATUS_FLAGS track_mask_filter = 0; if( !m_TrackFilterLocked->GetValue() ) track_mask_filter |= TRACK_LOCKED; diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp index 0da2c00240..c23c8fe5da 100644 --- a/pcbnew/dragsegm.cpp +++ b/pcbnew/dragsegm.cpp @@ -350,7 +350,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLaye if( track->IsDragging() ) continue; // already put in list - int flag = 0; + STATUS_FLAGS flag = 0; int maxdist = std::max( aMaxDist, track->GetWidth() / 2 ); if( (track->GetFlags() & STARTPOINT) == 0 ) diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 515f31e411..8798236902 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -1990,11 +1990,14 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) int makeType; 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 // 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( flags_int ); if( aStructType==PCB_TRACE_T && type==1 ) makeType = PCB_VIA_T; diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index aa5c25bc67..f722179a91 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -253,7 +253,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen if( item ) { - int flags = item->GetFlags(); + STATUS_FLAGS flags = item->GetFlags(); switch( item->Type() ) { case PCB_MODULE_T: diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 2ceb75e937..394ed2bc0f 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -637,7 +637,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC } else { - int diag = aTrack->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 ); + STATUS_FLAGS diag = aTrack->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 ); wxPoint pos; switch( aCommand ) @@ -766,7 +766,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC if( TrackToStartPoint ) { - int flag = STARTPOINT; + STATUS_FLAGS flag = STARTPOINT; if( track->GetStart() != TrackToStartPoint->GetStart() ) flag = ENDPOINT; @@ -777,7 +777,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC if( TrackToEndPoint ) { - int flag = STARTPOINT; + STATUS_FLAGS flag = STARTPOINT; if( track->GetEnd() != TrackToEndPoint->GetStart() ) flag = ENDPOINT; diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index d0504f2931..14b6055a06 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -53,7 +53,7 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ); bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { wxString msg; - int flags = 0; + STATUS_FLAGS flags = 0; bool locate_track = false; bool blockActive = !GetScreen()->m_BlockLocate.IsIdle(); diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 56a89a6989..d11833c600 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -1282,7 +1282,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT() throw( IO_ERROR, PARSE_ERROR ) break; case T_status: - segment->SetStatus( parseHex() ); + segment->SetStatus( static_cast( parseHex() ) ); break; default: @@ -1966,7 +1966,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE() throw( IO_ERROR, PARSE_ERROR ) break; case T_status: - segment->SetStatus( parseHex() ); + segment->SetStatus( static_cast( parseHex() ) ); break; default: @@ -2263,7 +2263,7 @@ TRACK* PCB_PARSER::parseTRACK() throw( IO_ERROR, PARSE_ERROR ) break; case T_status: - track->SetStatus( parseHex() ); + track->SetStatus( static_cast( parseHex() ) ); break; default: @@ -2343,7 +2343,7 @@ SEGVIA* PCB_PARSER::parseSEGVIA() throw( IO_ERROR, PARSE_ERROR ) break; case T_status: - via->SetStatus( parseHex() ); + via->SetStatus( static_cast( parseHex() ) ); NeedRIGHT(); break; diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index 69abe49d35..3a042ae2da 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -41,7 +41,8 @@ #include -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, @@ -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 * 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() ) {