Fix 100s of usages of GetFlags() which conflated != 0 with being edited.

While this was true long ago, many flags have been added since which
have nothing to do with editing (HIGHLIGHTED, BEGIN_ONPAD, etc.)
This commit is contained in:
Jeff Young 2019-04-22 09:58:06 +01:00
parent 64ba866146
commit a461eae8b9
44 changed files with 176 additions and 183 deletions

View File

@ -1181,7 +1181,7 @@ bool EDA_DRAW_FRAME::isBusy() const
if( !screen )
return false;
return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
return ( screen->GetCurItem() && screen->GetCurItem()->GetEditFlags() )
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
}

View File

@ -1537,7 +1537,7 @@ bool EDA_DRAW_FRAME::isBusy() const
if( !screen )
return false;
return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
return ( screen->GetCurItem() && screen->GetCurItem()->GetEditFlags() )
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
}

View File

@ -1170,7 +1170,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
// If we have an item already selected, or we are using a tool,
// we won't use the disambiguation menu so process the click immediately
if( ( item && item->GetFlags() ) || GetParent()->GetToolId() != ID_NO_TOOL_SELECTED )
if( ( item && item->GetEditFlags() ) || GetParent()->GetToolId() != ID_NO_TOOL_SELECTED )
GetParent()->OnLeftClick( &DC, m_CursorClickPos );
else
{

View File

@ -696,7 +696,8 @@ void SCH_EDIT_FRAME::OnAutoplaceFields( wxCommandEvent& aEvent )
*aEvent.GetClientObject() );
item = LocateItem( data.GetPosition(), SCH_COLLECTOR::MovableItems, aEvent.GetInt() );
screen->SetCurItem( NULL );
if( !item || item->GetFlags() )
if( !item || item->GetEditFlags() )
return;
}

View File

@ -434,7 +434,7 @@ void SCH_EDIT_FRAME::copyBlockItems( PICKED_ITEMS_LIST& aItemsList, const wxPoin
/* Make a copy of the original picked item. */
SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
copy->SetParent( NULL );
copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
copy->SetFlags( UR_TRANSIENT );
copy->Move( -center );
ITEM_PICKER item( copy, UR_NEW );

View File

@ -40,7 +40,7 @@ void SCH_EDIT_FRAME::GetSchematicConnections( std::vector< wxPoint >& aConnectio
for( SCH_ITEM* item = GetScreen()->GetDrawItems(); item; item = item->Next() )
{
// Avoid items that are changing
if( !( item->GetFlags() & ( IS_DRAGGED | IS_MOVED | IS_DELETED ) ) )
if( !( item->GetEditFlags() & ( IS_DRAGGED | IS_MOVED | IS_DELETED ) ) )
item->GetConnectionPoints( aConnections );
}
@ -87,7 +87,7 @@ bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd, bool
next_item = item->Next();
// Don't remove wires that are already deleted or are currently being dragged
if( item->GetFlags() & ( STRUCT_DELETED | IS_DRAGGED | IS_MOVED | SKIP_STRUCT ) )
if( item->GetEditFlags() & ( STRUCT_DELETED | IS_DRAGGED | IS_MOVED | SKIP_STRUCT ) )
continue;
if( item->Type() != SCH_LINE_T || item->GetLayer() != LAYER_WIRE )
@ -155,7 +155,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( bool aUndo, SCH_SCREEN* aScreen )
&& ( item->Type() != SCH_NO_CONNECT_T ) )
continue;
if( item->GetFlags() & STRUCT_DELETED )
if( item->GetEditFlags() & STRUCT_DELETED )
continue;
// Remove unneeded junctions
@ -176,7 +176,8 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( bool aUndo, SCH_SCREEN* aScreen )
for( secondItem = item->Next(); secondItem; secondItem = secondItem->Next() )
{
if( item->Type() != secondItem->Type() || ( secondItem->GetFlags() & STRUCT_DELETED ) )
if( item->Type() != secondItem->Type()
|| ( secondItem->GetEditFlags() & STRUCT_DELETED ) )
continue;
// Merge overlapping lines
@ -226,7 +227,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( bool aUndo, SCH_SCREEN* aScreen )
{
secondItem = item->Next();
if( item->GetFlags() & STRUCT_DELETED )
if( item->GetEditFlags() & STRUCT_DELETED )
RemoveFromScreen( item, aScreen );
}
@ -382,7 +383,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
SCH_LINE* firstLine = dynamic_cast<SCH_LINE*>( item );
if( !firstLine || !firstLine->IsEndPoint( aJunction->GetPosition() )
|| ( firstLine->GetFlags() & STRUCT_DELETED ) )
|| ( firstLine->GetEditFlags() & STRUCT_DELETED ) )
continue;
for( SCH_ITEM* secondItem = item->Next(); secondItem; secondItem = secondItem->Next() )
@ -390,7 +391,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
SCH_LINE* secondLine = dynamic_cast<SCH_LINE*>( secondItem );
if( !secondLine || !secondLine->IsEndPoint( aJunction->GetPosition() )
|| ( secondItem->GetFlags() & STRUCT_DELETED )
|| ( secondItem->GetEditFlags() & STRUCT_DELETED )
|| !secondLine->IsParallel( firstLine ) )
continue;
@ -422,7 +423,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
{
nextitem = item->Next();
if( item->GetFlags() & STRUCT_DELETED )
if( item->GetEditFlags() & STRUCT_DELETED )
RemoveFromScreen( item );
}
}

View File

@ -69,7 +69,7 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, c
return;
/* Put old item in undo list if it is not currently in edit */
if( BusEntry->GetFlags() == 0 )
if( BusEntry->GetEditFlags() == 0 )
SaveCopyInUndoList( BusEntry, UR_CHANGED );
s_LastShape = entry_shape == '/' ? '/' : '\\';

