Transition mirroring to modern toolset.
This commit is contained in:
parent
8c00dac3c7
commit
1c8461bec7
|
@ -1590,18 +1590,6 @@ bool EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool
|
|||
}
|
||||
|
||||
|
||||
bool EDA_DRAW_FRAME::isBusy() const
|
||||
{
|
||||
const BASE_SCREEN* screen = GetScreen();
|
||||
|
||||
if( !screen )
|
||||
return false;
|
||||
|
||||
return ( screen->GetCurItem() && screen->GetCurItem()->GetEditFlags() )
|
||||
|| ( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointer )
|
||||
{
|
||||
if( IsGalCanvasActive() )
|
||||
|
|
|
@ -72,21 +72,6 @@ SCH_BITMAP* SCH_EDIT_FRAME::CreateNewImage()
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis )
|
||||
{
|
||||
if( aItem->GetEditFlags( ) == 0 )
|
||||
SaveCopyInUndoList( aItem, UR_CHANGED );
|
||||
|
||||
if( Is_X_axis )
|
||||
aItem->MirrorX( aItem->GetPosition().y );
|
||||
else
|
||||
aItem->MirrorY( aItem->GetPosition().x );
|
||||
|
||||
RefreshItem( aItem );
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
||||
bool SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem )
|
||||
{
|
||||
// TODO: change image scale or more
|
||||
|
|
|
@ -32,8 +32,6 @@ class SCH_SCREEN;
|
|||
class PICKED_ITEMS_LIST;
|
||||
|
||||
void SetSchItemParent( SCH_ITEM* Struct, SCH_SCREEN* Screen );
|
||||
void MirrorY( PICKED_ITEMS_LIST& aItemsList, const wxPoint& aMirrorPoint );
|
||||
void MirrorX( PICKED_ITEMS_LIST& aItemsList, const wxPoint& aMirrorPoint );
|
||||
|
||||
/**
|
||||
* Routine to create a new copy of given struct.
|
||||
|
|
|
@ -408,7 +408,6 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB
|
|||
AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
|
||||
msg = AddHotkeyName( _( "Reset to Default" ), g_Schematic_Hotkeys_Descr,
|
||||
HK_ORIENT_NORMAL_COMPONENT );
|
||||
AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
|
||||
AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
|
||||
_( "Orientation" ), KiBitmap( orient_xpm ) );
|
||||
|
||||
|
|
|
@ -72,28 +72,6 @@ void SetSchItemParent( SCH_ITEM* Struct, SCH_SCREEN* Screen )
|
|||
}
|
||||
|
||||
|
||||
void MirrorY( PICKED_ITEMS_LIST& aItemsList, const wxPoint& aMirrorPoint )
|
||||
{
|
||||
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
||||
{
|
||||
SCH_ITEM* item = static_cast<SCH_ITEM*>( aItemsList.GetPickedItem( ii ) );
|
||||
item->MirrorY( aMirrorPoint.x ); // Place it in its new position.
|
||||
item->ClearFlags();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MirrorX( PICKED_ITEMS_LIST& aItemsList, const wxPoint& aMirrorPoint )
|
||||
{
|
||||
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
||||
{
|
||||
SCH_ITEM* item = static_cast<SCH_ITEM*>( aItemsList.GetPickedItem( ii ) );
|
||||
item->MirrorX( aMirrorPoint.y ); // Place it in its new position.
|
||||
item->ClearFlags();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::CheckListConnections( PICKED_ITEMS_LIST& aItemsList, bool aAppend )
|
||||
{
|
||||
std::vector< wxPoint > pts;
|
||||
|
|
|
@ -288,7 +288,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
|||
EVT_MENU( ID_SCH_DRAG_ITEM, SCH_EDIT_FRAME::OnDragItem )
|
||||
EVT_MENU_RANGE( ID_SCH_EDIT_ITEM, ID_SCH_EDIT_COMPONENT_FOOTPRINT,
|
||||
SCH_EDIT_FRAME::OnEditItem )
|
||||
EVT_MENU_RANGE( ID_SCH_MIRROR_X, ID_SCH_ORIENT_NORMAL, SCH_EDIT_FRAME::OnOrient )
|
||||
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
||||
SCH_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_MENU( ID_SCH_UNFOLD_BUS, SCH_EDIT_FRAME::OnUnfoldBusHotkey )
|
||||
|
|
|
@ -809,12 +809,6 @@ private:
|
|||
*/
|
||||
void OnDragItem( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Handle the #ID_SCH_MIRROR_X, #ID_SCH_MIRROR_Y, and #ID_SCH_ORIENT_NORMAL events
|
||||
* used to orient schematic items and blocks.
|
||||
*/
|
||||
void OnOrient( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Handles the keyboard hotkey for unfolding a bus
|
||||
*/
|
||||
|
@ -951,15 +945,6 @@ private:
|
|||
*/
|
||||
void DeleteConnection( bool DeleteFullConnection );
|
||||
|
||||
/**
|
||||
* Mirror a bitmap.
|
||||
*
|
||||
* @param aItem = the SCH_BITMAP item to mirror
|
||||
* @param Is_X_axis = true to mirror relative to Horizontal axis
|
||||
* false to mirror relative to vertical axis
|
||||
*/
|
||||
void MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis );
|
||||
|
||||
/**
|
||||
* Launches the "Edit Image" dialog to modify an image
|
||||
* @param aItem Pointer to the image item to modify
|
||||
|
@ -970,17 +955,6 @@ private:
|
|||
// Hierarchical Sheet & PinSheet
|
||||
void InstallHierarchyFrame( wxPoint& pos );
|
||||
|
||||
/**
|
||||
* Mirror a hierarchical sheet.
|
||||
*
|
||||
* Mirroring is performed around its center.
|
||||
*
|
||||
* @param aSheet = the SCH_SHEET to mirror
|
||||
* @param aFromXaxis = true to mirror relative to Horizontal axis
|
||||
* false to mirror relative to vertical axis
|
||||
*/
|
||||
void MirrorSheet( SCH_SHEET* aSheet, bool aFromXaxis );
|
||||
|
||||
/**
|
||||
* Function EditLine
|
||||
* displays the dialog for editing the parameters of \a aLine.
|
||||
|
|
|
@ -887,151 +887,6 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
|
||||
SCH_SCREEN* screen = GetScreen();
|
||||
SCH_ITEM* item = screen->GetCurItem();
|
||||
BLOCK_SELECTOR& block = screen->m_BlockLocate;
|
||||
|
||||
// Allows block rotate operation on hot key.
|
||||
if( block.GetState() != STATE_NO_BLOCK )
|
||||
{
|
||||
if( aEvent.GetId() == ID_SCH_MIRROR_X )
|
||||
{
|
||||
// Compute the mirror center and put it on grid.
|
||||
wxPoint mirrorPt = block.Centre();
|
||||
mirrorPt = GetNearestGridPosition( mirrorPt );
|
||||
SetCrossHairPosition( mirrorPt );
|
||||
|
||||
if( block.GetCommand() != BLOCK_DUPLICATE && block.GetCommand() != BLOCK_PASTE )
|
||||
{
|
||||
SaveCopyInUndoList( block.GetItems(), UR_MIRRORED_X, block.AppendUndo(), mirrorPt );
|
||||
block.SetAppendUndo();
|
||||
}
|
||||
|
||||
MirrorX( block.GetItems(), mirrorPt );
|
||||
|
||||
m_canvas->CallMouseCapture( nullptr, wxDefaultPosition, false );
|
||||
m_canvas->Refresh();
|
||||
return;
|
||||
}
|
||||
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
|
||||
{
|
||||
// Compute the mirror center and put it on grid.
|
||||
wxPoint mirrorPt = block.Centre();
|
||||
mirrorPt = GetNearestGridPosition( mirrorPt );
|
||||
SetCrossHairPosition( mirrorPt );
|
||||
|
||||
if( block.GetCommand() != BLOCK_DUPLICATE && block.GetCommand() != BLOCK_PASTE )
|
||||
{
|
||||
SaveCopyInUndoList( block.GetItems(), UR_MIRRORED_Y, block.AppendUndo(), mirrorPt );
|
||||
block.SetAppendUndo();
|
||||
}
|
||||
|
||||
MirrorY( block.GetItems(), mirrorPt );
|
||||
|
||||
m_canvas->CallMouseCapture( nullptr, wxDefaultPosition, false );
|
||||
m_canvas->Refresh();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFAIL_MSG( wxT( "Unknown block oriention command ID." ) );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( item == NULL )
|
||||
{
|
||||
// If we didn't get here by a hot key, then something has gone wrong.
|
||||
if( aEvent.GetInt() == 0 )
|
||||
return;
|
||||
|
||||
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
|
||||
|
||||
wxCHECK_RET( data != NULL, wxT( "Invalid hot key client object." ) );
|
||||
|
||||
item = selTool->SelectPoint( data->GetPosition(), SCH_COLLECTOR::OrientableItems );
|
||||
|
||||
// Exit if no item found at the current location or the item is already being edited.
|
||||
if( item == NULL || item->GetEditFlags() != 0 )
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_COMPONENT_T:
|
||||
{
|
||||
SCH_COMPONENT *component = static_cast<SCH_COMPONENT*>( item );
|
||||
if( aEvent.GetId() == ID_SCH_MIRROR_X )
|
||||
OrientComponent( CMP_MIRROR_X );
|
||||
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
|
||||
OrientComponent( CMP_MIRROR_Y );
|
||||
else if( aEvent.GetId() == ID_SCH_ORIENT_NORMAL )
|
||||
OrientComponent( CMP_NORMAL );
|
||||
else
|
||||
wxFAIL_MSG( wxT( "Invalid orient schematic component command ID." ) );
|
||||
|
||||
if( m_autoplaceFields )
|
||||
component->AutoAutoplaceFields( GetScreen() );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_BITMAP_T:
|
||||
if( aEvent.GetId() == ID_SCH_MIRROR_X )
|
||||
MirrorImage( (SCH_BITMAP*) item, true );
|
||||
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
|
||||
MirrorImage( (SCH_BITMAP*) item, false );
|
||||
|
||||
// The bitmap is cached in Opengl: clear the cache, because
|
||||
// the cache data is invalid
|
||||
GetCanvas()->GetView()->RecacheAllItems();
|
||||
break;
|
||||
|
||||
case SCH_SHEET_T:
|
||||
if( aEvent.GetId() == ID_SCH_MIRROR_X )
|
||||
MirrorSheet( (SCH_SHEET*) item, true );
|
||||
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
|
||||
MirrorSheet( (SCH_SHEET*) item, false );
|
||||
|
||||
break;
|
||||
|
||||
case SCH_BUS_BUS_ENTRY_T:
|
||||
case SCH_BUS_WIRE_ENTRY_T:
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
SaveCopyInUndoList( item, UR_CHANGED );
|
||||
|
||||
if( aEvent.GetId() == ID_SCH_MIRROR_X )
|
||||
item->MirrorX( m_canvas->GetParent()->GetCrossHairPosition().y );
|
||||
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )
|
||||
item->MirrorY( m_canvas->GetParent()->GetCrossHairPosition().x );
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
// This object cannot be oriented.
|
||||
;
|
||||
}
|
||||
|
||||
RefreshItem( item );
|
||||
|
||||
if( item->IsMoving() )
|
||||
{
|
||||
if( m_canvas->IsMouseCaptured() )
|
||||
m_canvas->CallMouseCapture( nullptr, wxDefaultPosition, false );
|
||||
else
|
||||
m_toolManager->RunAction( SCH_ACTIONS::refreshPreview, true );
|
||||
}
|
||||
|
||||
if( item->GetEditFlags() == 0 )
|
||||
screen->SetCurItem( nullptr );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::OnUnfoldBusHotkey( wxCommandEvent& aEvent )
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = GetToolManager()->GetTool<SCH_SELECTION_TOOL>();
|
||||
|
|
|
@ -304,24 +304,3 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::MirrorSheet( SCH_SHEET* aSheet, bool aFromXaxis )
|
||||
{
|
||||
if( aSheet == NULL )
|
||||
return;
|
||||
|
||||
// Save old sheet in undo list if not already in edit, or moving.
|
||||
if( aSheet->GetEditFlags() == 0 )
|
||||
SaveCopyInUndoList( aSheet, UR_CHANGED );
|
||||
|
||||
// Mirror the sheet on itself. Sheets do not have a anchor point.
|
||||
// Mirroring is made around it center
|
||||
wxPoint mirrorPoint = aSheet->GetBoundingBox().Centre();
|
||||
|
||||
if( aFromXaxis ) // mirror relative to Horizontal axis
|
||||
aSheet->MirrorX( mirrorPoint.y );
|
||||
else // Mirror relative to vertical axis
|
||||
aSheet->MirrorY( mirrorPoint.x );
|
||||
|
||||
GetCanvas()->GetView()->Update( aSheet );
|
||||
OnModify();
|
||||
}
|
||||
|
|
|
@ -197,6 +197,12 @@ OPT<TOOL_EVENT> SCH_ACTIONS::TranslateLegacyId( int aId )
|
|||
|
||||
case ID_SCH_ROTATE_COUNTERCLOCKWISE:
|
||||
return SCH_ACTIONS::rotateCCW.MakeEvent();
|
||||
|
||||
case ID_SCH_MIRROR_X:
|
||||
return SCH_ACTIONS::mirrorX.MakeEvent();
|
||||
|
||||
case ID_SCH_MIRROR_Y:
|
||||
return SCH_ACTIONS::mirrorY.MakeEvent();
|
||||
}
|
||||
|
||||
return OPT<TOOL_EVENT>();
|
||||
|
|
|
@ -117,6 +117,8 @@ public:
|
|||
static TOOL_ACTION duplicate;
|
||||
static TOOL_ACTION rotateCW;
|
||||
static TOOL_ACTION rotateCCW;
|
||||
static TOOL_ACTION mirrorX;
|
||||
static TOOL_ACTION mirrorY;
|
||||
static TOOL_ACTION properties;
|
||||
static TOOL_ACTION remove;
|
||||
static TOOL_ACTION addJunction;
|
||||
|
|
|
@ -60,6 +60,16 @@ TOOL_ACTION SCH_ACTIONS::rotateCCW( "eeschema.InteractiveEdit.rotateCCW",
|
|||
_( "Rotate" ), _( "Rotates selected item(s) counter-clockwise" ),
|
||||
rotate_ccw_xpm, AF_NONE );
|
||||
|
||||
TOOL_ACTION SCH_ACTIONS::mirrorX( "eeschema.InteractiveEdit.mirrorX",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MIRROR_X ),
|
||||
_( "Mirror X" ), _( "Mirrors selected item(s) across the X axis" ),
|
||||
mirror_h_xpm, AF_NONE );
|
||||
|
||||
TOOL_ACTION SCH_ACTIONS::mirrorY( "eeschema.InteractiveEdit.mirrorY",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MIRROR_Y ),
|
||||
_( "Mirror Y" ), _( "Mirrors selected item(s) across the Y axis" ),
|
||||
mirror_v_xpm, AF_NONE );
|
||||
|
||||
TOOL_ACTION SCH_ACTIONS::properties( "eeschema.InteractiveEdit.properties",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT ),
|
||||
_( "Properties..." ), _( "Displays item properties dialog" ), config_xpm );
|
||||
|
@ -285,7 +295,7 @@ int SCH_EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
for( auto item : selection )
|
||||
item->ClearFlags( IS_MOVED );
|
||||
|
||||
//if( unselect || restore_state )
|
||||
if( unselect || restore_state )
|
||||
m_toolMgr->RunAction( SCH_ACTIONS::selectionClear, true );
|
||||
|
||||
if( restore_state )
|
||||
|
@ -392,30 +402,27 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
|
||||
case SCH_BITMAP_T:
|
||||
item->Rotate( item->GetPosition() );
|
||||
|
||||
// The bitmap is cached in Opengl: clear the cache to redraw
|
||||
getView()->RecacheAllItems();
|
||||
break;
|
||||
|
||||
case SCH_SHEET_T:
|
||||
{
|
||||
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
|
||||
|
||||
// Rotate the sheet on itself. Sheets do not have a anchor point.
|
||||
rotPoint = m_frame->GetNearestGridPosition( sheet->GetBoundingBox().Centre() );
|
||||
rotPoint = m_frame->GetNearestGridPosition( item->GetBoundingBox().Centre() );
|
||||
|
||||
if( clockwise )
|
||||
{
|
||||
sheet->Rotate( rotPoint );
|
||||
item->Rotate( rotPoint );
|
||||
}
|
||||
else
|
||||
{
|
||||
sheet->Rotate( rotPoint );
|
||||
sheet->Rotate( rotPoint );
|
||||
sheet->Rotate( rotPoint );
|
||||
item->Rotate( rotPoint );
|
||||
item->Rotate( rotPoint );
|
||||
item->Rotate( rotPoint );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -444,6 +451,151 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( !item->IsMoving() )
|
||||
{
|
||||
if( selection.IsHover() )
|
||||
m_toolMgr->RunAction( SCH_ACTIONS::selectionClear, true );
|
||||
|
||||
if( connections )
|
||||
m_frame->TestDanglingEnds();
|
||||
|
||||
m_frame->OnModify();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_SELECTION_TOOL* selTool = m_toolMgr->GetTool<SCH_SELECTION_TOOL>();
|
||||
SELECTION selection = selTool->RequestSelection( SCH_COLLECTOR::RotatableItems );
|
||||
|
||||
if( selection.GetSize() == 0 )
|
||||
return 0;
|
||||
|
||||
wxPoint mirrorPoint;
|
||||
bool xAxis = ( aEvent.Matches( SCH_ACTIONS::mirrorX.MakeEvent() ) );
|
||||
SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.GetItem( 0 ) );
|
||||
bool connections = false;
|
||||
bool moving = item->IsMoving();
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
{
|
||||
if( !moving )
|
||||
m_frame->SaveCopyInUndoList( item, UR_CHANGED );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_COMPONENT_T:
|
||||
{
|
||||
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
|
||||
|
||||
if( xAxis )
|
||||
component->SetOrientation( CMP_MIRROR_X );
|
||||
else
|
||||
component->SetOrientation( CMP_MIRROR_Y );
|
||||
|
||||
if( m_frame->GetAutoplaceFields() )
|
||||
component->AutoAutoplaceFields( m_frame->GetScreen() );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_TEXT_T:
|
||||
case SCH_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
case SCH_HIER_LABEL_T:
|
||||
{
|
||||
SCH_TEXT* textItem = static_cast<SCH_TEXT*>( item );
|
||||
int spin = textItem->GetLabelSpinStyle();
|
||||
|
||||
if( xAxis && spin % 2 )
|
||||
textItem->SetLabelSpinStyle( ( spin + 2 ) % 4 );
|
||||
else if ( !xAxis && !( spin % 2 ) )
|
||||
textItem->SetLabelSpinStyle( ( spin + 2 ) % 4 );
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_BUS_BUS_ENTRY_T:
|
||||
case SCH_BUS_WIRE_ENTRY_T:
|
||||
if( xAxis )
|
||||
item->MirrorX( item->GetPosition().y );
|
||||
else
|
||||
item->MirrorY( item->GetPosition().x );
|
||||
break;
|
||||
|
||||
case SCH_FIELD_T:
|
||||
{
|
||||
SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
|
||||
|
||||
if( xAxis )
|
||||
field->SetVertJustify( (EDA_TEXT_VJUSTIFY_T)-field->GetVertJustify() );
|
||||
else
|
||||
field->SetHorizJustify( (EDA_TEXT_HJUSTIFY_T)-field->GetHorizJustify() );
|
||||
|
||||
// Now that we're re-justifying a field, they're no longer autoplaced.
|
||||
if( item->GetParent()->Type() == SCH_COMPONENT_T )
|
||||
{
|
||||
SCH_COMPONENT *parent = static_cast<SCH_COMPONENT*>( item->GetParent() );
|
||||
parent->ClearFieldsAutoplaced();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_BITMAP_T:
|
||||
if( xAxis )
|
||||
item->MirrorX( item->GetPosition().y );
|
||||
else
|
||||
item->MirrorY( item->GetPosition().x );
|
||||
|
||||
// The bitmap is cached in Opengl: clear the cache to redraw
|
||||
getView()->RecacheAllItems();
|
||||
break;
|
||||
|
||||
case SCH_SHEET_T:
|
||||
// Mirror the sheet on itself. Sheets do not have a anchor point.
|
||||
mirrorPoint = m_frame->GetNearestGridPosition( item->GetBoundingBox().Centre() );
|
||||
|
||||
if( xAxis )
|
||||
item->MirrorX( mirrorPoint.y );
|
||||
else
|
||||
item->MirrorY( mirrorPoint.x );
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
connections = item->IsConnectable();
|
||||
m_frame->RefreshItem( item );
|
||||
}
|
||||
else if( selection.GetSize() > 1 )
|
||||
{
|
||||
mirrorPoint = m_frame->GetNearestGridPosition( (wxPoint)selection.GetCenter() );
|
||||
|
||||
for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
|
||||
{
|
||||
item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
|
||||
|
||||
if( !moving )
|
||||
m_frame->SaveCopyInUndoList( item, UR_CHANGED, ii > 0 );
|
||||
|
||||
if( xAxis )
|
||||
item->MirrorX( mirrorPoint.y );
|
||||
else
|
||||
item->MirrorY( mirrorPoint.x );
|
||||
|
||||
connections |= item->IsConnectable();
|
||||
m_frame->RefreshItem( item );
|
||||
}
|
||||
}
|
||||
|
||||
if( !item->IsMoving() )
|
||||
{
|
||||
if( selection.IsHover() )
|
||||
m_toolMgr->RunAction( SCH_ACTIONS::selectionClear, true );
|
||||
|
||||
if( connections )
|
||||
m_frame->TestDanglingEnds();
|
||||
|
||||
|
@ -505,5 +657,7 @@ void SCH_EDIT_TOOL::setTransitions()
|
|||
Go( &SCH_EDIT_TOOL::Main, SCH_ACTIONS::move.MakeEvent() );
|
||||
Go( &SCH_EDIT_TOOL::Rotate, SCH_ACTIONS::rotateCW.MakeEvent() );
|
||||
Go( &SCH_EDIT_TOOL::Rotate, SCH_ACTIONS::rotateCCW.MakeEvent() );
|
||||
Go( &SCH_EDIT_TOOL::Mirror, SCH_ACTIONS::mirrorX.MakeEvent() );
|
||||
Go( &SCH_EDIT_TOOL::Mirror, SCH_ACTIONS::mirrorY.MakeEvent() );
|
||||
Go( &SCH_EDIT_TOOL::Remove, SCH_ACTIONS::remove.MakeEvent() );
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
int Main( const TOOL_EVENT& aEvent );
|
||||
|
||||
int Rotate( const TOOL_EVENT& aEvent );
|
||||
int Mirror( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Function Remove()
|
||||
|
|
|
@ -332,6 +332,7 @@ SELECTION& SCH_SELECTION_TOOL::RequestSelection( const KICAD_T aFilterList[] )
|
|||
|
||||
clearSelection();
|
||||
SelectPoint( cursorPos, aFilterList );
|
||||
m_selection.SetIsHover( true );
|
||||
|
||||
return m_selection;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue