Terminology (use present tense for flags).

This commit is contained in:
Jeff Young 2021-05-30 22:04:07 +01:00
parent 1be2c8cc40
commit 0598c82972
14 changed files with 38 additions and 38 deletions

View File

@ -48,7 +48,7 @@ std::vector<wxPoint> SCH_EDIT_FRAME::GetSchematicConnections()
for( SCH_ITEM* item : GetScreen()->Items() ) for( SCH_ITEM* item : GetScreen()->Items() )
{ {
// Avoid items that are changing // Avoid items that are changing
if( !( item->GetEditFlags() & ( IS_DRAGGED | IS_MOVED | IS_DELETED ) ) ) if( !( item->GetEditFlags() & ( IS_DRAGGING | IS_MOVING | IS_DELETED ) ) )
{ {
std::vector<wxPoint> pts = item->GetConnectionPoints(); std::vector<wxPoint> pts = item->GetConnectionPoints();
retval.insert( retval.end(), pts.begin(), pts.end() ); retval.insert( retval.end(), pts.begin(), pts.end() );
@ -104,7 +104,7 @@ bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd )
for( SCH_LINE* line : wires ) for( SCH_LINE* line : wires )
{ {
// Don't remove wires that are already deleted or are currently being dragged // Don't remove wires that are already deleted or are currently being dragged
if( line->GetEditFlags() & ( STRUCT_DELETED | IS_DRAGGED | IS_MOVED | SKIP_STRUCT ) ) if( line->GetEditFlags() & ( STRUCT_DELETED | IS_DRAGGING | IS_MOVING | SKIP_STRUCT ) )
continue; continue;
if( !IsPointOnSegment( line->GetStartPoint(), line->GetEndPoint(), aStart ) || if( !IsPointOnSegment( line->GetStartPoint(), line->GetEndPoint(), aStart ) ||

View File

@ -89,7 +89,7 @@ public:
* @param unit is unit for symbols that have multiple parts per package. * @param unit is unit for symbols that have multiple parts per package.
* @param convert is the alternate body style for the schematic symbols. * @param convert is the alternate body style for the schematic symbols.
* @param pos is the position of the symbol. * @param pos is the position of the symbol.
* @param setNewItemFlag is used to set the symbol #IS_NEW and #IS_MOVED flags. * @param setNewItemFlag is used to set the symbol #IS_NEW and #IS_MOVING flags.
*/ */
SCH_COMPONENT( const LIB_PART& aPart, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet, SCH_COMPONENT( const LIB_PART& aPart, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
int unit = 0, int convert = 0, int unit = 0, int convert = 0,

View File

@ -528,7 +528,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
else if( evt->IsDrag( BUT_LEFT ) ) else if( evt->IsDrag( BUT_LEFT ) )
{ {
// Is another tool already moving a new object? Don't allow a drag start // Is another tool already moving a new object? Don't allow a drag start
if( !m_selection.Empty() && m_selection[0]->HasFlag( IS_NEW | IS_MOVED ) ) if( !m_selection.Empty() && m_selection[0]->HasFlag( IS_NEW | IS_MOVING ) )
{ {
evt->SetPassEvent(); evt->SetPassEvent();
continue; continue;

View File

@ -146,11 +146,11 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
m_selectionTool->AddItemToSel( aSymbol ); m_selectionTool->AddItemToSel( aSymbol );
aSymbol->SetParent( m_frame->GetScreen() ); aSymbol->SetParent( m_frame->GetScreen() );
aSymbol->SetFlags( IS_NEW | IS_MOVED ); aSymbol->SetFlags( IS_NEW | IS_MOVING );
m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), aSymbol, false ); m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), aSymbol, false );
// Set IS_MOVED again, as AddItemToScreenAndUndoList() will have cleared it. // Set IS_MOVING again, as AddItemToScreenAndUndoList() will have cleared it.
aSymbol->SetFlags( IS_MOVED ); aSymbol->SetFlags( IS_MOVING );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->RunAction( ACTIONS::refreshPreview );
}; };
@ -516,7 +516,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
continue; continue;
} }
image->SetFlags( IS_NEW | IS_MOVED ); image->SetFlags( IS_NEW | IS_MOVING );
m_frame->SaveCopyForRepeatItem( image ); m_frame->SaveCopyForRepeatItem( image );
@ -890,7 +890,7 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
textItem->SetItalic( m_lastTextItalic ); textItem->SetItalic( m_lastTextItalic );
textItem->SetLabelSpinStyle( m_lastTextOrientation ); textItem->SetLabelSpinStyle( m_lastTextOrientation );
textItem->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) ); textItem->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
textItem->SetFlags( IS_NEW | IS_MOVED ); textItem->SetFlags( IS_NEW | IS_MOVING );
DIALOG_LABEL_EDITOR dlg( m_frame, textItem ); DIALOG_LABEL_EDITOR dlg( m_frame, textItem );
@ -1158,7 +1158,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
if( item ) if( item )
{ {
item->SetFlags( IS_NEW | IS_MOVED ); item->SetFlags( IS_NEW | IS_MOVING );
item->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false ); item->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
updatePreview(); updatePreview();
@ -1174,7 +1174,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
// ... and second click places: // ... and second click places:
else else
{ {
item->ClearFlags( IS_MOVED ); item->ClearFlags( IS_MOVING );
m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), (SCH_ITEM*) item, false ); m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), (SCH_ITEM*) item, false );
item = nullptr; item = nullptr;
@ -1327,7 +1327,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(), sheet = new SCH_SHEET( m_frame->GetCurrentSheet().Last(),
static_cast<wxPoint>( cursorPos ) ); static_cast<wxPoint>( cursorPos ) );
sheet->SetFlags( IS_NEW | IS_RESIZED ); sheet->SetFlags( IS_NEW | IS_RESIZING );
sheet->SetScreen( NULL ); sheet->SetScreen( NULL );
sheet->SetBorderWidth( cfg->m_Drawing.default_line_thickness ); sheet->SetBorderWidth( cfg->m_Drawing.default_line_thickness );
sheet->SetBorderColor( cfg->m_Drawing.default_sheet_border_color ); sheet->SetBorderColor( cfg->m_Drawing.default_sheet_border_color );

View File

@ -1693,11 +1693,11 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
const_cast<KIID&>( item->m_Uuid ) = KIID(); const_cast<KIID&>( item->m_Uuid ) = KIID();
} }
item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED ); item->SetFlags( IS_NEW | IS_PASTED | IS_MOVING );
m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), (SCH_ITEM*) item, i > 0 ); m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), (SCH_ITEM*) item, i > 0 );
// Reset flags for subsequent move operation // Reset flags for subsequent move operation
item->SetFlags( IS_NEW | IS_PASTED | IS_MOVED ); item->SetFlags( IS_NEW | IS_PASTED | IS_MOVING );
// Start out hidden so the pasted items aren't "ghosted" in their original location // Start out hidden so the pasted items aren't "ghosted" in their original location
// before being moved to the current location. // before being moved to the current location.
getView()->Hide( item, true ); getView()->Hide( item, true );