View File

@ -289,7 +289,7 @@ bool SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KE
SCH_SCREEN* screen = GetScreen();
bool hk_handled;
if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
if( screen->GetCurItem() && screen->GetCurItem()->GetEditFlags() )
hk_handled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
else
hk_handled = OnHotKey( aDC, aHotKey, aPosition, NULL );
@ -328,7 +328,7 @@ bool LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KE
{
SCH_SCREEN* screen = GetScreen();
if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
if( screen->GetCurItem() && screen->GetCurItem()->GetEditFlags() )
eventHandled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
else
eventHandled = OnHotKey( aDC, aHotKey, aPosition, NULL );

View File

@ -393,8 +393,11 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
// save old cmp in undo list if not already in edit, or moving ...
// or the component to be edited is part of a block
if( m_cmp->GetFlags() == 0 || GetParent()->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
if( m_cmp->GetEditFlags() == 0
|| GetParent()->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{
GetParent()->SaveCopyInUndoList( m_cmp, UR_CHANGED );
}
// Save current flags which could be modified by next change settings
STATUS_FLAGS flags = m_cmp->GetFlags();

View File

@ -301,9 +301,11 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
/* save old text in undo list if not already in edit */
/* or the label to be edited is part of a block */
if( m_CurrentText->GetFlags() == 0 ||
m_Parent->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
if( m_CurrentText->GetEditFlags() == 0
|| m_Parent->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{
m_Parent->SaveCopyInUndoList( m_CurrentText, UR_CHANGED );
}
m_Parent->GetCanvas()->Refresh();

View File

@ -74,7 +74,7 @@ SCH_BITMAP* SCH_EDIT_FRAME::CreateNewImage()
void SCH_EDIT_FRAME::RotateImage( SCH_BITMAP* aItem )
{
if( aItem->GetFlags( ) == 0 )
if( aItem->GetEditFlags( ) == 0 )
SaveCopyInUndoList( aItem, UR_ROTATED, false, aItem->GetPosition() );
aItem->Rotate( aItem->GetPosition() );
@ -86,7 +86,7 @@ void SCH_EDIT_FRAME::RotateImage( SCH_BITMAP* aItem )
void SCH_EDIT_FRAME::MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis )
{
if( aItem->GetFlags( ) == 0 )
if( aItem->GetEditFlags( ) == 0 )
SaveCopyInUndoList( aItem, UR_CHANGED );
if( Is_X_axis )
@ -107,14 +107,9 @@ bool SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem )
if( dlg.ShowModal() != wxID_OK )
return false;
// save old image in undo list if not already in edit
// or the image to be edited is part of a block
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aItem->GetFlags() & mask ) == 0
|| GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{
// save old image in undo list if not already in edit or the image to be edited is part of a block
if( aItem->GetEditFlags() == 0 || GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
SaveCopyInUndoList( aItem, UR_CHANGED );
}
dlg.TransfertToImage( aItem->GetImage() );

View File

@ -55,8 +55,7 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
wxT( "Invalid schematic field parent item." ) );
// Save old component in undo list if not already in edit, or moving.
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aField->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( component, UR_CHANGED );
// Don't use GetText() here. If the field is the reference designator and it's parent
@ -101,8 +100,7 @@ void SCH_EDIT_FRAME::RotateField( SCH_FIELD* aField )
SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
// Save old component in undo list if not already in edit, or moving.
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aField->GetFlags() & mask ) == 0 )
if( aField->GetEditFlags() == 0 )
SaveCopyInUndoList( component, UR_CHANGED );
if( aField->GetTextAngle() == TEXT_ANGLE_HORIZ )

View File

@ -55,7 +55,7 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* aTextItem )
int orient = ( aTextItem->GetLabelSpinStyle() + 1 ) & 3;
// Save current text orientation in undo list if is not already in edit.
if( aTextItem->GetFlags() == 0 )
if( aTextItem->GetEditFlags() == 0 )
SaveCopyInUndoList( aTextItem, UR_CHANGED );
aTextItem->SetLabelSpinStyle( orient );
@ -249,7 +249,7 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
PICKED_ITEMS_LIST pickList;
ITEM_PICKER picker( text, UR_CHANGED );
if( text->GetFlags() )
if( text->GetEditFlags() )
{
// text is being edited, save initial text for undo command
picker.SetLink( GetUndoItem() );

View File

@ -215,14 +215,14 @@ void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation )
GetCanvas()->MoveCursorToCrossHair();
if( item->GetFlags() == 0 )
if( item->GetEditFlags() == 0 )
SetUndoItem( item );
component->SetOrientation( aOrientation );
m_canvas->CrossHairOn( );
if( item->GetFlags() == 0 )
if( item->GetEditFlags() == 0 )
{
AddItemToScreen( item );
SchematicCleanUp();
@ -232,7 +232,7 @@ void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation )
RefreshItem( item );
if( item->GetFlags() == 0 )
if( item->GetEditFlags() == 0 )
OnModify();
}
@ -262,7 +262,7 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
STATUS_FLAGS flags = component->GetFlags();
if( !flags ) // No command in progress: save in undo list
if( !component->GetEditFlags() ) // No command in progress: save in undo list
SaveCopyInUndoList( component, UR_CHANGED );
/* Update the unit number. */

View File

@ -423,7 +423,7 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
SCH_SCREEN* screen = GetScreen();
// itemInEdit == false means no item currently edited. We can ask for editing a new item
bool itemInEdit = screen->GetCurItem() && screen->GetCurItem()->GetFlags();
bool itemInEdit = screen->GetCurItem() && screen->GetCurItem()->GetEditFlags();
// blocInProgress == false means no block in progress.
// Because a drag command uses a drag block, false means also no drag in progress

View File

