2019-05-08 18:56:03 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2019-08-14 08:28:07 +00:00
|
|
|
* Copyright (C) 2019 CERN
|
2019-05-08 18:56:03 +00:00
|
|
|
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <tool/tool_manager.h>
|
2019-07-15 23:44:01 +00:00
|
|
|
#include <tool/picker_tool.h>
|
2019-05-10 17:19:48 +00:00
|
|
|
#include <tools/ee_selection_tool.h>
|
2019-05-08 18:56:03 +00:00
|
|
|
#include <tools/lib_pin_tool.h>
|
|
|
|
#include <tools/lib_drawing_tools.h>
|
|
|
|
#include <tools/lib_move_tool.h>
|
2019-05-10 17:19:48 +00:00
|
|
|
#include <ee_actions.h>
|
2019-05-08 18:56:03 +00:00
|
|
|
#include <bitmaps.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <sch_view.h>
|
|
|
|
#include <lib_edit_frame.h>
|
|
|
|
#include <dialogs/dialog_lib_edit_draw_item.h>
|
|
|
|
#include <dialogs/dialog_lib_edit_text.h>
|
|
|
|
#include <dialogs/dialog_edit_one_field.h>
|
2019-05-11 14:38:05 +00:00
|
|
|
#include <dialogs/dialog_edit_component_in_lib.h>
|
|
|
|
#include <dialogs/dialog_lib_edit_pin_table.h>
|
2020-10-05 18:38:40 +00:00
|
|
|
#include <sch_plugins/kicad/sch_sexpr_plugin.h>
|
2019-08-15 07:19:15 +00:00
|
|
|
#include <lib_text.h>
|
2019-05-08 18:56:03 +00:00
|
|
|
#include "lib_edit_tool.h"
|
2020-01-07 17:12:59 +00:00
|
|
|
#include <math/util.h> // for KiROUND
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2019-05-12 11:49:58 +00:00
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
LIB_EDIT_TOOL::LIB_EDIT_TOOL() :
|
2020-01-11 16:56:25 +00:00
|
|
|
EE_TOOL_BASE( "eeschema.SymbolEditTool" ),
|
|
|
|
m_pickerItem( nullptr )
|
2019-05-08 18:56:03 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool LIB_EDIT_TOOL::Init()
|
|
|
|
{
|
2019-05-12 11:49:58 +00:00
|
|
|
EE_TOOL_BASE::Init();
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
LIB_DRAWING_TOOLS* drawingTools = m_toolMgr->GetTool<LIB_DRAWING_TOOLS>();
|
2019-05-12 11:49:58 +00:00
|
|
|
LIB_MOVE_TOOL* moveTool = m_toolMgr->GetTool<LIB_MOVE_TOOL>();
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2019-06-09 22:21:53 +00:00
|
|
|
wxASSERT_MSG( drawingTools, "eeschema.SymbolDrawing tool is not available" );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2020-08-20 23:05:21 +00:00
|
|
|
auto havePartCondition =
|
|
|
|
[&]( const SELECTION& sel )
|
|
|
|
{
|
|
|
|
return m_isLibEdit && static_cast<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
|
|
|
|
};
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
// Add edit actions to the move tool menu
|
|
|
|
//
|
|
|
|
if( moveTool )
|
|
|
|
{
|
|
|
|
CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu();
|
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
moveMenu.AddSeparator( 200 );
|
2019-05-12 11:49:58 +00:00
|
|
|
moveMenu.AddItem( EE_ACTIONS::rotateCCW, EE_CONDITIONS::NotEmpty, 200 );
|
|
|
|
moveMenu.AddItem( EE_ACTIONS::rotateCW, EE_CONDITIONS::NotEmpty, 200 );
|
|
|
|
moveMenu.AddItem( EE_ACTIONS::mirrorX, EE_CONDITIONS::NotEmpty, 200 );
|
|
|
|
moveMenu.AddItem( EE_ACTIONS::mirrorY, EE_CONDITIONS::NotEmpty, 200 );
|
2019-07-31 12:48:00 +00:00
|
|
|
moveMenu.AddItem( ACTIONS::doDelete, EE_CONDITIONS::NotEmpty, 200 );
|
2019-05-12 11:49:58 +00:00
|
|
|
|
|
|
|
moveMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ), 200 );
|
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
moveMenu.AddSeparator( 300 );
|
2019-05-14 19:21:10 +00:00
|
|
|
moveMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
|
|
|
|
moveMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
|
2019-05-27 10:40:52 +00:00
|
|
|
moveMenu.AddItem( ACTIONS::duplicate, EE_CONDITIONS::NotEmpty, 300 );
|
2020-08-20 23:05:21 +00:00
|
|
|
|
|
|
|
moveMenu.AddSeparator( 400 );
|
|
|
|
moveMenu.AddItem( ACTIONS::selectAll, havePartCondition, 400 );
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add editing actions to the drawing tool menu
|
|
|
|
//
|
|
|
|
CONDITIONAL_MENU& drawMenu = drawingTools->GetToolMenu().GetMenu();
|
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
drawMenu.AddSeparator( 200 );
|
2019-05-27 10:40:52 +00:00
|
|
|
drawMenu.AddItem( EE_ACTIONS::rotateCCW, EE_CONDITIONS::IdleSelection, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::rotateCW, EE_CONDITIONS::IdleSelection, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::mirrorX, EE_CONDITIONS::IdleSelection, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::mirrorY, EE_CONDITIONS::IdleSelection, 200 );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2019-05-27 10:40:52 +00:00
|
|
|
drawMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ), 200 );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
// Add editing actions to the selection tool menu
|
|
|
|
//
|
|
|
|
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
selToolMenu.AddItem( EE_ACTIONS::rotateCCW, EE_CONDITIONS::NotEmpty, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::rotateCW, EE_CONDITIONS::NotEmpty, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::mirrorX, EE_CONDITIONS::NotEmpty, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::mirrorY, EE_CONDITIONS::NotEmpty, 200 );
|
2019-07-31 12:48:00 +00:00
|
|
|
selToolMenu.AddItem( ACTIONS::doDelete, EE_CONDITIONS::NotEmpty, 200 );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
selToolMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ), 200 );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
selToolMenu.AddSeparator( 300 );
|
2019-05-14 19:21:10 +00:00
|
|
|
selToolMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
|
|
|
|
selToolMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
|
|
|
|
selToolMenu.AddItem( ACTIONS::paste, EE_CONDITIONS::Idle, 300 );
|
2019-05-27 10:40:52 +00:00
|
|
|
selToolMenu.AddItem( ACTIONS::duplicate, EE_CONDITIONS::NotEmpty, 300 );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2020-08-20 23:05:21 +00:00
|
|
|
selToolMenu.AddSeparator( 400 );
|
|
|
|
selToolMenu.AddItem( ACTIONS::selectAll, havePartCondition, 400 );
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int LIB_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection();
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
if( selection.GetSize() == 0 )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
wxPoint rotPoint;
|
2019-05-10 17:19:48 +00:00
|
|
|
bool ccw = ( aEvent.Matches( EE_ACTIONS::rotateCCW.MakeEvent() ) );
|
2019-05-08 18:56:03 +00:00
|
|
|
LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
|
|
|
|
|
|
|
|
if( !item->IsMoving() )
|
2020-08-26 18:04:32 +00:00
|
|
|
saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
if( selection.GetSize() == 1 )
|
|
|
|
rotPoint = item->GetPosition();
|
|
|
|
else
|
|
|
|
rotPoint = m_frame->GetNearestGridPosition( mapCoords( selection.GetCenter() ) );
|
|
|
|
|
|
|
|
for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
|
|
|
|
{
|
|
|
|
item = static_cast<LIB_ITEM*>( selection.GetItem( ii ) );
|
|
|
|
item->Rotate( rotPoint, ccw );
|
2020-08-10 11:40:58 +00:00
|
|
|
m_frame->UpdateItem( item );
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|
|
|
|
|
2019-08-08 13:09:19 +00:00
|
|
|
if( item->IsMoving() )
|
|
|
|
m_toolMgr->RunAction( ACTIONS::refreshPreview, true );
|
|
|
|
else
|
2019-05-08 18:56:03 +00:00
|
|
|
{
|
2019-08-08 13:09:19 +00:00
|
|
|
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
if( selection.IsHover() )
|
2019-05-10 17:19:48 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
m_frame->OnModify();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int LIB_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection();
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
if( selection.GetSize() == 0 )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
wxPoint mirrorPoint;
|
2019-05-10 17:19:48 +00:00
|
|
|
bool xAxis = ( aEvent.Matches( EE_ACTIONS::mirrorX.MakeEvent() ) );
|
2019-05-08 18:56:03 +00:00
|
|
|
LIB_ITEM* item = static_cast<LIB_ITEM*>( selection.Front() );
|
|
|
|
|
|
|
|
if( !item->IsMoving() )
|
2020-08-26 18:04:32 +00:00
|
|
|
saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
if( selection.GetSize() == 1 )
|
|
|
|
mirrorPoint = item->GetPosition();
|
|
|
|
else
|
|
|
|
mirrorPoint = m_frame->GetNearestGridPosition( mapCoords( selection.GetCenter() ) );
|
|
|
|
|
|
|
|
for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
|
|
|
|
{
|
|
|
|
item = static_cast<LIB_ITEM*>( selection.GetItem( ii ) );
|
|
|
|
|
|
|
|
if( xAxis )
|
|
|
|
item->MirrorVertical( mirrorPoint );
|
|
|
|
else
|
|
|
|
item->MirrorHorizontal( mirrorPoint );
|
|
|
|
|
2020-08-10 11:40:58 +00:00
|
|
|
m_frame->UpdateItem( item );
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
|
|
|
|
2019-08-08 13:09:19 +00:00
|
|
|
if( item->IsMoving() )
|
|
|
|
m_toolMgr->RunAction( ACTIONS::refreshPreview, true );
|
|
|
|
else
|
2019-05-08 18:56:03 +00:00
|
|
|
{
|
|
|
|
if( selection.IsHover() )
|
2019-05-10 17:19:48 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
m_frame->OnModify();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static KICAD_T nonFields[] =
|
|
|
|
{
|
|
|
|
LIB_PART_T,
|
|
|
|
LIB_ARC_T,
|
|
|
|
LIB_CIRCLE_T,
|
|
|
|
LIB_TEXT_T,
|
|
|
|
LIB_RECTANGLE_T,
|
|
|
|
LIB_POLYLINE_T,
|
|
|
|
LIB_BEZIER_T,
|
|
|
|
LIB_PIN_T,
|
|
|
|
EOT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int LIB_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
LIB_PART* part = m_frame->GetCurPart();
|
|
|
|
auto items = m_selectionTool->RequestSelection( nonFields ).GetItems();
|
|
|
|
|
|
|
|
if( items.empty() )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
// Don't leave a freed pointer in the selection
|
2019-05-10 17:19:48 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2020-08-26 18:04:32 +00:00
|
|
|
saveCopyInUndoList( part, UNDO_REDO::LIBEDIT );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2019-05-22 19:35:03 +00:00
|
|
|
std::set<LIB_ITEM *> toDelete;
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
for( EDA_ITEM* item : items )
|
|
|
|
{
|
|
|
|
if( item->Type() == LIB_PIN_T )
|
|
|
|
{
|
|
|
|
LIB_PIN* pin = static_cast<LIB_PIN*>( item );
|
|
|
|
wxPoint pos = pin->GetPosition();
|
|
|
|
|
2019-05-22 19:35:03 +00:00
|
|
|
toDelete.insert( pin );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
// when pin editing is synchronized, all pins of the same body style are removed:
|
|
|
|
if( m_frame->SynchronizePins() )
|
|
|
|
{
|
|
|
|
int curr_convert = pin->GetConvert();
|
|
|
|
LIB_PIN* next_pin = part->GetNextPin();
|
|
|
|
|
|
|
|
while( next_pin != NULL )
|
|
|
|
{
|
|
|
|
pin = next_pin;
|
|
|
|
next_pin = part->GetNextPin( pin );
|
|
|
|
|
|
|
|
if( pin->GetPosition() != pos )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( pin->GetConvert() != curr_convert )
|
|
|
|
continue;
|
|
|
|
|
2019-05-22 19:35:03 +00:00
|
|
|
toDelete.insert( pin );
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-05-22 19:35:03 +00:00
|
|
|
toDelete.insert( (LIB_ITEM*) item );
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-22 19:35:03 +00:00
|
|
|
for( auto item : toDelete )
|
|
|
|
{
|
|
|
|
part->RemoveDrawItem( item );
|
|
|
|
}
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
m_frame->RebuildView();
|
|
|
|
m_frame->OnModify();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-24 15:27:05 +00:00
|
|
|
#define HITTEST_THRESHOLD_PIXELS 5
|
|
|
|
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
int LIB_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-07-15 23:44:01 +00:00
|
|
|
std::string tool = aEvent.GetCommandStr().get();
|
|
|
|
PICKER_TOOL* picker = m_toolMgr->GetTool<PICKER_TOOL>();
|
|
|
|
|
2019-06-24 15:27:05 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
2019-07-15 23:44:01 +00:00
|
|
|
m_pickerItem = nullptr;
|
2019-06-24 15:27:05 +00:00
|
|
|
|
2019-07-19 20:47:33 +00:00
|
|
|
// Deactivate other tools; particularly important if another PICKER is currently running
|
|
|
|
Activate();
|
|
|
|
|
2020-10-08 00:50:28 +00:00
|
|
|
picker->SetCursor( KICURSOR::REMOVE );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2019-07-15 23:44:01 +00:00
|
|
|
picker->SetClickHandler(
|
|
|
|
[this] ( const VECTOR2D& aPosition ) -> bool
|
|
|
|
{
|
|
|
|
if( m_pickerItem )
|
|
|
|
{
|
|
|
|
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
|
|
|
selectionTool->UnbrightenItem( m_pickerItem );
|
2019-09-08 18:43:54 +00:00
|
|
|
selectionTool->AddItemToSel( m_pickerItem, true /*quiet mode*/ );
|
2019-07-31 12:48:00 +00:00
|
|
|
m_toolMgr->RunAction( ACTIONS::doDelete, true );
|
2019-07-15 23:44:01 +00:00
|
|
|
m_pickerItem = nullptr;
|
|
|
|
}
|
2019-06-24 15:27:05 +00:00
|
|
|
|
2019-07-15 23:44:01 +00:00
|
|
|
return true;
|
|
|
|
} );
|
|
|
|
|
|
|
|
picker->SetMotionHandler(
|
|
|
|
[this] ( const VECTOR2D& aPos )
|
2019-06-24 15:27:05 +00:00
|
|
|
{
|
2019-08-01 04:31:19 +00:00
|
|
|
EE_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
2019-07-15 23:44:01 +00:00
|
|
|
EE_COLLECTOR collector;
|
|
|
|
collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
|
2019-06-25 23:39:58 +00:00
|
|
|
collector.Collect( m_frame->GetScreen(), nonFields, (wxPoint) aPos, m_frame->GetUnit(),
|
|
|
|
m_frame->GetConvert() );
|
2019-07-15 23:44:01 +00:00
|
|
|
|
2019-08-01 04:31:19 +00:00
|
|
|
// Remove unselectable items
|
|
|
|
for( int i = collector.GetCount() - 1; i >= 0; --i )
|
|
|
|
{
|
|
|
|
if( !selectionTool->Selectable( collector[ i ] ) )
|
|
|
|
collector.Remove( i );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( collector.GetCount() > 1 )
|
|
|
|
selectionTool->GuessSelectionCandidates( collector, aPos );
|
2019-06-24 15:27:05 +00:00
|
|
|
|
2019-07-15 23:44:01 +00:00
|
|
|
EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
|
2019-06-24 15:27:05 +00:00
|
|
|
|
2019-07-15 23:44:01 +00:00
|
|
|
if( m_pickerItem != item )
|
|
|
|
{
|
|
|
|
if( m_pickerItem )
|
|
|
|
selectionTool->UnbrightenItem( m_pickerItem );
|
2019-06-28 19:11:26 +00:00
|
|
|
|
2019-07-15 23:44:01 +00:00
|
|
|
m_pickerItem = item;
|
2019-06-28 19:11:26 +00:00
|
|
|
|
2019-07-15 23:44:01 +00:00
|
|
|
if( m_pickerItem )
|
|
|
|
selectionTool->BrightenItem( m_pickerItem );
|
|
|
|
}
|
|
|
|
} );
|
2019-06-24 15:27:05 +00:00
|
|
|
|
2019-07-15 23:44:01 +00:00
|
|
|
picker->SetFinalizeHandler(
|
|
|
|
[this] ( const int& aFinalState )
|
2019-06-25 13:01:22 +00:00
|
|
|
{
|
|
|
|
if( m_pickerItem )
|
2019-07-15 23:44:01 +00:00
|
|
|
m_toolMgr->GetTool<EE_SELECTION_TOOL>()->UnbrightenItem( m_pickerItem );
|
2020-10-11 17:12:13 +00:00
|
|
|
|
|
|
|
// Wake the selection tool after exiting to ensure the cursor gets updated
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
|
2019-07-15 23:44:01 +00:00
|
|
|
} );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2019-07-15 23:44:01 +00:00
|
|
|
m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
|
2019-07-15 12:15:58 +00:00
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int LIB_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection();
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2019-05-11 14:38:05 +00:00
|
|
|
if( selection.Empty() || aEvent.IsAction( &EE_ACTIONS::symbolProperties ) )
|
2019-05-08 18:56:03 +00:00
|
|
|
{
|
2019-05-11 14:38:05 +00:00
|
|
|
if( m_frame->GetCurPart() )
|
|
|
|
editSymbolProperties();
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|
|
|
|
else if( selection.Size() == 1 )
|
|
|
|
{
|
|
|
|
LIB_ITEM* item = (LIB_ITEM*) selection.Front();
|
|
|
|
|
|
|
|
// Save copy for undo if not in edit (edit command already handle the save copy)
|
2019-07-02 20:09:23 +00:00
|
|
|
if( item->GetEditFlags() == 0 )
|
2020-08-26 18:04:32 +00:00
|
|
|
saveCopyInUndoList( item->GetParent(), UNDO_REDO::LIBEDIT );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
switch( item->Type() )
|
|
|
|
{
|
|
|
|
case LIB_PIN_T:
|
|
|
|
{
|
|
|
|
LIB_PIN_TOOL* pinTool = m_toolMgr->GetTool<LIB_PIN_TOOL>();
|
|
|
|
|
|
|
|
if( pinTool )
|
|
|
|
pinTool->EditPinProperties( (LIB_PIN*) item );
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case LIB_ARC_T:
|
|
|
|
case LIB_CIRCLE_T:
|
|
|
|
case LIB_RECTANGLE_T:
|
|
|
|
case LIB_POLYLINE_T:
|
|
|
|
editGraphicProperties( item );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LIB_TEXT_T:
|
|
|
|
editTextProperties( item );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LIB_FIELD_T:
|
|
|
|
editFieldProperties( (LIB_FIELD*) item );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
wxFAIL_MSG( wxT( "Unhandled item <" ) + item->GetClass() + wxT( ">" ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_TOOL::editGraphicProperties( LIB_ITEM* aItem )
|
|
|
|
{
|
|
|
|
if( aItem == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
DIALOG_LIB_EDIT_DRAW_ITEM dialog( m_frame, aItem );
|
|
|
|
|
|
|
|
if( dialog.ShowModal() != wxID_OK )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( aItem->IsFillable() )
|
2020-10-15 01:45:20 +00:00
|
|
|
aItem->SetFillMode( (FILL_TYPE) dialog.GetFillStyle() );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
aItem->SetWidth( dialog.GetWidth() );
|
|
|
|
|
2019-07-01 10:36:46 +00:00
|
|
|
if( dialog.GetApplyToAllConversions() )
|
|
|
|
aItem->SetConvert( 0 );
|
|
|
|
else
|
|
|
|
aItem->SetConvert( m_frame->GetConvert() );
|
|
|
|
|
|
|
|
if( dialog.GetApplyToAllUnits() )
|
|
|
|
aItem->SetUnit( 0 );
|
|
|
|
else
|
|
|
|
aItem->SetUnit( m_frame->GetUnit() );
|
|
|
|
|
2019-05-12 11:49:58 +00:00
|
|
|
updateView( aItem );
|
2019-05-08 18:56:03 +00:00
|
|
|
m_frame->GetCanvas()->Refresh();
|
|
|
|
m_frame->OnModify( );
|
|
|
|
|
2020-05-23 15:50:08 +00:00
|
|
|
LIB_DRAWING_TOOLS* drawingTools = m_toolMgr->GetTool<LIB_DRAWING_TOOLS>();
|
|
|
|
drawingTools->SetDrawSpecificConvert( !dialog.GetApplyToAllConversions() );
|
|
|
|
drawingTools->SetDrawSpecificUnit( !dialog.GetApplyToAllUnits() );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
MSG_PANEL_ITEMS items;
|
2020-04-24 13:36:10 +00:00
|
|
|
aItem->GetMsgPanelInfo( m_frame, items );
|
2019-05-08 18:56:03 +00:00
|
|
|
m_frame->SetMsgPanel( items );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_TOOL::editTextProperties( LIB_ITEM* aItem )
|
|
|
|
{
|
|
|
|
if ( ( aItem == NULL ) || ( aItem->Type() != LIB_TEXT_T ) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
DIALOG_LIB_EDIT_TEXT dlg( m_frame, (LIB_TEXT*) aItem );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() != wxID_OK )
|
|
|
|
return;
|
|
|
|
|
2019-05-12 11:49:58 +00:00
|
|
|
updateView( aItem );
|
2019-05-08 18:56:03 +00:00
|
|
|
m_frame->GetCanvas()->Refresh();
|
|
|
|
m_frame->OnModify( );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_TOOL::editFieldProperties( LIB_FIELD* aField )
|
|
|
|
{
|
|
|
|
if( aField == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxString caption;
|
|
|
|
LIB_PART* parent = aField->GetParent();
|
|
|
|
wxCHECK( parent, /* void */ );
|
|
|
|
|
|
|
|
// Editing the component value field is equivalent to creating a new component based
|
|
|
|
// on the current component. Set the dialog message to inform the user.
|
|
|
|
if( aField->GetId() == VALUE )
|
|
|
|
caption = _( "Edit Component Name" );
|
|
|
|
else
|
2020-03-26 11:02:59 +00:00
|
|
|
caption.Printf( _( "Edit %s Field" ), aField->GetName() );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
DIALOG_LIB_EDIT_ONE_FIELD dlg( m_frame, caption, aField );
|
|
|
|
|
|
|
|
// The dialog may invoke a kiway player for footprint fields
|
|
|
|
// so we must use a quasimodal dialog.
|
|
|
|
if( dlg.ShowQuasiModal() != wxID_OK )
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxString newFieldValue = LIB_ID::FixIllegalChars( dlg.GetText(), LIB_ID::ID_SCH );
|
|
|
|
wxString oldFieldValue = aField->GetFullText( m_frame->GetUnit() );
|
|
|
|
bool renamed = aField->GetId() == VALUE && newFieldValue != oldFieldValue;
|
|
|
|
|
|
|
|
if( renamed )
|
2020-08-26 18:04:32 +00:00
|
|
|
saveCopyInUndoList( parent, UNDO_REDO::LIB_RENAME );
|
2019-05-11 14:38:05 +00:00
|
|
|
else
|
2020-08-26 18:04:32 +00:00
|
|
|
saveCopyInUndoList( parent, UNDO_REDO::LIBEDIT );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
dlg.UpdateField( aField );
|
|
|
|
|
2019-05-11 14:38:05 +00:00
|
|
|
if( renamed )
|
2020-07-22 14:10:19 +00:00
|
|
|
{
|
2019-05-11 14:38:05 +00:00
|
|
|
parent->SetName( newFieldValue );
|
2020-07-22 14:10:19 +00:00
|
|
|
m_frame->UpdateAfterSymbolProperties( &oldFieldValue );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
updateView( aField );
|
|
|
|
m_frame->GetCanvas()->Refresh();
|
|
|
|
m_frame->OnModify();
|
|
|
|
m_frame->DisplayCmpDoc();
|
|
|
|
}
|
2019-05-11 14:38:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_TOOL::editSymbolProperties()
|
|
|
|
{
|
|
|
|
LIB_PART* part = m_frame->GetCurPart();
|
|
|
|
bool partLocked = part->UnitsLocked();
|
|
|
|
wxString oldName = part->GetName();
|
|
|
|
|
|
|
|
m_toolMgr->RunAction( ACTIONS::cancelInteractive, true );
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
|
|
|
|
|
|
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY dlg( m_frame, part );
|
|
|
|
|
|
|
|
// This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
|
|
|
|
// frame. Therefore this dialog as a modal frame parent, MUST be run under
|
|
|
|
// quasimodal mode for the quasimodal frame support to work. So don't use
|
|
|
|
// the QUASIMODAL macros here.
|
|
|
|
if( dlg.ShowQuasiModal() != wxID_OK )
|
|
|
|
return;
|
|
|
|
|
2019-11-06 19:15:42 +00:00
|
|
|
m_frame->OnModify();
|
|
|
|
|
2019-05-11 14:38:05 +00:00
|
|
|
// if m_UnitSelectionLocked has changed, set some edit options or defaults
|
|
|
|
// to the best value
|
|
|
|
if( partLocked != part->UnitsLocked() )
|
|
|
|
{
|
2020-05-23 15:50:08 +00:00
|
|
|
LIB_DRAWING_TOOLS* tools = m_toolMgr->GetTool<LIB_DRAWING_TOOLS>();
|
|
|
|
|
2019-05-11 14:38:05 +00:00
|
|
|
// Enable synchronized pin edit mode for symbols with interchangeable units
|
|
|
|
m_frame->m_SyncPinEdit = !part->UnitsLocked();
|
2020-05-23 15:50:08 +00:00
|
|
|
|
2019-05-11 14:38:05 +00:00
|
|
|
// also set default edit options to the better value
|
|
|
|
// Usually if units are locked, graphic items are specific to each unit
|
|
|
|
// and if units are interchangeable, graphic items are common to units
|
2020-05-23 15:50:08 +00:00
|
|
|
tools->SetDrawSpecificUnit( part->UnitsLocked() );
|
2019-05-11 14:38:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int LIB_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
LIB_PART* part = m_frame->GetCurPart();
|
|
|
|
|
2019-05-16 22:50:29 +00:00
|
|
|
if( !part )
|
|
|
|
return 0;
|
|
|
|
|
2019-05-11 14:38:05 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
|
|
|
|
2020-08-26 18:04:32 +00:00
|
|
|
saveCopyInUndoList( part, UNDO_REDO::LIBEDIT );
|
2019-05-11 14:38:05 +00:00
|
|
|
|
|
|
|
DIALOG_LIB_EDIT_PIN_TABLE dlg( m_frame, part );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
m_frame->RebuildView();
|
|
|
|
m_frame->OnModify();
|
|
|
|
|
|
|
|
return 0;
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
int LIB_EDIT_TOOL::Undo( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
m_frame->GetComponentFromUndoList();
|
2019-06-29 18:57:23 +00:00
|
|
|
|
|
|
|
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
|
|
|
selTool->RebuildSelection();
|
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int LIB_EDIT_TOOL::Redo( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
m_frame->GetComponentFromRedoList();
|
2019-06-29 18:57:23 +00:00
|
|
|
|
|
|
|
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
|
|
|
|
selTool->RebuildSelection();
|
|
|
|
|
2019-05-14 19:21:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
int LIB_EDIT_TOOL::Cut( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
int retVal = Copy( aEvent );
|
|
|
|
|
|
|
|
if( retVal == 0 )
|
|
|
|
retVal = DoDelete( aEvent );
|
|
|
|
|
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int LIB_EDIT_TOOL::Copy( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
LIB_PART* part = m_frame->GetCurPart();
|
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection( nonFields );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
if( !part || !selection.GetSize() )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
for( LIB_ITEM& item : part->GetDrawItems() )
|
|
|
|
{
|
|
|
|
if( item.Type() == LIB_FIELD_T )
|
|
|
|
continue;
|
|
|
|
|
2019-08-27 12:12:34 +00:00
|
|
|
wxASSERT( !item.HasFlag( STRUCT_DELETED ) );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
if( !item.IsSelected() )
|
|
|
|
item.SetFlags( STRUCT_DELETED );
|
|
|
|
}
|
|
|
|
|
|
|
|
LIB_PART* partCopy = new LIB_PART( *part );
|
|
|
|
|
|
|
|
STRING_FORMATTER formatter;
|
2020-05-13 21:58:30 +00:00
|
|
|
SCH_SEXPR_PLUGIN::FormatPart( partCopy, formatter );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
delete partCopy;
|
|
|
|
|
|
|
|
for( LIB_ITEM& item : part->GetDrawItems() )
|
|
|
|
item.ClearFlags( STRUCT_DELETED );
|
|
|
|
|
|
|
|
if( m_toolMgr->SaveClipboard( formatter.GetString() ) )
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int LIB_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
LIB_PART* part = m_frame->GetCurPart();
|
|
|
|
|
|
|
|
if( !part )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
std::string text = m_toolMgr->GetClipboard();
|
|
|
|
STRING_LINE_READER reader( text, "Clipboard" );
|
|
|
|
LIB_PART* newPart;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2020-05-13 21:58:30 +00:00
|
|
|
newPart = SCH_SEXPR_PLUGIN::ParsePart( reader );
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|
2020-02-29 21:53:51 +00:00
|
|
|
catch( IO_ERROR& )
|
2019-05-08 18:56:03 +00:00
|
|
|
{
|
2019-08-15 07:19:15 +00:00
|
|
|
// If it's not a part then paste as text
|
|
|
|
newPart = new LIB_PART( "dummy_part" );
|
2020-04-18 20:04:41 +00:00
|
|
|
LIB_TEXT* newText = new LIB_TEXT( newPart );
|
2019-08-15 07:19:15 +00:00
|
|
|
newText->SetText( text );
|
|
|
|
newPart->AddDrawItem( newText );
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|
|
|
|
|
2019-06-02 14:55:54 +00:00
|
|
|
if( !newPart )
|
|
|
|
return -1;
|
|
|
|
|
2019-05-16 22:50:29 +00:00
|
|
|
m_frame->SaveCopyInUndoList( part );
|
2019-05-27 09:07:13 +00:00
|
|
|
m_selectionTool->ClearSelection();
|
2019-05-16 22:50:29 +00:00
|
|
|
|
2020-03-21 20:54:35 +00:00
|
|
|
for( LIB_ITEM& item : part->GetDrawItems() )
|
|
|
|
item.ClearFlags( IS_NEW | IS_PASTED | SELECTED );
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
for( LIB_ITEM& item : newPart->GetDrawItems() )
|
|
|
|
{
|
|
|
|
if( item.Type() == LIB_FIELD_T )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
LIB_ITEM* newItem = (LIB_ITEM*) item.Clone();
|
2019-06-11 08:21:40 +00:00
|
|
|
newItem->SetParent( part );
|
2019-05-27 09:07:13 +00:00
|
|
|
newItem->SetFlags( IS_NEW | IS_PASTED | SELECTED );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2019-11-12 14:11:08 +00:00
|
|
|
newItem->SetUnit( newItem->GetUnit() ? m_frame->GetUnit() : 0 );
|
|
|
|
newItem->SetConvert( newItem->GetConvert() ? m_frame->GetConvert() : 0 );
|
2019-06-29 21:20:21 +00:00
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
part->GetDrawItems().push_back( newItem );
|
|
|
|
getView()->Add( newItem );
|
|
|
|
}
|
|
|
|
|
|
|
|
delete newPart;
|
|
|
|
|
2019-05-27 09:07:13 +00:00
|
|
|
m_selectionTool->RebuildSelection();
|
|
|
|
|
2020-03-21 20:54:35 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->GetSelection();
|
|
|
|
|
2019-05-27 09:07:13 +00:00
|
|
|
if( !selection.Empty() )
|
|
|
|
{
|
2019-05-27 12:18:55 +00:00
|
|
|
selection.SetReferencePoint( getViewControls()->GetCursorPosition( true ) );
|
2019-05-27 10:40:52 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::move, false );
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int LIB_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
LIB_PART* part = m_frame->GetCurPart();
|
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection( nonFields );
|
2019-05-27 10:40:52 +00:00
|
|
|
|
|
|
|
if( selection.GetSize() == 0 )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
// Doing a duplicate of a new object doesn't really make any sense; we'd just end
|
|
|
|
// up dragging around a stack of objects...
|
|
|
|
if( selection.Front()->IsNew() )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if( !selection.Front()->IsMoving() )
|
2020-08-26 18:04:32 +00:00
|
|
|
saveCopyInUndoList( m_frame->GetCurPart(), UNDO_REDO::LIBEDIT );
|
2019-05-27 10:40:52 +00:00
|
|
|
|
2019-09-07 19:51:30 +00:00
|
|
|
EDA_ITEMS newItems;
|
|
|
|
|
2019-05-27 10:40:52 +00:00
|
|
|
for( unsigned ii = 0; ii < selection.GetSize(); ++ii )
|
|
|
|
{
|
|
|
|
LIB_ITEM* oldItem = static_cast<LIB_ITEM*>( selection.GetItem( ii ) );
|
|
|
|
LIB_ITEM* newItem = (LIB_ITEM*) oldItem->Clone();
|
2020-03-21 20:54:35 +00:00
|
|
|
oldItem->ClearFlags( IS_NEW | IS_PASTED | SELECTED );
|
2019-05-27 10:40:52 +00:00
|
|
|
newItem->SetFlags( IS_NEW | IS_PASTED | SELECTED );
|
2019-08-02 03:39:52 +00:00
|
|
|
newItem->SetParent( part );
|
2019-09-07 19:51:30 +00:00
|
|
|
newItems.push_back( newItem );
|
2019-05-27 10:40:52 +00:00
|
|
|
|
|
|
|
part->GetDrawItems().push_back( newItem );
|
|
|
|
getView()->Add( newItem );
|
|
|
|
}
|
|
|
|
|
2019-09-07 19:51:30 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &newItems );
|
2019-05-27 10:40:52 +00:00
|
|
|
|
2019-09-07 19:51:30 +00:00
|
|
|
selection.SetReferencePoint( mapCoords( getViewControls()->GetCursorPosition( true ) ) );
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::move, false );
|
2019-05-08 18:56:03 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_EDIT_TOOL::setTransitions()
|
|
|
|
{
|
2019-05-27 12:18:55 +00:00
|
|
|
Go( &LIB_EDIT_TOOL::Undo, ACTIONS::undo.MakeEvent() );
|
|
|
|
Go( &LIB_EDIT_TOOL::Redo, ACTIONS::redo.MakeEvent() );
|
|
|
|
Go( &LIB_EDIT_TOOL::Cut, ACTIONS::cut.MakeEvent() );
|
|
|
|
Go( &LIB_EDIT_TOOL::Copy, ACTIONS::copy.MakeEvent() );
|
|
|
|
Go( &LIB_EDIT_TOOL::Paste, ACTIONS::paste.MakeEvent() );
|
2019-05-27 10:40:52 +00:00
|
|
|
Go( &LIB_EDIT_TOOL::Duplicate, ACTIONS::duplicate.MakeEvent() );
|
2019-05-27 12:18:55 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
Go( &LIB_EDIT_TOOL::Rotate, EE_ACTIONS::rotateCW.MakeEvent() );
|
|
|
|
Go( &LIB_EDIT_TOOL::Rotate, EE_ACTIONS::rotateCCW.MakeEvent() );
|
|
|
|
Go( &LIB_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorX.MakeEvent() );
|
|
|
|
Go( &LIB_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorY.MakeEvent() );
|
2019-07-31 12:48:00 +00:00
|
|
|
Go( &LIB_EDIT_TOOL::DoDelete, ACTIONS::doDelete.MakeEvent() );
|
2019-07-31 12:10:13 +00:00
|
|
|
Go( &LIB_EDIT_TOOL::DeleteItemCursor, ACTIONS::deleteTool.MakeEvent() );
|
2019-05-10 17:19:48 +00:00
|
|
|
|
|
|
|
Go( &LIB_EDIT_TOOL::Properties, EE_ACTIONS::properties.MakeEvent() );
|
2019-05-11 14:38:05 +00:00
|
|
|
Go( &LIB_EDIT_TOOL::Properties, EE_ACTIONS::symbolProperties.MakeEvent() );
|
|
|
|
Go( &LIB_EDIT_TOOL::PinTable, EE_ACTIONS::pinTable.MakeEvent() );
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|