View File

@ -375,7 +375,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet, wxPoint aPo
m_busUnfold.label->SetTextSize( wxSize( cfg.m_DefaultTextSize, cfg.m_DefaultTextSize ) ); m_busUnfold.label->SetTextSize( wxSize( cfg.m_DefaultTextSize, cfg.m_DefaultTextSize ) );
m_busUnfold.label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT ); m_busUnfold.label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT );
m_busUnfold.label->SetParent( m_frame->GetScreen() ); m_busUnfold.label->SetParent( m_frame->GetScreen() );
m_busUnfold.label->SetFlags( IS_NEW | IS_MOVED ); m_busUnfold.label->SetFlags( IS_NEW | IS_MOVING );
m_busUnfold.in_progress = true; m_busUnfold.in_progress = true;
m_busUnfold.origin = aPos; m_busUnfold.origin = aPos;
@ -651,7 +651,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
// Create a new segment, and chain it after the current segment. // Create a new segment, and chain it after the current segment.
segment = new SCH_LINE( *segment ); segment = new SCH_LINE( *segment );
segment->SetFlags( IS_NEW | IS_MOVED ); segment->SetFlags( IS_NEW | IS_MOVING );
segment->SetStartPoint( cursorPos ); segment->SetStartPoint( cursorPos );
m_wires.push_back( segment ); m_wires.push_back( segment );
@ -790,7 +790,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::startSegments( int aType, const VECTOR2D& aPos
// Give segments a parent so they find the default line/wire/bus widths // Give segments a parent so they find the default line/wire/bus widths
segment->SetParent( &m_frame->Schematic() ); segment->SetParent( &m_frame->Schematic() );
segment->SetFlags( IS_NEW | IS_MOVED ); segment->SetFlags( IS_NEW | IS_MOVING );
m_wires.push_back( segment ); m_wires.push_back( segment );
m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ ); m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ );
@ -800,7 +800,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::startSegments( int aType, const VECTOR2D& aPos
if( m_frame->eeconfig()->m_Drawing.hv_lines_only ) if( m_frame->eeconfig()->m_Drawing.hv_lines_only )
{ {
segment = new SCH_LINE( *segment ); segment = new SCH_LINE( *segment );
segment->SetFlags( IS_NEW | IS_MOVED ); segment->SetFlags( IS_NEW | IS_MOVING );
m_wires.push_back( segment ); m_wires.push_back( segment );
m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ ); m_selectionTool->AddItemToSel( segment, true /*quiet mode*/ );
@ -908,7 +908,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
// Add the new wires // Add the new wires
for( SCH_LINE* wire : m_wires ) for( SCH_LINE* wire : m_wires )
{ {
wire->ClearFlags( IS_NEW | IS_MOVED ); wire->ClearFlags( IS_NEW | IS_MOVING );
m_frame->AddToScreen( wire, screen ); m_frame->AddToScreen( wire, screen );
} }

View File

@ -776,7 +776,7 @@ void SCH_MOVE_TOOL::moveItem( EDA_ITEM* aItem, const VECTOR2I& aDelta )
} }
getView()->Hide( aItem, false ); getView()->Hide( aItem, false );
aItem->SetFlags( IS_MOVED ); aItem->SetFlags( IS_MOVING );
} }
@ -832,7 +832,7 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent )
append_undo = true; append_undo = true;
moveItem( dragItem, gridpt ); moveItem( dragItem, gridpt );
dragItem->ClearFlags( IS_MOVED ); dragItem->ClearFlags( IS_MOVING );
updateItem( dragItem, true ); updateItem( dragItem, true );
} }
} }
@ -849,7 +849,7 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent )
moveItem( item, gridpt ); moveItem( item, gridpt );
updateItem( item, true ); updateItem( item, true );
item->ClearFlags( IS_MOVED ); item->ClearFlags( IS_MOVING );
} }
} }
else else
@ -889,7 +889,7 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent )
append_undo = true; append_undo = true;
moveItem( dragItem, most_common ); moveItem( dragItem, most_common );
dragItem->ClearFlags( IS_MOVED ); dragItem->ClearFlags( IS_MOVING );
updateItem( dragItem, true ); updateItem( dragItem, true );
} }
} }

View File

@ -193,7 +193,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
if( item ) if( item )
{ {
item->SetFlags( IS_NEW | IS_MOVED ); item->SetFlags( IS_NEW | IS_MOVING );
m_view->ClearPreview(); m_view->ClearPreview();
m_view->AddToPreview( item->Clone() ); m_view->AddToPreview( item->Clone() );
m_selectionTool->AddItemToSel( item ); m_selectionTool->AddItemToSel( item );

View File

@ -366,7 +366,7 @@ int SYMBOL_EDITOR_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
void SYMBOL_EDITOR_MOVE_TOOL::moveItem( EDA_ITEM* aItem, VECTOR2I aDelta ) void SYMBOL_EDITOR_MOVE_TOOL::moveItem( EDA_ITEM* aItem, VECTOR2I aDelta )
{ {
static_cast<LIB_ITEM*>( aItem )->Offset( mapCoords( aDelta ) ); static_cast<LIB_ITEM*>( aItem )->Offset( mapCoords( aDelta ) );
aItem->SetFlags( IS_MOVED ); aItem->SetFlags( IS_MOVING );
} }

View File

@ -103,10 +103,10 @@ typedef const INSPECTOR_FUNC& INSPECTOR;
#define IS_CHANGED (1 << 0) ///< Item was edited, and modified #define IS_CHANGED (1 << 0) ///< Item was edited, and modified
#define IS_LINKED (1 << 1) ///< Used in calculation to mark linked items (temporary use) #define IS_LINKED (1 << 1) ///< Used in calculation to mark linked items (temporary use)
#define IN_EDIT (1 << 2) ///< Item currently edited #define IN_EDIT (1 << 2) ///< Item currently edited
#define IS_MOVED (1 << 3) ///< Item being moved #define IS_MOVING (1 << 3) ///< Item being moved
#define IS_NEW (1 << 4) ///< New item, just created #define IS_NEW (1 << 4) ///< New item, just created
#define IS_RESIZED (1 << 5) ///< Item being resized #define IS_RESIZING (1 << 5) ///< Item being resized
#define IS_DRAGGED (1 << 6) ///< Item being dragged #define IS_DRAGGING (1 << 6) ///< Item being dragged
#define IS_DELETED (1 << 7) #define IS_DELETED (1 << 7)
#define IS_WIRE_IMAGE (1 << 8) ///< Item to be drawn as wireframe while editing #define IS_WIRE_IMAGE (1 << 8) ///< Item to be drawn as wireframe while editing
#define STARTPOINT (1 << 9) ///< When a line is selected, these flags indicate which #define STARTPOINT (1 << 9) ///< When a line is selected, these flags indicate which
@ -167,12 +167,12 @@ public:
inline bool IsModified() const { return m_flags & IS_CHANGED; } inline bool IsModified() const { return m_flags & IS_CHANGED; }
inline bool IsNew() const { return m_flags & IS_NEW; } inline bool IsNew() const { return m_flags & IS_NEW; }
inline bool IsMoving() const { return m_flags & IS_MOVED; } inline bool IsMoving() const { return m_flags & IS_MOVING; }
inline bool IsDragging() const { return m_flags & IS_DRAGGED; } inline bool IsDragging() const { return m_flags & IS_DRAGGING; }
inline bool IsWireImage() const { return m_flags & IS_WIRE_IMAGE; } inline bool IsWireImage() const { return m_flags & IS_WIRE_IMAGE; }
inline bool IsSelected() const { return m_flags & SELECTED; } inline bool IsSelected() const { return m_flags & SELECTED; }
inline bool IsEntered() const { return m_flags & ENTERED; } inline bool IsEntered() const { return m_flags & ENTERED; }
inline bool IsResized() const { return m_flags & IS_RESIZED; } inline bool IsResized() const { return m_flags & IS_RESIZING; }
inline bool IsBrightened() const { return m_flags & BRIGHTENED; } inline bool IsBrightened() const { return m_flags & BRIGHTENED; }
inline void SetWireImage() { SetFlags( IS_WIRE_IMAGE ); } inline void SetWireImage() { SetFlags( IS_WIRE_IMAGE ); }
@ -207,8 +207,8 @@ public:
STATUS_FLAGS GetEditFlags() const STATUS_FLAGS GetEditFlags() const
{ {
constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVED | IS_RESIZED | IS_DRAGGED | constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_RESIZING | IS_DRAGGING
IS_WIRE_IMAGE | STRUCT_DELETED ); | IS_WIRE_IMAGE | STRUCT_DELETED );
return m_flags & mask; return m_flags & mask;
} }

View File

@ -160,7 +160,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( PL_ACTIONS::clearSelection, true );
item = dataItem->GetDrawItems()[0]; item = dataItem->GetDrawItems()[0];
item->SetFlags( IS_NEW | IS_MOVED ); item->SetFlags( IS_NEW | IS_MOVING );
// Select the item but don't inform other tools (to prevent the Properties // Select the item but don't inform other tools (to prevent the Properties
// panel from updating the item before it has been placed) // panel from updating the item before it has been placed)

View File

@ -279,7 +279,7 @@ void PL_EDIT_TOOL::moveItem( DS_DATA_ITEM* aItem, VECTOR2I aDelta )
for( DS_DRAW_ITEM_BASE* item : aItem->GetDrawItems() ) for( DS_DRAW_ITEM_BASE* item : aItem->GetDrawItems() )
{ {
getView()->Update( item ); getView()->Update( item );
item->SetFlags( IS_MOVED ); item->SetFlags( IS_MOVING );
} }
} }

View File

@ -356,7 +356,7 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
else if( evt->IsDrag( BUT_LEFT ) ) else if( evt->IsDrag( BUT_LEFT ) )
{ {
// Is another tool already moving a new object? Don't allow a drag start // Is another tool already moving a new object? Don't allow a drag start
if( !m_selection.Empty() && m_selection[0]->HasFlag( IS_NEW | IS_MOVED ) ) if( !m_selection.Empty() && m_selection[0]->HasFlag( IS_NEW | IS_MOVING ) )
{ {
evt->SetPassEvent(); evt->SetPassEvent();
continue; continue;

View File

@ -1033,8 +1033,8 @@ wxString TRACK::ShowState( int stateBits )
if( stateBits & IN_EDIT ) if( stateBits & IN_EDIT )
ret << wxT( " | IN_EDIT" ); ret << wxT( " | IN_EDIT" );
if( stateBits & IS_DRAGGED ) if( stateBits & IS_DRAGGING )
ret << wxT( " | IS_DRAGGED" ); ret << wxT( " | IS_DRAGGING" );
if( stateBits & DO_NOT_DRAW ) if( stateBits & DO_NOT_DRAW )
ret << wxT( " | DO_NOT_DRAW" ); ret << wxT( " | DO_NOT_DRAW" );