@ -517,7 +517,7 @@ void LIB_EDIT_FRAME::copySelectedItems()
// Do not clear the 'selected' flag. It is required to have items drawn when they are pasted.
LIB_ITEM* copy = (LIB_ITEM*) item.Clone();
copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
copy->SetFlags( UR_TRANSIENT );
ITEM_PICKER picker( copy, UR_NEW );
m_clipboard.PushItem( picker );
}

View File

@ -41,7 +41,7 @@ void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoT
// Clear current flags (which can be temporary set by a current edit command).
CopyItem->ClearStatus();
CopyItem->SetFlags( CopyItem->GetFlags() | UR_TRANSIENT );
CopyItem->SetFlags( UR_TRANSIENT );
ITEM_PICKER wrapper( CopyItem, undoType );
lastcmd->PushItem( wrapper );
@ -63,13 +63,13 @@ void LIB_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
delete redoCommand;
LIB_PART* part = (LIB_PART*) redoWrapper.GetItem();
wxCHECK( part, /* void */ );
part->SetFlags( part->GetFlags() & ~UR_TRANSIENT );
part->ClearFlags( UR_TRANSIENT );
UNDO_REDO_T undoRedoType = redoWrapper.GetStatus();
// Store the current part in the undo buffer
PICKED_ITEMS_LIST* undoCommand = new PICKED_ITEMS_LIST();
LIB_PART* oldPart = GetCurPart();
oldPart->SetFlags( oldPart->GetFlags() | UR_TRANSIENT );
oldPart->SetFlags( UR_TRANSIENT );
ITEM_PICKER undoWrapper( oldPart, undoRedoType );
undoCommand->PushItem( undoWrapper );
GetScreen()->PushCommandToUndoList( undoCommand );
@ -112,13 +112,13 @@ void LIB_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event )
delete undoCommand;
LIB_PART* part = (LIB_PART*) undoWrapper.GetItem();
wxCHECK( part, /* void */ );
part->SetFlags( part->GetFlags() & ~UR_TRANSIENT );
part->ClearFlags( UR_TRANSIENT );
UNDO_REDO_T undoRedoType = undoWrapper.GetStatus();
// Store the current part in the redo buffer
PICKED_ITEMS_LIST* redoCommand = new PICKED_ITEMS_LIST();
LIB_PART* oldPart = GetCurPart();
oldPart->SetFlags( oldPart->GetFlags() | UR_TRANSIENT );
oldPart->SetFlags( UR_TRANSIENT );
ITEM_PICKER redoWrapper( oldPart, undoRedoType );
redoCommand->PushItem( redoWrapper );
GetScreen()->PushCommandToRedoList( redoCommand );

View File

