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:
parent
64ba866146
commit
a461eae8b9
|
@ -1181,7 +1181,7 @@ bool EDA_DRAW_FRAME::isBusy() const
|
||||||
if( !screen )
|
if( !screen )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
|
return ( screen->GetCurItem() && screen->GetCurItem()->GetEditFlags() )
|
||||||
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
|
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1537,7 +1537,7 @@ bool EDA_DRAW_FRAME::isBusy() const
|
||||||
if( !screen )
|
if( !screen )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
|
return ( screen->GetCurItem() && screen->GetCurItem()->GetEditFlags() )
|
||||||
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
|
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1170,7 +1170,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
|
|
||||||
// If we have an item already selected, or we are using a tool,
|
// 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
|
// 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 );
|
GetParent()->OnLeftClick( &DC, m_CursorClickPos );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -696,7 +696,8 @@ void SCH_EDIT_FRAME::OnAutoplaceFields( wxCommandEvent& aEvent )
|
||||||
*aEvent.GetClientObject() );
|
*aEvent.GetClientObject() );
|
||||||
item = LocateItem( data.GetPosition(), SCH_COLLECTOR::MovableItems, aEvent.GetInt() );
|
item = LocateItem( data.GetPosition(), SCH_COLLECTOR::MovableItems, aEvent.GetInt() );
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( NULL );
|
||||||
if( !item || item->GetFlags() )
|
|
||||||
|
if( !item || item->GetEditFlags() )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,7 @@ void SCH_EDIT_FRAME::copyBlockItems( PICKED_ITEMS_LIST& aItemsList, const wxPoin
|
||||||
/* Make a copy of the original picked item. */
|
/* Make a copy of the original picked item. */
|
||||||
SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
|
SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
|
||||||
copy->SetParent( NULL );
|
copy->SetParent( NULL );
|
||||||
copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
|
copy->SetFlags( UR_TRANSIENT );
|
||||||
copy->Move( -center );
|
copy->Move( -center );
|
||||||
ITEM_PICKER item( copy, UR_NEW );
|
ITEM_PICKER item( copy, UR_NEW );
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ void SCH_EDIT_FRAME::GetSchematicConnections( std::vector< wxPoint >& aConnectio
|
||||||
for( SCH_ITEM* item = GetScreen()->GetDrawItems(); item; item = item->Next() )
|
for( SCH_ITEM* item = GetScreen()->GetDrawItems(); item; item = item->Next() )
|
||||||
{
|
{
|
||||||
// Avoid items that are changing
|
// 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 );
|
item->GetConnectionPoints( aConnections );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd, bool
|
||||||
next_item = item->Next();
|
next_item = item->Next();
|
||||||
|
|
||||||
// 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( item->GetFlags() & ( STRUCT_DELETED | IS_DRAGGED | IS_MOVED | SKIP_STRUCT ) )
|
if( item->GetEditFlags() & ( STRUCT_DELETED | IS_DRAGGED | IS_MOVED | SKIP_STRUCT ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( item->Type() != SCH_LINE_T || item->GetLayer() != LAYER_WIRE )
|
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 ) )
|
&& ( item->Type() != SCH_NO_CONNECT_T ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( item->GetFlags() & STRUCT_DELETED )
|
if( item->GetEditFlags() & STRUCT_DELETED )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Remove unneeded junctions
|
// 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() )
|
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;
|
continue;
|
||||||
|
|
||||||
// Merge overlapping lines
|
// Merge overlapping lines
|
||||||
|
@ -226,7 +227,7 @@ bool SCH_EDIT_FRAME::SchematicCleanUp( bool aUndo, SCH_SCREEN* aScreen )
|
||||||
{
|
{
|
||||||
secondItem = item->Next();
|
secondItem = item->Next();
|
||||||
|
|
||||||
if( item->GetFlags() & STRUCT_DELETED )
|
if( item->GetEditFlags() & STRUCT_DELETED )
|
||||||
RemoveFromScreen( item, aScreen );
|
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 );
|
SCH_LINE* firstLine = dynamic_cast<SCH_LINE*>( item );
|
||||||
|
|
||||||
if( !firstLine || !firstLine->IsEndPoint( aJunction->GetPosition() )
|
if( !firstLine || !firstLine->IsEndPoint( aJunction->GetPosition() )
|
||||||
|| ( firstLine->GetFlags() & STRUCT_DELETED ) )
|
|| ( firstLine->GetEditFlags() & STRUCT_DELETED ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for( SCH_ITEM* secondItem = item->Next(); secondItem; secondItem = secondItem->Next() )
|
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 );
|
SCH_LINE* secondLine = dynamic_cast<SCH_LINE*>( secondItem );
|
||||||
|
|
||||||
if( !secondLine || !secondLine->IsEndPoint( aJunction->GetPosition() )
|
if( !secondLine || !secondLine->IsEndPoint( aJunction->GetPosition() )
|
||||||
|| ( secondItem->GetFlags() & STRUCT_DELETED )
|
|| ( secondItem->GetEditFlags() & STRUCT_DELETED )
|
||||||
|| !secondLine->IsParallel( firstLine ) )
|
|| !secondLine->IsParallel( firstLine ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -422,7 +423,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
|
||||||
{
|
{
|
||||||
nextitem = item->Next();
|
nextitem = item->Next();
|
||||||
|
|
||||||
if( item->GetFlags() & STRUCT_DELETED )
|
if( item->GetEditFlags() & STRUCT_DELETED )
|
||||||
RemoveFromScreen( item );
|
RemoveFromScreen( item );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, c
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Put old item in undo list if it is not currently in edit */
|
/* 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 );
|
SaveCopyInUndoList( BusEntry, UR_CHANGED );
|
||||||
|
|
||||||
s_LastShape = entry_shape == '/' ? '/' : '\\';
|
s_LastShape = entry_shape == '/' ? '/' : '\\';
|
||||||
|
|
|
@ -289,7 +289,7 @@ bool SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KE
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
bool hk_handled;
|
bool hk_handled;
|
||||||
|
|
||||||
if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
|
if( screen->GetCurItem() && screen->GetCurItem()->GetEditFlags() )
|
||||||
hk_handled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
|
hk_handled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
|
||||||
else
|
else
|
||||||
hk_handled = OnHotKey( aDC, aHotKey, aPosition, NULL );
|
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();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
|
|
||||||
if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
|
if( screen->GetCurItem() && screen->GetCurItem()->GetEditFlags() )
|
||||||
eventHandled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
|
eventHandled = OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
|
||||||
else
|
else
|
||||||
eventHandled = OnHotKey( aDC, aHotKey, aPosition, NULL );
|
eventHandled = OnHotKey( aDC, aHotKey, aPosition, NULL );
|
||||||
|
|
|
@ -393,8 +393,11 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
|
||||||
|
|
||||||
// save old cmp in undo list if not already in edit, or moving ...
|
// save old cmp in undo list if not already in edit, or moving ...
|
||||||
// or the component to be edited is part of a block
|
// 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 );
|
GetParent()->SaveCopyInUndoList( m_cmp, UR_CHANGED );
|
||||||
|
}
|
||||||
|
|
||||||
// Save current flags which could be modified by next change settings
|
// Save current flags which could be modified by next change settings
|
||||||
STATUS_FLAGS flags = m_cmp->GetFlags();
|
STATUS_FLAGS flags = m_cmp->GetFlags();
|
||||||
|
|
|
@ -301,9 +301,11 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
|
||||||
|
|
||||||
/* save old text in undo list if not already in edit */
|
/* save old text in undo list if not already in edit */
|
||||||
/* or the label to be edited is part of a block */
|
/* or the label to be edited is part of a block */
|
||||||
if( m_CurrentText->GetFlags() == 0 ||
|
if( m_CurrentText->GetEditFlags() == 0
|
||||||
m_Parent->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
|
|| m_Parent->GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
|
||||||
|
{
|
||||||
m_Parent->SaveCopyInUndoList( m_CurrentText, UR_CHANGED );
|
m_Parent->SaveCopyInUndoList( m_CurrentText, UR_CHANGED );
|
||||||
|
}
|
||||||
|
|
||||||
m_Parent->GetCanvas()->Refresh();
|
m_Parent->GetCanvas()->Refresh();
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ SCH_BITMAP* SCH_EDIT_FRAME::CreateNewImage()
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::RotateImage( SCH_BITMAP* aItem )
|
void SCH_EDIT_FRAME::RotateImage( SCH_BITMAP* aItem )
|
||||||
{
|
{
|
||||||
if( aItem->GetFlags( ) == 0 )
|
if( aItem->GetEditFlags( ) == 0 )
|
||||||
SaveCopyInUndoList( aItem, UR_ROTATED, false, aItem->GetPosition() );
|
SaveCopyInUndoList( aItem, UR_ROTATED, false, aItem->GetPosition() );
|
||||||
|
|
||||||
aItem->Rotate( 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 )
|
void SCH_EDIT_FRAME::MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis )
|
||||||
{
|
{
|
||||||
if( aItem->GetFlags( ) == 0 )
|
if( aItem->GetEditFlags( ) == 0 )
|
||||||
SaveCopyInUndoList( aItem, UR_CHANGED );
|
SaveCopyInUndoList( aItem, UR_CHANGED );
|
||||||
|
|
||||||
if( Is_X_axis )
|
if( Is_X_axis )
|
||||||
|
@ -107,14 +107,9 @@ bool SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem )
|
||||||
if( dlg.ShowModal() != wxID_OK )
|
if( dlg.ShowModal() != wxID_OK )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// save old image in undo list if not already in edit
|
// save old image in undo list if not already in edit or the image to be edited is part of a block
|
||||||
// or the image to be edited is part of a block
|
if( aItem->GetEditFlags() == 0 || GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
|
||||||
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
|
|
||||||
if( ( aItem->GetFlags() & mask ) == 0
|
|
||||||
|| GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
|
|
||||||
{
|
|
||||||
SaveCopyInUndoList( aItem, UR_CHANGED );
|
SaveCopyInUndoList( aItem, UR_CHANGED );
|
||||||
}
|
|
||||||
|
|
||||||
dlg.TransfertToImage( aItem->GetImage() );
|
dlg.TransfertToImage( aItem->GetImage() );
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,7 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
|
||||||
wxT( "Invalid schematic field parent item." ) );
|
wxT( "Invalid schematic field parent item." ) );
|
||||||
|
|
||||||
// Save old component in undo list if not already in edit, or moving.
|
// Save old component in undo list if not already in edit, or moving.
|
||||||
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
|
if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved
|
||||||
if( ( aField->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
|
|
||||||
SaveCopyInUndoList( component, UR_CHANGED );
|
SaveCopyInUndoList( component, UR_CHANGED );
|
||||||
|
|
||||||
// Don't use GetText() here. If the field is the reference designator and it's parent
|
// 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();
|
SCH_COMPONENT* component = (SCH_COMPONENT*) aField->GetParent();
|
||||||
|
|
||||||
// Save old component in undo list if not already in edit, or moving.
|
// Save old component in undo list if not already in edit, or moving.
|
||||||
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
|
if( aField->GetEditFlags() == 0 )
|
||||||
if( ( aField->GetFlags() & mask ) == 0 )
|
|
||||||
SaveCopyInUndoList( component, UR_CHANGED );
|
SaveCopyInUndoList( component, UR_CHANGED );
|
||||||
|
|
||||||
if( aField->GetTextAngle() == TEXT_ANGLE_HORIZ )
|
if( aField->GetTextAngle() == TEXT_ANGLE_HORIZ )
|
||||||
|
|
|
@ -55,7 +55,7 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* aTextItem )
|
||||||
int orient = ( aTextItem->GetLabelSpinStyle() + 1 ) & 3;
|
int orient = ( aTextItem->GetLabelSpinStyle() + 1 ) & 3;
|
||||||
|
|
||||||
// Save current text orientation in undo list if is not already in edit.
|
// 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 );
|
SaveCopyInUndoList( aTextItem, UR_CHANGED );
|
||||||
|
|
||||||
aTextItem->SetLabelSpinStyle( orient );
|
aTextItem->SetLabelSpinStyle( orient );
|
||||||
|
@ -249,7 +249,7 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
|
||||||
PICKED_ITEMS_LIST pickList;
|
PICKED_ITEMS_LIST pickList;
|
||||||
ITEM_PICKER picker( text, UR_CHANGED );
|
ITEM_PICKER picker( text, UR_CHANGED );
|
||||||
|
|
||||||
if( text->GetFlags() )
|
if( text->GetEditFlags() )
|
||||||
{
|
{
|
||||||
// text is being edited, save initial text for undo command
|
// text is being edited, save initial text for undo command
|
||||||
picker.SetLink( GetUndoItem() );
|
picker.SetLink( GetUndoItem() );
|
||||||
|
|
|
@ -215,14 +215,14 @@ void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation )
|
||||||
|
|
||||||
GetCanvas()->MoveCursorToCrossHair();
|
GetCanvas()->MoveCursorToCrossHair();
|
||||||
|
|
||||||
if( item->GetFlags() == 0 )
|
if( item->GetEditFlags() == 0 )
|
||||||
SetUndoItem( item );
|
SetUndoItem( item );
|
||||||
|
|
||||||
component->SetOrientation( aOrientation );
|
component->SetOrientation( aOrientation );
|
||||||
|
|
||||||
m_canvas->CrossHairOn( );
|
m_canvas->CrossHairOn( );
|
||||||
|
|
||||||
if( item->GetFlags() == 0 )
|
if( item->GetEditFlags() == 0 )
|
||||||
{
|
{
|
||||||
AddItemToScreen( item );
|
AddItemToScreen( item );
|
||||||
SchematicCleanUp();
|
SchematicCleanUp();
|
||||||
|
@ -232,7 +232,7 @@ void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation )
|
||||||
|
|
||||||
RefreshItem( item );
|
RefreshItem( item );
|
||||||
|
|
||||||
if( item->GetFlags() == 0 )
|
if( item->GetEditFlags() == 0 )
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
STATUS_FLAGS flags = component->GetFlags();
|
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 );
|
SaveCopyInUndoList( component, UR_CHANGED );
|
||||||
|
|
||||||
/* Update the unit number. */
|
/* Update the unit number. */
|
||||||
|
|
|
@ -423,7 +423,7 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
|
|
||||||
// itemInEdit == false means no item currently edited. We can ask for editing a new item
|
// 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.
|
// blocInProgress == false means no block in progress.
|
||||||
// Because a drag command uses a drag block, false means also no drag in progress
|
// Because a drag command uses a drag block, false means also no drag in progress
|
||||||
|
|
|
@ -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.
|
// Do not clear the 'selected' flag. It is required to have items drawn when they are pasted.
|
||||||
LIB_ITEM* copy = (LIB_ITEM*) item.Clone();
|
LIB_ITEM* copy = (LIB_ITEM*) item.Clone();
|
||||||
copy->SetFlags( copy->GetFlags() | UR_TRANSIENT );
|
copy->SetFlags( UR_TRANSIENT );
|
||||||
ITEM_PICKER picker( copy, UR_NEW );
|
ITEM_PICKER picker( copy, UR_NEW );
|
||||||
m_clipboard.PushItem( picker );
|
m_clipboard.PushItem( picker );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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).
|
// Clear current flags (which can be temporary set by a current edit command).
|
||||||
CopyItem->ClearStatus();
|
CopyItem->ClearStatus();
|
||||||
CopyItem->SetFlags( CopyItem->GetFlags() | UR_TRANSIENT );
|
CopyItem->SetFlags( UR_TRANSIENT );
|
||||||
|
|
||||||
ITEM_PICKER wrapper( CopyItem, undoType );
|
ITEM_PICKER wrapper( CopyItem, undoType );
|
||||||
lastcmd->PushItem( wrapper );
|
lastcmd->PushItem( wrapper );
|
||||||
|
@ -63,13 +63,13 @@ void LIB_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
|
||||||
delete redoCommand;
|
delete redoCommand;
|
||||||
LIB_PART* part = (LIB_PART*) redoWrapper.GetItem();
|
LIB_PART* part = (LIB_PART*) redoWrapper.GetItem();
|
||||||
wxCHECK( part, /* void */ );
|
wxCHECK( part, /* void */ );
|
||||||
part->SetFlags( part->GetFlags() & ~UR_TRANSIENT );
|
part->ClearFlags( UR_TRANSIENT );
|
||||||
UNDO_REDO_T undoRedoType = redoWrapper.GetStatus();
|
UNDO_REDO_T undoRedoType = redoWrapper.GetStatus();
|
||||||
|
|
||||||
// Store the current part in the undo buffer
|
// Store the current part in the undo buffer
|
||||||
PICKED_ITEMS_LIST* undoCommand = new PICKED_ITEMS_LIST();
|
PICKED_ITEMS_LIST* undoCommand = new PICKED_ITEMS_LIST();
|
||||||
LIB_PART* oldPart = GetCurPart();
|
LIB_PART* oldPart = GetCurPart();
|
||||||
oldPart->SetFlags( oldPart->GetFlags() | UR_TRANSIENT );
|
oldPart->SetFlags( UR_TRANSIENT );
|
||||||
ITEM_PICKER undoWrapper( oldPart, undoRedoType );
|
ITEM_PICKER undoWrapper( oldPart, undoRedoType );
|
||||||
undoCommand->PushItem( undoWrapper );
|
undoCommand->PushItem( undoWrapper );
|
||||||
GetScreen()->PushCommandToUndoList( undoCommand );
|
GetScreen()->PushCommandToUndoList( undoCommand );
|
||||||
|
@ -112,13 +112,13 @@ void LIB_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event )
|
||||||
delete undoCommand;
|
delete undoCommand;
|
||||||
LIB_PART* part = (LIB_PART*) undoWrapper.GetItem();
|
LIB_PART* part = (LIB_PART*) undoWrapper.GetItem();
|
||||||
wxCHECK( part, /* void */ );
|
wxCHECK( part, /* void */ );
|
||||||
part->SetFlags( part->GetFlags() & ~UR_TRANSIENT );
|
part->ClearFlags( UR_TRANSIENT );
|
||||||
UNDO_REDO_T undoRedoType = undoWrapper.GetStatus();
|
UNDO_REDO_T undoRedoType = undoWrapper.GetStatus();
|
||||||
|
|
||||||
// Store the current part in the redo buffer
|
// Store the current part in the redo buffer
|
||||||
PICKED_ITEMS_LIST* redoCommand = new PICKED_ITEMS_LIST();
|
PICKED_ITEMS_LIST* redoCommand = new PICKED_ITEMS_LIST();
|
||||||
LIB_PART* oldPart = GetCurPart();
|
LIB_PART* oldPart = GetCurPart();
|
||||||
oldPart->SetFlags( oldPart->GetFlags() | UR_TRANSIENT );
|
oldPart->SetFlags( UR_TRANSIENT );
|
||||||
ITEM_PICKER redoWrapper( oldPart, undoRedoType );
|
ITEM_PICKER redoWrapper( oldPart, undoRedoType );
|
||||||
redoCommand->PushItem( redoWrapper );
|
redoCommand->PushItem( redoWrapper );
|
||||||
GetScreen()->PushCommandToRedoList( redoCommand );
|
GetScreen()->PushCommandToRedoList( redoCommand );
|
||||||
|
|
|
@ -201,7 +201,7 @@ void LIB_EDIT_FRAME::PlacePin()
|
||||||
|
|
||||||
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
|
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;
|
continue;
|
||||||
|
|
||||||
// test for same body style
|
// test for same body style
|
||||||
|
@ -260,7 +260,7 @@ void LIB_EDIT_FRAME::PlacePin()
|
||||||
// Put linked pins in new position, and clear flags
|
// Put linked pins in new position, and clear flags
|
||||||
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
|
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
|
||||||
{
|
{
|
||||||
if( pin->GetFlags() == 0 )
|
if( pin->GetEditFlags() == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pin->Move( cur_pin->GetPosition() );
|
pin->Move( cur_pin->GetPosition() );
|
||||||
|
|
|
@ -49,7 +49,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
|
||||||
LIB_PART* part = GetCurPart();
|
LIB_PART* part = GetCurPart();
|
||||||
|
|
||||||
// Exit if no library entry is selected or a command is in progress.
|
// Exit if no library entry is selected or a command is in progress.
|
||||||
if( !part || ( GetDrawItem() && GetDrawItem()->GetFlags() ) )
|
if( !part || ( GetDrawItem() && GetDrawItem()->GetEditFlags() ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PROJECT& prj = Prj();
|
PROJECT& prj = Prj();
|
||||||
|
|
|
@ -45,7 +45,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
SetRepeatItem( NULL );
|
SetRepeatItem( NULL );
|
||||||
|
|
||||||
// item_flags != 0 means a current item in edit
|
// item_flags != 0 means a current item in edit
|
||||||
if( item && ( item->GetFlags() & ~HIGHLIGHTED ) )
|
if( item && item->GetEditFlags() )
|
||||||
{
|
{
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
|
@ -164,10 +164,10 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
switch( GetToolId() )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case ID_NO_TOOL_SELECTED:
|
case ID_NO_TOOL_SELECTED:
|
||||||
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
|
if( item == NULL || item->GetEditFlags() == 0 )
|
||||||
item = LocateAndShowItem( aPosition, SCH_COLLECTOR::DoubleClickItems );
|
item = LocateAndShowItem( aPosition, SCH_COLLECTOR::DoubleClickItems );
|
||||||
|
|
||||||
if( ( item == NULL ) || ( item->GetFlags() != 0 ) )
|
if( item == NULL || item->GetEditFlags() != 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
|
@ -181,8 +181,8 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
EditComponent( (SCH_COMPONENT*) item );
|
EditComponent( (SCH_COMPONENT*) item );
|
||||||
GetCanvas()->MoveCursorToCrossHair();
|
GetCanvas()->MoveCursorToCrossHair();
|
||||||
|
|
||||||
if( item->GetFlags() == 0 )
|
if( item->GetEditFlags() == 0 )
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( nullptr );
|
||||||
|
|
||||||
GetCanvas()->Refresh();
|
GetCanvas()->Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -144,7 +144,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to locate items at cursor position.
|
// Try to locate items at cursor position.
|
||||||
if( (item == NULL) || (item->GetFlags() == 0) )
|
if( item == NULL || item->GetEditFlags() == 0 )
|
||||||
{
|
{
|
||||||
bool actionCancelled = false;
|
bool actionCancelled = false;
|
||||||
item = LocateAndShowItem( aPosition, SCH_COLLECTOR::AllItemsButPins, 0, &actionCancelled );
|
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 a command is in progress: add "cancel" and "end tool" menu
|
||||||
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||||
{
|
{
|
||||||
if( item && item->GetFlags() )
|
if( item && item->GetEditFlags() )
|
||||||
{
|
{
|
||||||
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
|
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
|
||||||
KiBitmap( cancel_xpm ) );
|
KiBitmap( cancel_xpm ) );
|
||||||
|
@ -190,7 +190,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( item && item->GetFlags() )
|
if( item && item->GetEditFlags() )
|
||||||
{
|
{
|
||||||
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
|
AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
|
||||||
KiBitmap( cancel_xpm ) );
|
KiBitmap( cancel_xpm ) );
|
||||||
|
@ -317,7 +317,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
|
||||||
{
|
{
|
||||||
wxString msg, name;
|
wxString msg, name;
|
||||||
|
|
||||||
if( !Field->GetFlags() )
|
if( !Field->GetEditFlags() )
|
||||||
{
|
{
|
||||||
switch( Field->GetId() )
|
switch( Field->GetId() )
|
||||||
{
|
{
|
||||||
|
@ -327,8 +327,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
|
||||||
default: name = _( "Move Field" ); break;
|
default: name = _( "Move Field" ); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = AddHotkeyName( name, g_Schematic_Hotkeys_Descr,
|
msg = AddHotkeyName( name, g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
||||||
HK_MOVE_COMPONENT_OR_ITEM );
|
|
||||||
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
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;
|
wxString msg;
|
||||||
|
|
||||||
if( !Component->GetFlags() )
|
if( !Component->GetEditFlags() )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Move %s" ), Component->GetField( REFERENCE )->GetText() );
|
msg.Printf( _( "Move %s" ), Component->GetField( REFERENCE )->GetText() );
|
||||||
msg = AddHotkeyName( msg, g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
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 );
|
AddMenusForEditComponent( PopMenu, Component, aLibs );
|
||||||
|
|
||||||
if( !Component->GetFlags() )
|
if( !Component->GetEditFlags() )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hotkeys_Descr,
|
msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hotkeys_Descr,
|
||||||
HK_DUPLICATE_ITEM );
|
HK_DUPLICATE_ITEM );
|
||||||
|
@ -508,7 +507,7 @@ void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL
|
||||||
_( "Unit" ), KiBitmap( component_select_unit_xpm ) );
|
_( "Unit" ), KiBitmap( component_select_unit_xpm ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !Component->GetFlags() )
|
if( !Component->GetEditFlags() )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hotkeys_Descr,
|
msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hotkeys_Descr,
|
||||||
HK_EDIT_COMPONENT_WITH_LIBEDIT );
|
HK_EDIT_COMPONENT_WITH_LIBEDIT );
|
||||||
|
@ -526,7 +525,7 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
|
||||||
wxMenu* menu_change_type = new wxMenu;
|
wxMenu* menu_change_type = new wxMenu;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( !GLabel->GetFlags() )
|
if( !GLabel->GetEditFlags() )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr,
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr,
|
||||||
HK_MOVE_COMPONENT_OR_ITEM );
|
HK_MOVE_COMPONENT_OR_ITEM );
|
||||||
|
@ -563,7 +562,7 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
|
||||||
wxMenu* menu_change_type = new wxMenu;
|
wxMenu* menu_change_type = new wxMenu;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( !HLabel->GetFlags() )
|
if( !HLabel->GetEditFlags() )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr,
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr,
|
||||||
HK_MOVE_COMPONENT_OR_ITEM );
|
HK_MOVE_COMPONENT_OR_ITEM );
|
||||||
|
@ -599,7 +598,7 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
|
||||||
wxMenu* menu_change_type = new wxMenu;
|
wxMenu* menu_change_type = new wxMenu;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( !Label->GetFlags() )
|
if( !Label->GetEditFlags() )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
||||||
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
||||||
|
@ -633,7 +632,7 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxMenu* menu_change_type = new wxMenu;
|
wxMenu* menu_change_type = new wxMenu;
|
||||||
|
|
||||||
if( !Text->GetFlags() )
|
if( !Text->GetEditFlags() )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
||||||
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
||||||
|
@ -848,7 +847,7 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( !Sheet->GetFlags() )
|
if( !Sheet->GetEditFlags() )
|
||||||
{
|
{
|
||||||
AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
|
AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
|
||||||
KiBitmap( enter_sheet_xpm ) );
|
KiBitmap( enter_sheet_xpm ) );
|
||||||
|
@ -884,7 +883,7 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
|
||||||
_( "Orientation" ), KiBitmap( orient_xpm ) );
|
_( "Orientation" ), KiBitmap( orient_xpm ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Sheet->GetFlags() )
|
if( Sheet->GetEditFlags() )
|
||||||
{
|
{
|
||||||
AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place" ), KiBitmap( checked_ok_xpm ) );
|
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;
|
wxString msg;
|
||||||
|
|
||||||
if( !PinSheet->GetFlags() )
|
if( !PinSheet->GetEditFlags() )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr, HK_MOVE_COMPONENT_OR_ITEM );
|
||||||
AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
|
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 ) );
|
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 ) );
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete" ), KiBitmap( delete_xpm ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -989,7 +988,7 @@ void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( aBitmap->GetFlags() == 0 )
|
if( aBitmap->GetEditFlags() == 0 )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr,
|
msg = AddHotkeyName( _( "Move" ), g_Schematic_Hotkeys_Descr,
|
||||||
HK_MOVE_COMPONENT_OR_ITEM );
|
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 );
|
msg = AddHotkeyName( _( "Edit Image..." ), g_Schematic_Hotkeys_Descr, HK_EDIT );
|
||||||
AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
|
AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
|
||||||
|
|
||||||
if( aBitmap->GetFlags() == 0 )
|
if( aBitmap->GetEditFlags() == 0 )
|
||||||
{
|
{
|
||||||
aPopMenu->AppendSeparator();
|
aPopMenu->AppendSeparator();
|
||||||
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hotkeys_Descr, HK_DELETE );
|
msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hotkeys_Descr, HK_DELETE );
|
||||||
|
@ -1020,7 +1019,7 @@ void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE* aBusEntry )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( !aBusEntry->GetFlags() )
|
if( !aBusEntry->GetEditFlags() )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hotkeys_Descr,
|
msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hotkeys_Descr,
|
||||||
HK_MOVE_COMPONENT_OR_ITEM );
|
HK_MOVE_COMPONENT_OR_ITEM );
|
||||||
|
|
|
@ -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 ) );
|
SCH_ITEM* item = static_cast<SCH_ITEM*>( aItemsList.GetPickedItem( ii ) );
|
||||||
|
|
||||||
if( item->GetFlags() & STRUCT_DELETED )
|
if( item->GetEditFlags() & STRUCT_DELETED )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DeleteItem( item, aAppend );
|
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 )
|
void SCH_EDIT_FRAME::DeleteItem( SCH_ITEM* aItem, bool aAppend )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aItem != NULL, wxT( "Cannot delete invalid item." ) );
|
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." ) );
|
wxT( "Cannot delete item that is already deleted." ) );
|
||||||
|
|
||||||
// Here, aItem is not null.
|
// Here, aItem is not null.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* 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) 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* 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
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file sch_edit_frame.cpp
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <kiface_i.h>
|
#include <kiface_i.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
|
@ -70,10 +66,8 @@
|
||||||
#include <wx/display.h>
|
#include <wx/display.h>
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
|
||||||
#include <connection_graph.h>
|
#include <connection_graph.h>
|
||||||
#include <dialogs/dialog_fields_editor_global.h>
|
#include <dialogs/dialog_fields_editor_global.h>
|
||||||
|
|
||||||
#include <sch_view.h>
|
#include <sch_view.h>
|
||||||
#include <sch_painter.h>
|
#include <sch_painter.h>
|
||||||
|
|
||||||
|
@ -1136,12 +1130,12 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
|
||||||
item = LocateAndShowItem( data->GetPosition(), filterList, event.GetInt() );
|
item = LocateAndShowItem( data->GetPosition(), filterList, event.GetInt() );
|
||||||
|
|
||||||
// Exit if no item found at the current location or the item is already being edited.
|
// 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;
|
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." ) );
|
wxMessageBox( _( "Error: not a symbol or no symbol." ) );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -347,7 +347,7 @@ bool SCH_SCREEN::IsJunctionNeeded( const wxPoint& aPosition, bool aNew )
|
||||||
|
|
||||||
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
|
for( SCH_ITEM* item = m_drawList.begin(); item; item = item->Next() )
|
||||||
{
|
{
|
||||||
if( item->GetFlags() & STRUCT_DELETED )
|
if( item->GetEditFlags() & STRUCT_DELETED )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( aNew && ( item->Type() == SCH_JUNCTION_T ) && ( item->HitTest( aPosition ) ) )
|
if( aNew && ( item->Type() == SCH_JUNCTION_T ) && ( item->HitTest( aPosition ) ) )
|
||||||
|
|
|
@ -326,7 +326,7 @@ void SCH_EDIT_FRAME::OnDuplicateItem( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
SCH_ITEM* curr_item = GetScreen()->GetCurItem();
|
SCH_ITEM* curr_item = GetScreen()->GetCurItem();
|
||||||
|
|
||||||
if( !curr_item || curr_item->GetFlags() )
|
if( !curr_item || curr_item->GetEditFlags() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetCanvas()->GetViewControls()->SetCursorPosition( GetCrossHairPosition() );
|
GetCanvas()->GetViewControls()->SetCursorPosition( GetCrossHairPosition() );
|
||||||
|
@ -385,7 +385,7 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent )
|
||||||
aEvent.GetInt() );
|
aEvent.GetInt() );
|
||||||
|
|
||||||
// Exit if no item found at the current location or the item is already being edited.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
|
||||||
aEvent.GetInt() );
|
aEvent.GetInt() );
|
||||||
|
|
||||||
// Exit if no item found at the current location or the item is already being edited.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -845,8 +845,8 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
|
||||||
m_toolManager->RunAction( SCH_ACTIONS::refreshPreview, true );
|
m_toolManager->RunAction( SCH_ACTIONS::refreshPreview, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( item->GetFlags() == 0 )
|
if( item->GetEditFlags() == 0 )
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -901,7 +901,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
|
||||||
item = LocateAndShowItem( data->GetPosition(), filterListAux, aEvent.GetInt() );
|
item = LocateAndShowItem( data->GetPosition(), filterListAux, aEvent.GetInt() );
|
||||||
|
|
||||||
// Exit if no item found at the current location or the item is already being edited.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,8 +1007,8 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
RefreshItem( item );
|
RefreshItem( item );
|
||||||
|
|
||||||
if( item->GetFlags() == 0 )
|
if( item->GetEditFlags() == 0 )
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1040,7 +1040,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
|
||||||
aEvent.GetInt() );
|
aEvent.GetInt() );
|
||||||
|
|
||||||
// Exit if no item found at the current location or the item is already being edited.
|
// 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;
|
return;
|
||||||
|
|
||||||
// When a junction or a node is found, a BLOCK_DRAG is better
|
// 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() );
|
aEvent.GetInt() );
|
||||||
|
|
||||||
// Exit if no item found at the current location or the item is already being edited.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1224,8 +1224,8 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
|
||||||
m_toolManager->RunAction( SCH_ACTIONS::refreshPreview, true );
|
m_toolManager->RunAction( SCH_ACTIONS::refreshPreview, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( item->GetFlags() == 0 )
|
if( item->GetEditFlags() == 0 )
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1246,7 +1246,7 @@ void SCH_EDIT_FRAME::OnUnfoldBusHotkey( wxCommandEvent& aEvent )
|
||||||
aEvent.GetInt() );
|
aEvent.GetInt() );
|
||||||
|
|
||||||
// Exit if no item found at the current location or the item is already being edited.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ void SCH_EDIT_FRAME::RotateHierarchicalSheet( SCH_SHEET* aSheet, bool aRotCCW )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Save old sheet in undo list if not already in edit, or moving.
|
// 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 );
|
SaveCopyInUndoList( aSheet, UR_CHANGED );
|
||||||
|
|
||||||
// Rotate the sheet on itself. Sheets do not have a anchor point.
|
// 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;
|
return;
|
||||||
|
|
||||||
// Save old sheet in undo list if not already in edit, or moving.
|
// 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 );
|
SaveCopyInUndoList( aSheet, UR_CHANGED );
|
||||||
|
|
||||||
// Mirror the sheet on itself. Sheets do not have a anchor point.
|
// Mirror the sheet on itself. Sheets do not have a anchor point.
|
||||||
|
|
|
@ -40,7 +40,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
|
||||||
GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
|
GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
|
||||||
wxString msg;
|
wxString msg;
|
||||||
bool BlockActive = !GetScreen()->m_BlockLocate.IsIdle();
|
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.
|
// Do not initiate a start block validation on menu.
|
||||||
m_canvas->SetCanStartBlock( -1 );
|
m_canvas->SetCanStartBlock( -1 );
|
||||||
|
@ -49,7 +49,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
|
||||||
if( !busy )
|
if( !busy )
|
||||||
{
|
{
|
||||||
currItem = Locate( aPosition, CURSEUR_OFF_GRILLE );
|
currItem = Locate( aPosition, CURSEUR_OFF_GRILLE );
|
||||||
busy = currItem && currItem->GetFlags();
|
busy = currItem && currItem->GetEditFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If command in progress, end command.
|
// If command in progress, end command.
|
||||||
|
|
|
@ -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
|
#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
|
#define EDA_ITEM_ALL_FLAGS -1
|
||||||
|
|
||||||
|
@ -259,6 +260,14 @@ public:
|
||||||
void ClearFlags( STATUS_FLAGS aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; }
|
void ClearFlags( STATUS_FLAGS aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; }
|
||||||
STATUS_FLAGS GetFlags() const { return m_Flags; }
|
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
|
* Function IsType
|
||||||
* Checks whether the item is one of the listed types
|
* Checks whether the item is one of the listed types
|
||||||
|
|
|
@ -736,8 +736,7 @@ bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
|
||||||
m_footprint->CalculateBoundingBox();
|
m_footprint->CalculateBoundingBox();
|
||||||
|
|
||||||
// This is a simple edit, we must create an undo entry
|
// This is a simple edit, we must create an undo entry
|
||||||
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
|
if( m_footprint->GetEditFlags() == 0 ) // i.e. not edited, or moved
|
||||||
if( ( m_footprint->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
|
|
||||||
commit.Push( _( "Modify module properties" ) );
|
commit.Push( _( "Modify module properties" ) );
|
||||||
|
|
||||||
SetReturnCode( PRM_EDITOR_EDIT_OK );
|
SetReturnCode( PRM_EDITOR_EDIT_OK );
|
||||||
|
|
|
@ -360,8 +360,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
||||||
|
|
||||||
// If no other command in progress, prepare undo command
|
// If no other command in progress, prepare undo command
|
||||||
// (for a command in progress, will be made later, at the completion of 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->GetEditFlags() == 0 );
|
||||||
bool pushCommit = ( m_item->GetFlags() & mask ) == 0;
|
|
||||||
|
|
||||||
/* set flag in edit to force undo/redo/abort proper operation,
|
/* set flag in edit to force undo/redo/abort proper operation,
|
||||||
* and avoid new calls to SaveCopyInUndoList for the same text
|
* and avoid new calls to SaveCopyInUndoList for the same text
|
||||||
|
|
|
@ -1089,7 +1089,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
|
case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
|
||||||
if( GetCurItem()->GetFlags() != 0 )
|
if( GetCurItem()->GetEditFlags() != 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Delete_Drawings_All_Layer( GetCurItem()->GetLayer() );
|
Delete_Drawings_All_Layer( GetCurItem()->GetLayer() );
|
||||||
|
|
|
@ -248,8 +248,7 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC )
|
||||||
TextePcb->Draw( m_canvas, DC, GR_XOR );
|
TextePcb->Draw( m_canvas, DC, GR_XOR );
|
||||||
SetMsgPanel( TextePcb );
|
SetMsgPanel( TextePcb );
|
||||||
|
|
||||||
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
|
if( TextePcb->GetEditFlags() == 0 ) // i.e. not edited, or moved
|
||||||
if( ( TextePcb->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
|
|
||||||
SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->GetTextPos() );
|
SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->GetTextPos() );
|
||||||
else // set flag edit, to show it was a complex command
|
else // set flag edit, to show it was a complex command
|
||||||
TextePcb->SetFlags( IN_EDIT );
|
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 );
|
aTextePcb->Draw( m_canvas, aDC, GR_XOR );
|
||||||
SetMsgPanel( aTextePcb );
|
SetMsgPanel( aTextePcb );
|
||||||
|
|
||||||
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
|
if( aTextePcb->GetEditFlags() == 0 ) // i.e. not edited, or moved
|
||||||
if( ( aTextePcb->GetFlags() & mask ) == 0 ) // i.e. not edited, or moved
|
|
||||||
SaveCopyInUndoList( aTextePcb, UR_FLIPPED, aTextePcb->GetTextPos() );
|
SaveCopyInUndoList( aTextePcb, UR_FLIPPED, aTextePcb->GetTextPos() );
|
||||||
else // set edit flag, for the current command
|
else // set edit flag, for the current command
|
||||||
aTextePcb->SetFlags( IN_EDIT );
|
aTextePcb->SetFlags( IN_EDIT );
|
||||||
|
|
|
@ -175,7 +175,7 @@ void PCB_EDIT_FRAME::Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem )
|
||||||
PICKED_ITEMS_LIST itemsListPicker;
|
PICKED_ITEMS_LIST itemsListPicker;
|
||||||
bool changed = !SetTrackSegmentWidth( aTrackItem, &itemsListPicker, false );
|
bool changed = !SetTrackSegmentWidth( aTrackItem, &itemsListPicker, false );
|
||||||
|
|
||||||
if( !changed || aTrackItem->GetFlags() )
|
if( !changed || aTrackItem->GetEditFlags() )
|
||||||
return; // No change
|
return; // No change
|
||||||
|
|
||||||
// The segment has changed: redraw it and save it in undo list
|
// The segment has changed: redraw it and save it in undo list
|
||||||
|
|
|
@ -117,7 +117,6 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
|
||||||
if( Segment == NULL )
|
if( Segment == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int mask = EDA_ITEM_ALL_FLAGS - ( SELECTED | HIGHLIGHTED | BRIGHTENED );
|
|
||||||
if( Segment->IsNew() ) // Trace in progress.
|
if( Segment->IsNew() ) // Trace in progress.
|
||||||
{
|
{
|
||||||
// Delete current segment.
|
// Delete current segment.
|
||||||
|
@ -127,7 +126,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC )
|
||||||
displ_opts->m_DisplayDrawItemsFill = tmp;
|
displ_opts->m_DisplayDrawItemsFill = tmp;
|
||||||
SetCurItem( NULL );
|
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->Draw( m_canvas, DC, GR_XOR );
|
||||||
Segment->ClearFlags();
|
Segment->ClearFlags();
|
||||||
|
|
|
@ -102,7 +102,7 @@ void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
|
|
||||||
MODULE* module = (MODULE*) Text->GetParent();
|
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 ) )
|
if( IsType( FRAME_PCB ) )
|
||||||
SaveCopyInUndoList( module, UR_CHANGED );
|
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( aText->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
|
||||||
{
|
{
|
||||||
if( module && module->GetFlags() == 0 && aText->GetFlags() == 0 && IsType( FRAME_PCB ) )
|
if( module && module->GetEditFlags() == 0 && aText->GetEditFlags() == 0 )
|
||||||
SaveCopyInUndoList( module, UR_CHANGED );
|
{
|
||||||
|
if( IsType( FRAME_PCB ) )
|
||||||
|
SaveCopyInUndoList( module, UR_CHANGED );
|
||||||
|
}
|
||||||
|
|
||||||
m_canvas->RefreshDrawingRect( aText->GetBoundingBox() );
|
m_canvas->RefreshDrawingRect( aText->GetBoundingBox() );
|
||||||
aText->DeleteStructure();
|
aText->DeleteStructure();
|
||||||
|
|
|
@ -53,7 +53,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
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() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxLogDebug( wxT( "WinEDA_ModEditFrame::OnLeftClick err:Struct %d, m_Flag %X" ),
|
wxLogDebug( wxT( "WinEDA_ModEditFrame::OnLeftClick err:Struct %d, m_Flag %X" ),
|
||||||
item->Type(), item->GetFlags() );
|
item->Type(), item->GetEditFlags() );
|
||||||
item->ClearFlags();
|
item->ClearFlags();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
}
|
}
|
||||||
|
|
||||||
item = GetCurItem();
|
item = GetCurItem();
|
||||||
bool no_item_edited = item == NULL || item->GetFlags() == 0;
|
bool no_item_edited = item == NULL || item->GetEditFlags() == 0;
|
||||||
|
|
||||||
switch( GetToolId() )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
|
@ -152,8 +152,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
MODULE* module = GetBoard()->m_Modules;
|
MODULE* module = GetBoard()->m_Modules;
|
||||||
|
|
||||||
if( module == NULL // No module loaded
|
if( module == NULL || module->GetEditFlags() != 0 )
|
||||||
|| (module->GetFlags() != 0) )
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SaveCopyInUndoList( module, UR_CHANGED );
|
SaveCopyInUndoList( module, UR_CHANGED );
|
||||||
|
@ -215,15 +214,13 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
|
||||||
bool blockActive = !GetScreen()->m_BlockLocate.IsIdle();
|
bool blockActive = !GetScreen()->m_BlockLocate.IsIdle();
|
||||||
|
|
||||||
// Simple location of elements where possible.
|
// Simple location of elements where possible.
|
||||||
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
|
if( item == NULL || item->GetEditFlags() == 0 )
|
||||||
{
|
|
||||||
SetCurItem( item = ModeditLocateAndDisplay() );
|
SetCurItem( item = ModeditLocateAndDisplay() );
|
||||||
}
|
|
||||||
|
|
||||||
// End command in progress.
|
// End command in progress.
|
||||||
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
||||||
{
|
{
|
||||||
if( item && item->GetFlags() )
|
if( item && item->GetEditFlags() )
|
||||||
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
|
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
|
||||||
KiBitmap( cancel_xpm ) );
|
KiBitmap( cancel_xpm ) );
|
||||||
else
|
else
|
||||||
|
@ -234,7 +231,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( (item && item->GetFlags()) || blockActive )
|
if( (item && item->GetEditFlags()) || blockActive )
|
||||||
{
|
{
|
||||||
if( blockActive ) // Put block commands in list
|
if( blockActive ) // Put block commands in list
|
||||||
{
|
{
|
||||||
|
@ -279,7 +276,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
|
||||||
|
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
STATUS_FLAGS flags = item->GetFlags();
|
STATUS_FLAGS flags = item->GetEditFlags();
|
||||||
switch( item->Type() )
|
switch( item->Type() )
|
||||||
{
|
{
|
||||||
case PCB_MODULE_T:
|
case PCB_MODULE_T:
|
||||||
|
@ -472,12 +469,10 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
switch( GetToolId() )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case ID_NO_TOOL_SELECTED:
|
case ID_NO_TOOL_SELECTED:
|
||||||
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
|
if( item == NULL || item->GetEditFlags() == 0 )
|
||||||
{
|
|
||||||
item = ModeditLocateAndDisplay();
|
item = ModeditLocateAndDisplay();
|
||||||
}
|
|
||||||
|
|
||||||
if( ( item == NULL ) || ( item->GetFlags() != 0 ) )
|
if( item == NULL || item->GetEditFlags() != 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Item found
|
// Item found
|
||||||
|
|
|
@ -68,7 +68,7 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
||||||
if( aHotkeyCode == 0 )
|
if( aHotkeyCode == 0 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetFlags();
|
bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetEditFlags();
|
||||||
MODULE* module = NULL;
|
MODULE* module = NULL;
|
||||||
int evt_type = 0; //Used to post a wxCommandEvent on demand
|
int evt_type = 0; //Used to post a wxCommandEvent on demand
|
||||||
PCB_SCREEN* screen = GetScreen();
|
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 )
|
bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
bool ItemFree = (item == NULL) || (item->GetFlags() == 0);
|
bool ItemFree = ( !item || item->GetEditFlags() == 0 );
|
||||||
|
|
||||||
switch( GetToolId() )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
|
@ -593,7 +593,7 @@ bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
|
||||||
bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
|
bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
bool itemCurrentlyEdited = item && item->GetFlags();
|
bool itemCurrentlyEdited = item && item->GetEditFlags();
|
||||||
|
|
||||||
if( itemCurrentlyEdited )
|
if( itemCurrentlyEdited )
|
||||||
return false;
|
return false;
|
||||||
|
@ -697,7 +697,7 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
|
||||||
int PCB_EDIT_FRAME::OnHotkeyCopyItem()
|
int PCB_EDIT_FRAME::OnHotkeyCopyItem()
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
bool itemCurrentlyEdited = item && item->GetFlags();
|
bool itemCurrentlyEdited = item && item->GetEditFlags();
|
||||||
|
|
||||||
if( itemCurrentlyEdited )
|
if( itemCurrentlyEdited )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -728,7 +728,7 @@ int PCB_EDIT_FRAME::OnHotkeyCopyItem()
|
||||||
bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
|
bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
bool itemCurrentlyEdited = item && item->GetFlags();
|
bool itemCurrentlyEdited = item && item->GetEditFlags();
|
||||||
|
|
||||||
if( itemCurrentlyEdited )
|
if( itemCurrentlyEdited )
|
||||||
return false;
|
return false;
|
||||||
|
@ -839,7 +839,7 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
|
bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
|
||||||
bool itemCurrentlyEdited = item && item->GetFlags();
|
bool itemCurrentlyEdited = item && item->GetEditFlags();
|
||||||
|
|
||||||
m_canvas->SetAutoPanRequest( false );
|
m_canvas->SetAutoPanRequest( false );
|
||||||
|
|
||||||
|
@ -902,7 +902,7 @@ TRACK * PCB_EDIT_FRAME::OnHotkeyBeginRoute( wxDC* aDC )
|
||||||
if( !IsCopperLayer( GetActiveLayer() ) )
|
if( !IsCopperLayer( GetActiveLayer() ) )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetFlags();
|
bool itemCurrentlyEdited = GetCurItem() && GetCurItem()->GetEditFlags();
|
||||||
|
|
||||||
// Ensure the track tool is active
|
// Ensure the track tool is active
|
||||||
if( GetToolId() != ID_TRACK_BUTT && !itemCurrentlyEdited )
|
if( GetToolId() != ID_TRACK_BUTT && !itemCurrentlyEdited )
|
||||||
|
@ -945,7 +945,7 @@ TRACK * PCB_EDIT_FRAME::OnHotkeyBeginRoute( wxDC* aDC )
|
||||||
bool PCB_EDIT_FRAME::OnHotkeyFlipItem( int aIdCommand )
|
bool PCB_EDIT_FRAME::OnHotkeyFlipItem( int aIdCommand )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = GetCurItem();
|
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
|
int evt_type = 0; // Used to post a wxCommandEvent on demand
|
||||||
|
|
||||||
wxASSERT( aIdCommand == HK_FLIP_ITEM );
|
wxASSERT( aIdCommand == HK_FLIP_ITEM );
|
||||||
|
@ -997,7 +997,7 @@ bool PCB_EDIT_FRAME::OnHotkeyFlipItem( int aIdCommand )
|
||||||
bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
|
bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = GetCurItem();
|
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
|
int evt_type = 0; // Used to post a wxCommandEvent on demand
|
||||||
|
|
||||||
wxASSERT( aIdCommand == HK_ROTATE_ITEM );
|
wxASSERT( aIdCommand == HK_ROTATE_ITEM );
|
||||||
|
@ -1052,7 +1052,7 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
|
||||||
bool PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem( int aIdCommand )
|
bool PCB_EDIT_FRAME::OnHotkeyDuplicateOrArrayItem( int aIdCommand )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
bool itemCurrentlyEdited = item && item->GetFlags();
|
bool itemCurrentlyEdited = item && item->GetEditFlags();
|
||||||
|
|
||||||
if( itemCurrentlyEdited )
|
if( itemCurrentlyEdited )
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -61,7 +61,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
|
||||||
|
|
||||||
bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
|
bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
bool ItemFree = (item == 0) || (item->GetFlags() == 0);
|
bool ItemFree = ( !item || item->GetEditFlags() == 0 );
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
cmd.SetEventObject( this );
|
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* FOOTPRINT_EDIT_FRAME::PrepareItemForHotkey( bool aFailIfCurrentlyEdited )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = GetCurItem();
|
BOARD_ITEM* item = GetCurItem();
|
||||||
bool itemCurrentlyEdited = item && item->GetFlags();
|
bool itemCurrentlyEdited = item && item->GetEditFlags();
|
||||||
bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
|
bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
|
||||||
|
|
||||||
if( aFailIfCurrentlyEdited )
|
if( aFailIfCurrentlyEdited )
|
||||||
|
|
|
@ -60,11 +60,11 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
bool no_tool = GetToolId() == ID_NO_TOOL_SELECTED;
|
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 );
|
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->SetIgnoreMouseEvents( true );
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
|
@ -146,7 +146,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
wxString::Format(
|
wxString::Format(
|
||||||
"PCB_EDIT_FRAME::OnLeftClick() err: curr_item type %d m_Flags != 0 (%X)",
|
"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;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_TARGET_BUTT:
|
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 ) );
|
SetCurItem( (BOARD_ITEM*) CreateTarget( aDC ) );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
@ -257,7 +257,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
if( GetToolId() == ID_PCB_ARC_BUTT )
|
if( GetToolId() == ID_PCB_ARC_BUTT )
|
||||||
shape = S_ARC;
|
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 );
|
curr_item = (BOARD_ITEM*) Begin_DrawSegment( NULL, shape, aDC );
|
||||||
SetCurItem( curr_item );
|
SetCurItem( curr_item );
|
||||||
|
@ -281,7 +281,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
break;
|
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 );
|
curr_item = (BOARD_ITEM*) Begin_Route( NULL, aDC );
|
||||||
SetCurItem( curr_item );
|
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
|
* this can be start a new zone or select and move an existing zone outline corner
|
||||||
* if found near the mouse cursor
|
* 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 ) )
|
if( Begin_Zone( aDC ) )
|
||||||
{
|
{
|
||||||
|
@ -340,7 +340,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
|
if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
|
||||||
{
|
{
|
||||||
SetCurItem( CreateTextePcb( aDC ) );
|
SetCurItem( CreateTextePcb( aDC ) );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
@ -359,7 +359,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_MODULE_BUTT:
|
case ID_PCB_MODULE_BUTT:
|
||||||
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
|
if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
|
||||||
{
|
{
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
MODULE* module = SelectFootprintFromLibTree();
|
MODULE* module = SelectFootprintFromLibTree();
|
||||||
|
@ -397,7 +397,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !curr_item || !curr_item->GetFlags() )
|
if( !curr_item || !curr_item->GetEditFlags() )
|
||||||
{
|
{
|
||||||
curr_item = (BOARD_ITEM*) EditDimension( NULL, aDC );
|
curr_item = (BOARD_ITEM*) EditDimension( NULL, aDC );
|
||||||
SetCurItem( curr_item );
|
SetCurItem( curr_item );
|
||||||
|
@ -417,11 +417,11 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PCB_DELETE_ITEM_BUTT:
|
case ID_PCB_DELETE_ITEM_BUTT:
|
||||||
if( !curr_item || !curr_item->GetFlags() )
|
if( !curr_item || !curr_item->GetEditFlags() )
|
||||||
{
|
{
|
||||||
curr_item = PcbGeneralLocateAndDisplay();
|
curr_item = PcbGeneralLocateAndDisplay();
|
||||||
|
|
||||||
if( curr_item && (curr_item->GetFlags() == 0) )
|
if( curr_item && curr_item->GetEditFlags() == 0 )
|
||||||
{
|
{
|
||||||
RemoveStruct( curr_item, aDC );
|
RemoveStruct( curr_item, aDC );
|
||||||
SetCurItem( curr_item = NULL );
|
SetCurItem( curr_item = NULL );
|
||||||
|
@ -471,12 +471,10 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
switch( GetToolId() )
|
switch( GetToolId() )
|
||||||
{
|
{
|
||||||
case ID_NO_TOOL_SELECTED:
|
case ID_NO_TOOL_SELECTED:
|
||||||
if( (curr_item == NULL) || (curr_item->GetFlags() == 0) )
|
if( curr_item == NULL || curr_item->GetEditFlags() == 0 )
|
||||||
{
|
|
||||||
curr_item = PcbGeneralLocateAndDisplay();
|
curr_item = PcbGeneralLocateAndDisplay();
|
||||||
}
|
|
||||||
|
|
||||||
if( (curr_item == NULL) || (curr_item->GetFlags() != 0) )
|
if( curr_item == NULL || curr_item->GetEditFlags() != 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SendMessageToEESCHEMA( curr_item );
|
SendMessageToEESCHEMA( curr_item );
|
||||||
|
@ -493,7 +491,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
if( End_Route( (TRACK*) curr_item, aDC ) )
|
if( End_Route( (TRACK*) curr_item, aDC ) )
|
||||||
m_canvas->SetAutoPanRequest( false );
|
m_canvas->SetAutoPanRequest( false );
|
||||||
}
|
}
|
||||||
else if( curr_item->GetFlags() == 0 )
|
else if( curr_item->GetEditFlags() == 0 )
|
||||||
{
|
{
|
||||||
Edit_TrackSegm_Width( aDC, (TRACK*) curr_item );
|
Edit_TrackSegm_Width( aDC, (TRACK*) curr_item );
|
||||||
}
|
}
|
||||||
|
@ -515,7 +513,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCB_ZONE_AREA_T:
|
case PCB_ZONE_AREA_T:
|
||||||
if( curr_item->GetFlags() )
|
if( curr_item->GetEditFlags() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
OnEditItemRequest( aDC, curr_item );
|
OnEditItemRequest( aDC, curr_item );
|
||||||
|
|
|
@ -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( 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" ),
|
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
|
||||||
KiBitmap( cancel_xpm ) );
|
KiBitmap( cancel_xpm ) );
|
||||||
|
@ -92,7 +92,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( item && item->GetFlags() )
|
if( item && item->GetEditFlags() )
|
||||||
{
|
{
|
||||||
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||||
_( "Cancel" ), KiBitmap( cancel_xpm ) );
|
_( "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
|
* not the current item being edited. In such case we cannot call
|
||||||
* PcbGeneralLocateAndDisplay().
|
* PcbGeneralLocateAndDisplay().
|
||||||
*/
|
*/
|
||||||
if( !item || (item->GetFlags() == 0) )
|
if( !item || item->GetEditFlags() == 0 )
|
||||||
{
|
{
|
||||||
// show the "item selector" menu if no item selected or
|
// show the "item selector" menu if no item selected or
|
||||||
// if there is a selected item but the mouse has moved
|
// 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();
|
item = GetCurItem();
|
||||||
flags = item ? item->GetFlags() : 0;
|
flags = item ? item->GetEditFlags() : 0;
|
||||||
|
|
||||||
// Add the context menu, which depends on the picked item:
|
// Add the context menu, which depends on the picked item:
|
||||||
if( item )
|
if( item )
|
||||||
|
@ -433,7 +433,7 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
|
||||||
|
|
||||||
SetCurrentNetClass( Track->GetNetClassName() );
|
SetCurrentNetClass( Track->GetNetClassName() );
|
||||||
|
|
||||||
int flags = Track->GetFlags();
|
int flags = Track->GetEditFlags();
|
||||||
|
|
||||||
if( flags == 0 )
|
if( flags == 0 )
|
||||||
{
|
{
|
||||||
|
@ -623,14 +623,14 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
|
||||||
wxString msg;
|
wxString msg;
|
||||||
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
|
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,
|
AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT,
|
||||||
_( "Place Edge Outline" ), KiBitmap( checked_ok_xpm ) );
|
_( "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,
|
AddMenuItem( aPopMenu, ID_POPUP_PCB_PLACE_ZONE_CORNER,
|
||||||
_( "Place Corner" ), KiBitmap( checked_ok_xpm ) );
|
_( "Place Corner" ), KiBitmap( checked_ok_xpm ) );
|
||||||
else
|
else
|
||||||
|
@ -716,7 +716,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
|
||||||
void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu )
|
void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu )
|
||||||
{
|
{
|
||||||
wxMenu* sub_menu_footprint;
|
wxMenu* sub_menu_footprint;
|
||||||
int flags = aModule->GetFlags();
|
int flags = aModule->GetEditFlags();
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
sub_menu_footprint = new wxMenu;
|
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 )
|
void PCB_EDIT_FRAME::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* menu )
|
||||||
{
|
{
|
||||||
wxMenu* sub_menu_Fp_text;
|
wxMenu* sub_menu_Fp_text;
|
||||||
int flags = FpText->GetFlags();
|
int flags = FpText->GetEditFlags();
|
||||||
|
|
||||||
wxString msg = FpText->GetSelectMenuText( m_UserUnits );
|
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 )
|
void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
|
||||||
{
|
{
|
||||||
wxMenu* sub_menu_Pad;
|
wxMenu* sub_menu_Pad;
|
||||||
int flags = Pad->GetFlags();
|
int flags = Pad->GetEditFlags();
|
||||||
|
|
||||||
if( flags ) // Currently in edit, no others commands possible
|
if( flags ) // Currently in edit, no others commands possible
|
||||||
return;
|
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 )
|
void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
|
||||||
{
|
{
|
||||||
wxMenu* sub_menu_Text;
|
wxMenu* sub_menu_Text;
|
||||||
int flags = Text->GetFlags();
|
int flags = Text->GetEditFlags();
|
||||||
|
|
||||||
wxString msg = Text->GetSelectMenuText( m_UserUnits );
|
wxString msg = Text->GetSelectMenuText( m_UserUnits );
|
||||||
|
|
||||||
|
|
|
@ -493,7 +493,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool
|
||||||
DrawSegmentWhileMovingFootprint( m_canvas, DC );
|
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();
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
// Areas must be drawn here only if not moved or dragged,
|
||||||
// because these areas are drawn by ManageCursor() in a specific manner
|
// 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->Draw( aPanel, DC, aDrawMode );
|
||||||
zone->DrawFilledArea( aPanel, DC, aDrawMode );
|
zone->DrawFilledArea( aPanel, DC, aDrawMode );
|
||||||
|
|
|
@ -130,10 +130,10 @@ bool DIALOG_TARGET_PROPERTIES::TransferDataFromWindow()
|
||||||
m_Target->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR );
|
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)
|
// 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 ..)
|
if( m_Target->GetEditFlags() != 0 ) // other edit in progress (MOVE, NEW ..)
|
||||||
m_Target->SetFlags( IN_EDIT ); // set flag in edit to force
|
m_Target->SetFlags( IN_EDIT ); // set flag in edit to force
|
||||||
// undo/redo/abort proper operation
|
// undo/redo/abort proper operation
|
||||||
|
|
||||||
m_Target->SetWidth( m_Thickness.GetValue() );
|
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
|
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->SetPosition( s_TargetCopy.GetPosition() );
|
||||||
target->SetWidth( s_TargetCopy.GetWidth() );
|
target->SetWidth( s_TargetCopy.GetWidth() );
|
||||||
|
@ -245,7 +245,7 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( aTarget->GetFlags() == IS_MOVED )
|
if( aTarget->GetEditFlags() == IS_MOVED )
|
||||||
{
|
{
|
||||||
SaveCopyInUndoList( aTarget, UR_MOVED,
|
SaveCopyInUndoList( aTarget, UR_MOVED,
|
||||||
aTarget->GetPosition() - s_TargetCopy.GetPosition() );
|
aTarget->GetPosition() - s_TargetCopy.GetPosition() );
|
||||||
|
@ -253,7 +253,7 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (aTarget->GetFlags() & IN_EDIT) )
|
if( (aTarget->GetEditFlags() & IN_EDIT) )
|
||||||
{
|
{
|
||||||
aTarget->SwapData( &s_TargetCopy );
|
aTarget->SwapData( &s_TargetCopy );
|
||||||
SaveCopyInUndoList( aTarget, UR_CHANGED );
|
SaveCopyInUndoList( aTarget, UR_CHANGED );
|
||||||
|
|
|
@ -386,7 +386,7 @@ bool TRACKS_CLEANER::deleteNullSegments()
|
||||||
|
|
||||||
void TRACKS_CLEANER::removeDuplicatesOfTrack( const TRACK *aSeg, std::set<BOARD_ITEM*>& aToRemove )
|
void TRACKS_CLEANER::removeDuplicatesOfTrack( const TRACK *aSeg, std::set<BOARD_ITEM*>& aToRemove )
|
||||||
{
|
{
|
||||||
if( aSeg->GetFlags() & STRUCT_DELETED )
|
if( aSeg->GetEditFlags() & STRUCT_DELETED )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( auto seg2 : m_brd->Tracks() )
|
for( auto seg2 : m_brd->Tracks() )
|
||||||
|
|
Loading…
Reference in New Issue