@ -201,7 +201,7 @@ void LIB_EDIT_FRAME::PlacePin()
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
{
if( pin == cur_pin || newpos != pin->GetPosition() || pin->GetFlags() )
if( pin == cur_pin || newpos != pin->GetPosition() || pin->GetEditFlags() )
continue;
// test for same body style
@ -260,7 +260,7 @@ void LIB_EDIT_FRAME::PlacePin()
// Put linked pins in new position, and clear flags
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
{
if( pin->GetFlags() == 0 )
if( pin->GetEditFlags() == 0 )
continue;
pin->Move( cur_pin->GetPosition() );

View File

@ -49,7 +49,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
LIB_PART* part = GetCurPart();
// Exit if no library entry is selected or a command is in progress.
if( !part || ( GetDrawItem() && GetDrawItem()->GetFlags() ) )
if( !part || ( GetDrawItem() && GetDrawItem()->GetEditFlags() ) )
return;
PROJECT& prj = Prj();

View File

@ -45,7 +45,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
SetRepeatItem( NULL );
// item_flags != 0 means a current item in edit
if( item && ( item->GetFlags() & ~HIGHLIGHTED ) )
if( item && item->GetEditFlags() )
{
switch( item->Type() )
{
@ -164,10 +164,10 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
if( item == NULL || item->GetEditFlags() == 0 )
item = LocateAndShowItem( aPosition, SCH_COLLECTOR::DoubleClickItems );
if( ( item == NULL ) || ( item->GetFlags() != 0 ) )
if( item == NULL || item->GetEditFlags() != 0 )
break;
switch( item->Type() )
@ -181,8 +181,8 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
EditComponent( (SCH_COMPONENT*) item );
GetCanvas()->MoveCursorToCrossHair();
if( item->GetFlags() == 0 )
GetScreen()->SetCurItem( NULL );
if( item->GetEditFlags() == 0 )
GetScreen()->SetCurItem( nullptr );
GetCanvas()->Refresh();
break;

View File

@ -144,7 +144,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
}
// Try to locate items at cursor position.
if( (item == NULL) || (item->GetFlags() == 0) )
if( item == NULL || item->GetEditFlags() == 0 )
{
bool actionCancelled = false;
item = LocateAndShowItem( aPosition, SCH_COLLECTOR::AllItemsButPins, 0, &actionCancelled );
@ -157,7 +157,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
// If a command is in progress: add "cancel" and "end tool" menu
if( GetToolId() != ID_NO_TOOL_SELECTED )
{
if( item && item->GetFlags() )
if( item && item->GetEditFlags() )
{
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
@ -190,7 +190,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
}
else
{
if( item && item->GetFlags() )
if( item && item->GetEditFlags() )
{
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
@ -317,7 +317,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
{
wxString msg, name;
if( !Field->GetFlags() )
if( !Field->GetEditFlags() )
{
switch( Field->GetId() )
{
@ -327,8 +327,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
default: name = _( "Move Field" ); break;
}
msg = AddHotkeyName( name, g_Schematic_Hotkeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM );
msg = AddHotkeyName( name, g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
}
@ -383,7 +382,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB
wxString msg;
if( !Component->GetFlags() )
if( !Component->GetEditFlags() )
{
msg.Printf( _( "Move %s" ), Component->GetField( REFERENCE )->GetText() );
msg = AddHotkeyName( msg, g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
@ -411,7 +410,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB
AddMenusForEditComponent( PopMenu, Component, aLibs );
if( !Component->GetFlags() )
if( !Component->GetEditFlags() )
{
msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hotkeys_Descr,
HK_DUPLICATE_ITEM );
@ -508,7 +507,7 @@ void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL
_( "Unit" ), KiBitmap( component_select_unit_xpm ) );
}
if( !Component->GetFlags() )
if( !Component->GetEditFlags() )
{
msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hotkeys_Descr,
HK_EDIT_COMPONENT_WITH_LIBEDIT );
@ -526,7 +525,7 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
wxMenu* menu_change_type = new wxMenu;
wxString msg;
if( !GLabel->GetFlags() )
if( !GLabel->GetEditFlags() )
{
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM );
@ -563,7 +562,7 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
wxMenu* menu_change_type = new wxMenu;
wxString msg;
if( !HLabel->GetFlags() )
if( !HLabel->GetEditFlags() )
{
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM );
@ -599,7 +598,7 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
wxMenu* menu_change_type = new wxMenu;
wxString msg;
if( !Label->GetFlags() )
if( !Label->GetEditFlags() )
{
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
@ -633,7 +632,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
wxString msg;
wxMenu* menu_change_type = new wxMenu;
if( !Text->GetFlags() )
if( !Text->GetEditFlags() )
{
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
@ -848,7 +847,7 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
{
wxString msg;
if( !Sheet->GetFlags() )
if( !Sheet->GetEditFlags() )
{
AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
KiBitmap( enter_sheet_xpm ) );
@ -884,7 +883,7 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
_( "Orientation" ), KiBitmap( orient_xpm ) );
}
if( Sheet->GetFlags() )
if( Sheet->GetEditFlags() )
{
AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place" ), KiBitmap( checked_ok_xpm ) );
}
@ -914,7 +913,7 @@ void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
{
wxString msg;
if( !PinSheet->GetFlags() )
if( !PinSheet->GetEditFlags() )
{
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
@ -922,7 +921,7 @@ void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit..." ), KiBitmap( edit_xpm ) );
if( !PinSheet->GetFlags() )
if( !PinSheet->GetEditFlags() )
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete" ), KiBitmap( delete_xpm ) );
}
@ -989,7 +988,7 @@ void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
{
wxString msg;
if( aBitmap->GetFlags() == 0 )
if( aBitmap->GetEditFlags() == 0 )
{
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM );
@ -1007,7 +1006,7 @@ void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
msg = AddHotkeyName( _( "Edit Image..." ), g_Schematic_Hotkeys_Descr, HK_EDIT );
AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
if( aBitmap->GetFlags() == 0 )
if( aBitmap->GetEditFlags() == 0 )
{
aPopMenu->AppendSeparator();
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hotkeys_Descr, HK_DELETE );
@ -1020,7 +1019,7 @@ void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE* aBusEntry )
{
wxString msg;
if( !aBusEntry->GetFlags() )
if( !aBusEntry->GetEditFlags() )
{
msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hotkeys_Descr,
HK_MOVE_COMPONENT_OR_ITEM );

View File

@ -167,7 +167,7 @@ void SCH_EDIT_FRAME::DeleteItemsInList( PICKED_ITEMS_LIST& aItemsList, bool aApp
{
SCH_ITEM* item = static_cast<SCH_ITEM*>( aItemsList.GetPickedItem( ii ) );
if( item->GetFlags() & STRUCT_DELETED )
if( item->GetEditFlags() & STRUCT_DELETED )
continue;
DeleteItem( item, aAppend );
@ -181,7 +181,7 @@ void SCH_EDIT_FRAME::DeleteItemsInList( PICKED_ITEMS_LIST& aItemsList, bool aApp
void SCH_EDIT_FRAME::DeleteItem( SCH_ITEM* aItem, bool aAppend )
{
wxCHECK_RET( aItem != NULL, wxT( "Cannot delete invalid item." ) );
wxCHECK_RET( !( aItem->GetFlags() & STRUCT_DELETED ),
wxCHECK_RET( !( aItem->GetEditFlags() & STRUCT_DELETED ),
wxT( "Cannot delete item that is already deleted." ) );
// Here, aItem is not null.

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.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
@ -22,10 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file sch_edit_frame.cpp
*/
#include <fctsys.h>
#include <kiface_i.h>
#include <pgm_base.h>
@ -70,10 +66,8 @@
#include <wx/display.h>
#include <build_version.h>
#include <wildcards_and_files_ext.h>
#include <connection_graph.h>
#include <dialogs/dialog_fields_editor_global.h>
#include <sch_view.h>
#include <sch_painter.h>
@ -1136,12 +1130,12 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
item = LocateAndShowItem( data->GetPosition(), filterList, event.GetInt() );
// Exit if no item found at the current location or the item is already being edited.
if( (item == NULL) || (item->GetFlags() != 0) )
if( item == NULL || item->GetEditFlags() != 0 )
return;
}
if( !item || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) )
if( !item || item->GetEditFlags() != 0 || item->Type() != SCH_COMPONENT_T )
{
wxMessageBox( _( "Error: not a symbol or no symbol." ) );
return;

View File

@ -347,7 +347,7 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew )
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
{
if( item->GetFlags() & STRUCT_DELETED )
if( item->GetEditFlags() & STRUCT_DELETED )
continue;
if( aNew && ( item->Type() == SCH_JUNCTION_T ) && ( item->HitTest( aPosition ) ) )

View File

@ -326,7 +326,7 @@ void SCH_EDIT_FRAME::OnDuplicateItem( wxCommandEvent& event )
{
SCH_ITEM* curr_item = GetScreen()->GetCurItem();
if( !curr_item || curr_item->GetFlags() )
if( !curr_item || curr_item->GetEditFlags() )
return;
GetCanvas()->GetViewControls()->SetCursorPosition( GetCrossHairPosition() );
@ -385,7 +385,7 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent )
aEvent.GetInt() );
// Exit if no item found at the current location or the item is already being edited.
if( (item == NULL) || (item->GetFlags() != 0) )
if( item == NULL || item->GetEditFlags() != 0 )
return;
}
@ -756,7 +756,7 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
aEvent.GetInt() );
// Exit if no item found at the current location or the item is already being edited.
if( (item == NULL) || (item->GetFlags() != 0) )
if( item == NULL || item->GetEditFlags() != 0 )
return;
}
@ -845,8 +845,8 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
m_toolManager->RunAction( SCH_ACTIONS::refreshPreview, true );
}
if( item->GetFlags() == 0 )
screen->SetCurItem( NULL );
if( item->GetEditFlags() == 0 )
screen->SetCurItem( nullptr );
}
@ -901,7 +901,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
item = LocateAndShowItem( data->GetPosition(), filterListAux, aEvent.GetInt() );
// Exit if no item found at the current location or the item is already being edited.
if( (item == NULL) || (item->GetFlags() != 0) )
if( item == NULL || item->GetEditFlags() != 0 )
return;
}
@ -1007,8 +1007,8 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
RefreshItem( item );
if( item->GetFlags() == 0 )
screen->SetCurItem( NULL );
if( item->GetEditFlags() == 0 )
screen->SetCurItem( nullptr );
}
@ -1040,7 +1040,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
aEvent.GetInt() );
// Exit if no item found at the current location or the item is already being edited.
if( (item == NULL) || (item->GetFlags() != 0) )
if( item == NULL || item->GetEditFlags() != 0 )
return;
// When a junction or a node is found, a BLOCK_DRAG is better
@ -1153,7 +1153,7 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
aEvent.GetInt() );
// Exit if no item found at the current location or the item is already being edited.
if( (item == NULL) || (item->GetFlags() != 0) )
if( item == NULL || item->GetEditFlags() != 0 )
return;
}
@ -1224,8 +1224,8 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
m_toolManager->RunAction( SCH_ACTIONS::refreshPreview, true );
}
if( item->GetFlags() == 0 )
screen->SetCurItem( NULL );
if( item->GetEditFlags() == 0 )
screen->SetCurItem( nullptr );
}
@ -1246,7 +1246,7 @@ void SCH_EDIT_FRAME::OnUnfoldBusHotkey( wxCommandEvent& aEvent )
aEvent.GetInt() );
// Exit if no item found at the current location or the item is already being edited.
if( (item == NULL) || (item->GetFlags() != 0) )
if( item == NULL || item->GetEditFlags() != 0 )
return;
}

View File

@ -310,7 +310,7 @@ void SCH_EDIT_FRAME::RotateHierarchicalSheet( SCH_SHEET* aSheet, bool aRotCCW )
return;
// Save old sheet in undo list if not already in edit, or moving.
if( aSheet->GetFlags() == 0 )
if( aSheet->GetEditFlags() == 0 )
SaveCopyInUndoList( aSheet, UR_CHANGED );
// Rotate the sheet on itself. Sheets do not have a anchor point.
@ -341,7 +341,7 @@ void SCH_EDIT_FRAME::MirrorSheet( SCH_SHEET* aSheet, bool aFromXaxis )
return;
// Save old sheet in undo list if not already in edit, or moving.
if( aSheet->GetFlags() == 0 )
if( aSheet->GetEditFlags() == 0 )
SaveCopyInUndoList( aSheet, UR_CHANGED );
// Mirror the sheet on itself. Sheets do not have a anchor point.

View File

@ -40,7 +40,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
wxString msg;
bool BlockActive = !GetScreen()->m_BlockLocate.IsIdle();
bool busy = currItem && currItem->GetFlags();
bool busy = currItem && currItem->GetEditFlags();
// Do not initiate a start block validation on menu.
m_canvas->SetCanStartBlock( -1 );
@ -49,7 +49,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
if( !busy )
{
currItem = Locate( aPosition, CURSEUR_OFF_GRILLE );
busy = currItem && currItem->GetFlags();
busy = currItem && currItem->GetEditFlags();
}
// If command in progress, end command.

View File

@ -143,6 +143,7 @@ typedef const INSPECTOR_FUNC& INSPECTOR; /// std::function passed to nested u
#define IS_DANGLING (1 << 29) ///< indicates a pin is dangling
// WARNING: if you add flags, you'll probably need to adjust the mask in GetEditFlags()
#define EDA_ITEM_ALL_FLAGS -1
@ -259,6 +260,14 @@ public:
void ClearFlags( STATUS_FLAGS aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; }
STATUS_FLAGS GetFlags() const { return m_Flags; }
STATUS_FLAGS GetEditFlags() const
{
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED |
STARTPOINT | ENDPOINT | IS_DANGLING |
BEGIN_ONPAD | END_ONPAD | DP_COUPLED );
return m_Flags & mask;
}
/**
* Function IsType
* Checks whether the item is one of the listed types

View File

@ -736,8 +736,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
m_footprint->CalculateBoundingBox();
// This is a simple edit, we must create an undo entry
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( m_footprint->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
commit.Push( _( "Modify module properties" ) );
SetReturnCode( PRM_EDITOR_EDIT_OK );

View File

@ -360,8 +360,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
// If no other command in progress, prepare undo command
// (for a command in progress, will be made later, at the completion of command)
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
bool pushCommit = ( m_item->GetFlags() & mask ) == 0;
bool pushCommit = ( m_item->GetEditFlags() == 0 );
/* set flag in edit to force undo/redo/abort proper operation,
* and avoid new calls to SaveCopyInUndoList for the same text

View File

@ -1089,7 +1089,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
if( GetCurItem()->GetFlags() != 0 )
if( GetCurItem()->GetEditFlags() != 0 )
break;
Delete_Drawings_All_Layer( GetCurItem()->GetLayer() );

View File

@ -248,8 +248,7 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
TextePcb->Draw( m_canvas, DC, GR_XOR );
SetMsgPanel( TextePcb );
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( TextePcb->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
if( TextePcb->GetEditFlags() == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->GetTextPos() );
else // set flag edit, to show it was a complex command
TextePcb->SetFlags( IN_EDIT );
@ -273,8 +272,7 @@ void PCB_EDIT_FRAME::FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC )
aTextePcb->Draw( m_canvas, aDC, GR_XOR );
SetMsgPanel( aTextePcb );
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( ( aTextePcb->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
if( aTextePcb->GetEditFlags() == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( aTextePcb, UR_FLIPPED, aTextePcb->GetTextPos() );
else // set edit flag, for the current command
aTextePcb->SetFlags( IN_EDIT );

View File

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

View File

@ -117,7 +117,6 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
if( Segment == NULL )
return;
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
if( Segment->IsNew() ) // Trace in progress.
{
// Delete current segment.
@ -127,7 +126,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
displ_opts->m_DisplayDrawItemsFill = tmp;
SetCurItem( NULL );
}
else if( ( Segment->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
else if( Segment->GetEditFlags() == 0 ) // i.e. not edited, or moved
{
Segment->Draw( m_canvas, DC, GR_XOR );
Segment->ClearFlags();

View File

@ -102,7 +102,7 @@ void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
MODULE* module = (MODULE*) Text->GetParent();
if( module && module->GetFlags() == 0 && Text->GetFlags() == 0 ) // prepare undo command
if( module && module->GetEditFlags() == 0 && Text->GetEditFlags() == 0 ) // prepare undo command
{
if( IsType( FRAME_PCB ) )
SaveCopyInUndoList( module, UR_CHANGED );
@ -134,8 +134,11 @@ void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* aText )
if( aText->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
{
if( module && module->GetFlags() == 0 && aText->GetFlags() == 0 && IsType( FRAME_PCB ) )
SaveCopyInUndoList( module, UR_CHANGED );
if( module && module->GetEditFlags() == 0 && aText->GetEditFlags() == 0 )
{
if( IsType( FRAME_PCB ) )
SaveCopyInUndoList( module, UR_CHANGED );
}
m_canvas->RefreshDrawingRect( aText->GetBoundingBox() );
aText->DeleteStructure();

View File

@ -53,7 +53,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( GetToolId() == ID_NO_TOOL_SELECTED )
{
if( item && item->GetFlags() ) // Move item command in progress
if( item && item->GetEditFlags() ) // Move item command in progress
{
switch( item->Type() )
{
@ -72,7 +72,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
default:
wxLogDebug( wxT( "WinEDA_ModEditFrame::OnLeftClick err:Struct %d, m_Flag %X" ),
item->Type(), item->GetFlags() );
item->Type(), item->GetEditFlags() );
item->ClearFlags();
}
}
@ -88,7 +88,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
item = GetCurItem();
bool no_item_edited = item == NULL || item->GetFlags() == 0;
bool no_item_edited = item == NULL || item->GetEditFlags() == 0;
switch( GetToolId() )
{
@ -152,8 +152,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
MODULE* module = GetBoard()->m_Modules;
if( module == NULL // No module loaded
|| (module->GetFlags() != 0) )
if( module == NULL || module->GetEditFlags() != 0 )
break;
SaveCopyInUndoList( module, UR_CHANGED );
@ -215,15 +214,13 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
bool blockActive = !GetScreen()->m_BlockLocate.IsIdle();
// Simple location of elements where possible.
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{
if( item == NULL || item->GetEditFlags() == 0 )
SetCurItem( item = ModeditLocateAndDisplay() );
}
// End command in progress.
if( GetToolId() != ID_NO_TOOL_SELECTED )
{
if( item && item->GetFlags() )
if( item && item->GetEditFlags() )
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
else
@ -234,7 +231,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
}
else
{
if( (item && item->GetFlags()) || blockActive )
if( (item && item->GetEditFlags()) || blockActive )
{
if( blockActive ) // Put block commands in list
{
@ -279,7 +276,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
if( item )
{
STATUS_FLAGS flags = item->GetFlags();
STATUS_FLAGS flags = item->GetEditFlags();
switch( item->Type() )
{
case PCB_MODULE_T:
@ -472,12 +469,10 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{
if( item == NULL || item->GetEditFlags() == 0 )
item = ModeditLocateAndDisplay();
}
if( ( item == NULL ) || ( item->GetFlags() != 0 ) )
if( item == NULL || item->GetEditFlags() != 0 )
break;
// Item found

View File

@ -68,7 +68,7 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
if( aHotkeyCode == 0 )
return false;
bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetFlags();
bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetEditFlags();
MODULE* module = NULL;
int evt_type = 0; //Used to post a wxCommandEvent on demand
PCB_SCREEN* screen = GetScreen();
@ -526,7 +526,7 @@ bool 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->GetFlags() == 0);
bool ItemFree = ( !item || item->GetEditFlags() == 0 );
switch( GetToolId() )
{
@ -593,7 +593,7 @@ bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags();
bool itemCurrentlyEdited = item && item->GetEditFlags();
if( itemCurrentlyEdited )
return false;
@ -697,7 +697,7 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
int PCB_EDIT_FRAME::OnHotkeyCopyItem()
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags();
bool itemCurrentlyEdited = item && item->GetEditFlags();
if( itemCurrentlyEdited )
return 0;
@ -728,7 +728,7 @@ int PCB_EDIT_FRAME::OnHotkeyCopyItem()
bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags();
bool itemCurrentlyEdited = item && item->GetEditFlags();
if( itemCurrentlyEdited )
return false;
@ -839,7 +839,7 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC )
{
BOARD_ITEM* item = GetCurItem();
bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
bool itemCurrentlyEdited = item && item->GetFlags();
bool itemCurrentlyEdited = item && item->GetEditFlags();
m_canvas->SetAutoPanRequest( false );
@ -902,7 +902,7 @@ TRACK * PCB_EDIT_FRAME::OnHotkeyBeginRoute( wxDC* aDC )
if( !IsCopperLayer( GetActiveLayer() ) )
return NULL;
bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetFlags();
bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetEditFlags();
// Ensure the track tool is active
if( GetToolId() != ID_TRACK_BUTT && !itemCurrentlyEdited )
@ -945,7 +945,7 @@ TRACK * PCB_EDIT_FRAME::OnHotkeyBeginRoute( wxDC* aDC )
bool PCB_EDIT_FRAME::OnHotkeyFlipItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags();
bool itemCurrentlyEdited = item && item->GetEditFlags();
int evt_type = 0; // Used to post a wxCommandEvent on demand
wxASSERT( aIdCommand == HK_FLIP_ITEM );
@ -997,7 +997,7 @@ bool PCB_EDIT_FRAME::OnHotkeyFlipItem( int aIdCommand )
bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags();
bool itemCurrentlyEdited = item && item->GetEditFlags();
int evt_type = 0; // Used to post a wxCommandEvent on demand
wxASSERT( aIdCommand == HK_ROTATE_ITEM );
@ -1052,7 +1052,7 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
bool PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem( int aIdCommand )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags();
bool itemCurrentlyEdited = item && item->GetEditFlags();
if( itemCurrentlyEdited )
return false;

View File

@ -61,7 +61,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
BOARD_ITEM* item = GetCurItem();
bool ItemFree = (item == 0) || (item->GetFlags() == 0);
bool ItemFree = ( !item || item->GetEditFlags() == 0 );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
@ -209,7 +209,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
BOARD_ITEM* FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey( bool aFailIfCurrentlyEdited )
{
BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags();
bool itemCurrentlyEdited = item && item->GetEditFlags();
bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
if( aFailIfCurrentlyEdited )

View File

@ -60,11 +60,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 || ( curr_item && curr_item->GetFlags() ) )
if( no_tool || ( curr_item && curr_item->GetEditFlags() ) )
{
m_canvas->SetAutoPanRequest( false );
if( curr_item && curr_item->GetFlags() ) // Command in progress
if( curr_item && curr_item->GetEditFlags() ) // Command in progress
{
m_canvas->SetIgnoreMouseEvents( true );
m_canvas->CrossHairOff( aDC );
@ -146,7 +146,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
DisplayError( this,
wxString::Format(
"PCB_EDIT_FRAME::OnLeftClick() err: curr_item type %d m_Flags != 0 (%X)",
curr_item->Type(), curr_item->GetFlags() ) );
curr_item->Type(), curr_item->GetEditFlags() ) );
exit = true;
break;
}
@ -229,7 +229,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_TARGET_BUTT:
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
{
SetCurItem( (BOARD_ITEM*) CreateTarget( aDC ) );
m_canvas->MoveCursorToCrossHair();
@ -257,7 +257,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
if( GetToolId() == ID_PCB_ARC_BUTT )
shape = S_ARC;
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
{
curr_item = (BOARD_ITEM*) Begin_DrawSegment( NULL, shape, aDC );
SetCurItem( curr_item );
@ -281,7 +281,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
}
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
{
curr_item = (BOARD_ITEM*) Begin_Route( NULL, aDC );
SetCurItem( curr_item );
@ -309,7 +309,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( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
{
if( Begin_Zone( aDC ) )
{
@ -340,7 +340,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
}
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
{
SetCurItem( CreateTextePcb( aDC ) );
m_canvas->MoveCursorToCrossHair();
@ -359,7 +359,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_MODULE_BUTT:
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
{
m_canvas->MoveCursorToCrossHair();
MODULE* module = SelectFootprintFromLibTree();
@ -397,7 +397,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
}
if( !curr_item || !curr_item->GetFlags() )
if( !curr_item || !curr_item->GetEditFlags() )
{
curr_item = (BOARD_ITEM*) EditDimension( NULL, aDC );
SetCurItem( curr_item );
@ -417,11 +417,11 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break;
case ID_PCB_DELETE_ITEM_BUTT:
if( !curr_item || !curr_item->GetFlags() )
if( !curr_item || !curr_item->GetEditFlags() )
{
curr_item = PcbGeneralLocateAndDisplay();
if( curr_item && (curr_item->GetFlags() == 0) )
if( curr_item && curr_item->GetEditFlags() == 0 )
{
RemoveStruct( curr_item, aDC );
SetCurItem( curr_item = NULL );
@ -471,12 +471,10 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
switch( GetToolId() )
{
case ID_NO_TOOL_SELECTED:
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
{
if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
curr_item = PcbGeneralLocateAndDisplay();
}
if( (curr_item == NULL) || (curr_item->GetFlags() != 0) )
if( curr_item == NULL || curr_item->GetEditFlags() != 0 )
break;
SendMessageToEESCHEMA( curr_item );
@ -493,7 +491,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
if( End_Route( (TRACK*) curr_item, aDC ) )
m_canvas->SetAutoPanRequest( false );
}
else if( curr_item->GetFlags() == 0 )
else if( curr_item->GetEditFlags() == 0 )
{
Edit_TrackSegm_Width( aDC, (TRACK*) curr_item );
}
@ -515,7 +513,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
break;
case PCB_ZONE_AREA_T:
if( curr_item->GetFlags() )
if( curr_item->GetEditFlags() )
break;
OnEditItemRequest( aDC, curr_item );

View File

@ -77,7 +77,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
if( GetToolId() != ID_NO_TOOL_SELECTED && GetToolId() != ID_ZOOM_SELECTION )
{
if( item && item->GetFlags() )
if( item && item->GetEditFlags() )
{
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
@ -92,7 +92,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
}
else
{
if( item && item->GetFlags() )
if( item && item->GetEditFlags() )
{
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), KiBitmap( cancel_xpm ) );
@ -115,7 +115,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->GetFlags() == 0) )
if( !item || item->GetEditFlags() == 0 )
{
// show the "item selector" menu if no item selected or
// if there is a selected item but the mouse has moved
@ -133,7 +133,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
}
item = GetCurItem();
flags = item ? item->GetFlags() : 0;
flags = item ? item->GetEditFlags() : 0;
// Add the context menu, which depends on the picked item:
if( item )
@ -433,7 +433,7 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
SetCurrentNetClass( Track->GetNetClassName() );
int flags = Track->GetFlags();
int flags = Track->GetEditFlags();
if( flags == 0 )
{
@ -623,14 +623,14 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
wxString msg;
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
if( edge_zone->GetFlags() == IS_DRAGGED )
if( edge_zone->GetEditFlags() == IS_DRAGGED )
{
AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT,
_( "Place Edge Outline" ), KiBitmap( checked_ok_xpm ) );
}
else if( edge_zone->GetFlags() )
else if( edge_zone->GetEditFlags() )
{
if( (edge_zone->GetFlags() & IN_EDIT ) )
if( (edge_zone->GetEditFlags() & IN_EDIT ) )
AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_CORNER,
_( "Place Corner" ), KiBitmap( checked_ok_xpm ) );
else
@ -716,7 +716,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->GetFlags();
int flags = aModule->GetEditFlags();
wxString msg;
sub_menu_footprint = new wxMenu;
@ -804,7 +804,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->GetFlags();
int flags = FpText->GetEditFlags();
wxString msg = FpText->GetSelectMenuText( m_UserUnits );
@ -863,7 +863,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->GetFlags();
int flags = Pad->GetEditFlags();
if( flags ) // Currently in edit, no others commands possible
return;
@ -914,7 +914,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->GetFlags();
int flags = Text->GetEditFlags();
wxString msg = Text->GetSelectMenuText( m_UserUnits );

View File

@ -493,7 +493,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool
DrawSegmentWhileMovingFootprint( m_canvas, DC );
}
if( module->GetFlags() == 0 ) // module not in edit: redraw full screen
if( module->GetEditFlags() == 0 ) // module not in edit: redraw full screen
m_canvas->Refresh();
}
}

View File

@ -164,7 +164,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const
// Areas must be drawn here only if not moved or dragged,
// because these areas are drawn by ManageCursor() in a specific manner
if( ( zone->GetFlags() & (IN_EDIT | IS_DRAGGED | IS_MOVED) ) == 0 )
if( ( zone->GetEditFlags() & (IN_EDIT | IS_DRAGGED | IS_MOVED) ) == 0 )
{
zone->Draw( aPanel, DC, aDrawMode );
zone->DrawFilledArea( aPanel, DC, aDrawMode );

View File

@ -130,10 +130,10 @@ bool DIALOG_TARGET_PROPERTIES::TransferDataFromWindow()
m_Target->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR );
// Save old item in undo list, if is is not currently edited (will be later if so)
bool pushCommit = ( m_Target->GetFlags() == 0 );
bool pushCommit = ( m_Target->GetEditFlags() == 0 );
if( m_Target->GetFlags() != 0 ) // other edit in progress (MOVE, NEW ..)
m_Target->SetFlags( IN_EDIT ); // set flag in edit to force
if( m_Target->GetEditFlags() != 0 ) // other edit in progress (MOVE, NEW ..)
m_Target->SetFlags( IN_EDIT ); // set flag in edit to force
// undo/redo/abort proper operation
m_Target->SetWidth( m_Thickness.GetValue() );
@ -183,7 +183,7 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
}
else // it is an existing item: retrieve initial values of parameters
{
if( ( target->GetFlags() & (IN_EDIT | IS_MOVED) ) )
if( ( target->GetEditFlags() & (IN_EDIT | IS_MOVED) ) )
{
target->SetPosition( s_TargetCopy.GetPosition() );
target->SetWidth( s_TargetCopy.GetWidth() );
@ -245,7 +245,7 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
return;
}
if( aTarget->GetFlags() == IS_MOVED )
if( aTarget->GetEditFlags() == IS_MOVED )
{
SaveCopyInUndoList( aTarget, UR_MOVED,
aTarget->GetPosition() - s_TargetCopy.GetPosition() );
@ -253,7 +253,7 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
return;
}
if( (aTarget->GetFlags() & IN_EDIT) )
if( (aTarget->GetEditFlags() & IN_EDIT) )
{
aTarget->SwapData( &s_TargetCopy );
SaveCopyInUndoList( aTarget, UR_CHANGED );

View File

@ -386,7 +386,7 @@ bool TRACKS_CLEANER::deleteNullSegments()
void TRACKS_CLEANER::removeDuplicatesOfTrack( const TRACK *aSeg, std::set<BOARD_ITEM*>& aToRemove )
{
if( aSeg->GetFlags() & STRUCT_DELETED )
if( aSeg->GetEditFlags() & STRUCT_DELETED )
return;
for( auto seg2 : m_brd->Tracks() )