2019-04-21 23:45:34 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2019-04-23 13:06:37 +00:00
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tools/sch_edit_tool.h>
|
2019-05-10 17:19:48 +00:00
|
|
|
#include <tools/ee_selection_tool.h>
|
2019-05-05 14:16:29 +00:00
|
|
|
#include <tools/sch_wire_bus_tool.h>
|
2019-05-10 17:19:48 +00:00
|
|
|
#include <tools/ee_picker_tool.h>
|
2019-05-04 13:02:05 +00:00
|
|
|
#include <tools/sch_move_tool.h>
|
2019-05-10 17:19:48 +00:00
|
|
|
#include <ee_actions.h>
|
2019-04-21 23:45:34 +00:00
|
|
|
#include <bitmaps.h>
|
2019-04-23 17:40:29 +00:00
|
|
|
#include <confirm.h>
|
2019-04-28 23:34:43 +00:00
|
|
|
#include <eda_doc.h>
|
|
|
|
#include <base_struct.h>
|
2019-05-10 19:57:24 +00:00
|
|
|
#include <sch_item.h>
|
2019-04-23 17:40:29 +00:00
|
|
|
#include <sch_component.h>
|
|
|
|
#include <sch_sheet.h>
|
|
|
|
#include <sch_text.h>
|
|
|
|
#include <sch_bitmap.h>
|
2019-04-23 13:06:37 +00:00
|
|
|
#include <sch_view.h>
|
2019-04-27 14:32:40 +00:00
|
|
|
#include <sch_line.h>
|
2019-05-10 19:57:24 +00:00
|
|
|
#include <sch_item.h>
|
2019-04-29 17:50:46 +00:00
|
|
|
#include <sch_bus_entry.h>
|
2019-04-23 13:06:37 +00:00
|
|
|
#include <sch_edit_frame.h>
|
2019-04-27 23:50:35 +00:00
|
|
|
#include <eeschema_id.h>
|
2019-04-28 16:36:31 +00:00
|
|
|
#include <status_popup.h>
|
2019-04-30 13:54:32 +00:00
|
|
|
#include <wx/gdicmn.h>
|
2019-06-03 13:49:17 +00:00
|
|
|
#include <invoke_sch_dialog.h>
|
2019-05-07 18:49:53 +00:00
|
|
|
#include "sch_drawing_tools.h"
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2019-04-27 14:32:40 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::repeatDrawItem( "eeschema.InteractiveEdit.repeatDrawItem",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL,
|
|
|
|
WXK_INSERT, LEGACY_HK_NAME( "Repeat Last Item" ),
|
2019-04-29 10:41:27 +00:00
|
|
|
_( "Repeat Last Item" ), _( "Duplicates the last drawn item" ),
|
|
|
|
nullptr );
|
2019-04-26 22:23:12 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::rotateCW( "eeschema.InteractiveEdit.rotateCW",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-04-29 10:41:27 +00:00
|
|
|
_( "Rotate Clockwise" ), _( "Rotates selected item(s) clockwise" ),
|
|
|
|
rotate_cw_xpm );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::rotateCCW( "eeschema.InteractiveEdit.rotateCCW",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL,
|
|
|
|
'R', LEGACY_HK_NAME( "Rotate Item" ),
|
2019-04-29 10:41:27 +00:00
|
|
|
_( "Rotate" ), _( "Rotates selected item(s) counter-clockwise" ),
|
|
|
|
rotate_ccw_xpm );
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::mirrorX( "eeschema.InteractiveEdit.mirrorX",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL,
|
|
|
|
'X', LEGACY_HK_NAME( "Mirror X" ),
|
2019-04-29 10:41:27 +00:00
|
|
|
_( "Mirror Around Horizontal Axis" ), _( "Flips selected item(s) from top to bottom" ),
|
2019-05-11 09:33:19 +00:00
|
|
|
mirror_v_xpm );
|
2019-04-26 16:34:04 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::mirrorY( "eeschema.InteractiveEdit.mirrorY",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL,
|
|
|
|
'Y', LEGACY_HK_NAME( "Mirror Y" ),
|
2019-04-29 10:41:27 +00:00
|
|
|
_( "Mirror Around Vertical Axis" ), _( "Flips selected item(s) from left to right" ),
|
2019-05-11 09:33:19 +00:00
|
|
|
mirror_h_xpm );
|
2019-04-26 16:34:04 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::properties( "eeschema.InteractiveEdit.properties",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL,
|
|
|
|
'E', LEGACY_HK_NAME( "Edit Item" ),
|
2019-04-29 10:41:27 +00:00
|
|
|
_( "Properties..." ), _( "Displays item properties dialog" ),
|
|
|
|
edit_xpm );
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::editReference( "eeschema.InteractiveEdit.editReference",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL,
|
|
|
|
'U', LEGACY_HK_NAME( "Edit Symbol Reference" ),
|
2019-04-29 10:41:27 +00:00
|
|
|
_( "Edit Reference..." ), _( "Displays reference field dialog" ),
|
|
|
|
edit_comp_ref_xpm );
|
2019-04-27 23:50:35 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::editValue( "eeschema.InteractiveEdit.editValue",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL,
|
|
|
|
'V', LEGACY_HK_NAME( "Edit Symbol Value" ),
|
2019-04-29 10:41:27 +00:00
|
|
|
_( "Edit Value..." ), _( "Displays value field dialog" ),
|
|
|
|
edit_comp_value_xpm );
|
2019-04-27 23:50:35 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::editFootprint( "eeschema.InteractiveEdit.editFootprint",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL,
|
|
|
|
'F', LEGACY_HK_NAME( "Edit Symbol Footprint" ),
|
2019-04-29 10:41:27 +00:00
|
|
|
_( "Edit Footprint..." ), _( "Displays footprint field dialog" ),
|
|
|
|
edit_comp_footprint_xpm );
|
2019-04-27 23:50:35 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::autoplaceFields( "eeschema.InteractiveEdit.autoplaceFields",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL,
|
|
|
|
'O', LEGACY_HK_NAME( "Autoplace Fields" ),
|
2019-04-29 10:41:27 +00:00
|
|
|
_( "Autoplace Fields" ), _( "Runs the automatic placement algorithm on the symbol's fields" ),
|
|
|
|
autoplace_fields_xpm );
|
2019-04-28 23:34:43 +00:00
|
|
|
|
2019-06-03 13:49:17 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::updateFieldsFromLibrary( "eeschema.InteractiveEdit.updateFieldsFromLibrary",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-06-03 13:49:17 +00:00
|
|
|
_( "Update Fields from Library..." ), _( "Sets symbol fields to original library values" ),
|
|
|
|
update_fields_xpm );
|
|
|
|
|
2019-06-01 19:48:01 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::toggleDeMorgan( "eeschema.InteractiveEdit.toggleDeMorgan",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-05-01 21:50:11 +00:00
|
|
|
_( "DeMorgan Conversion" ), _( "Switch between DeMorgan representations" ),
|
2019-05-02 20:03:03 +00:00
|
|
|
morgan2_xpm );
|
2019-05-01 21:50:11 +00:00
|
|
|
|
2019-06-01 19:48:01 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::showDeMorganStandard( "eeschema.InteractiveEdit.showDeMorganStandard",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-06-01 19:48:01 +00:00
|
|
|
_( "DeMorgan Standard" ), _( "Switch to standard DeMorgan representation" ),
|
|
|
|
morgan1_xpm );
|
|
|
|
|
|
|
|
TOOL_ACTION EE_ACTIONS::showDeMorganAlternate( "eeschema.InteractiveEdit.showDeMorganAlternate",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-06-01 19:48:01 +00:00
|
|
|
_( "DeMorgan Alternate" ), _( "Switch to alternate DeMorgan representation" ),
|
|
|
|
morgan2_xpm );
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::toShapeSlash( "eeschema.InteractiveEdit.toShapeSlash",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-04-29 17:50:46 +00:00
|
|
|
_( "Set Bus Entry Shape /" ), _( "Change the bus entry shape to /" ),
|
|
|
|
change_entry_orient_xpm );
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::toShapeBackslash( "eeschema.InteractiveEdit.toShapeBackslash",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-04-29 17:50:46 +00:00
|
|
|
_( "Set Bus Entry Shape \\" ), _( "Change the bus entry shape to \\" ),
|
|
|
|
change_entry_orient_xpm );
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::toLabel( "eeschema.InteractiveEdit.toLabel",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-04-29 17:50:46 +00:00
|
|
|
_( "Change to Label" ), _( "Change existing item to a label" ),
|
|
|
|
add_line_label_xpm );
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::toHLabel( "eeschema.InteractiveEdit.toHLabel",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-04-29 17:50:46 +00:00
|
|
|
_( "Change to Hierarchical Label" ), _( "Change existing item to a hierarchical label" ),
|
|
|
|
add_hierarchical_label_xpm );
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::toGLabel( "eeschema.InteractiveEdit.toGLabel",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-04-29 17:50:46 +00:00
|
|
|
_( "Change to Global Label" ), _( "Change existing item to a global label" ),
|
|
|
|
add_glabel_xpm );
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::toText( "eeschema.InteractiveEdit.toText",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-04-29 17:50:46 +00:00
|
|
|
_( "Change to Text" ), _( "Change existing item to a text comment" ),
|
|
|
|
text_xpm );
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::cleanupSheetPins( "eeschema.InteractiveEdit.cleanupSheetPins",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-05-01 22:14:21 +00:00
|
|
|
_( "Cleanup Sheet Pins" ), _( "Delete unreferenced sheet pins" ),
|
|
|
|
nullptr );
|
|
|
|
|
2019-05-11 14:38:05 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::symbolProperties( "eeschema.InteractiveEdit.symbolProperties",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-05-11 14:38:05 +00:00
|
|
|
_( "Symbol Properties..." ), _( "Displays symbol properties dialog" ),
|
|
|
|
part_properties_xpm );
|
|
|
|
|
|
|
|
TOOL_ACTION EE_ACTIONS::pinTable( "eeschema.InteractiveEdit.pinTable",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-05-11 14:38:05 +00:00
|
|
|
_( "Pin Table..." ), _( "Displays pin table for bulk editing of pins" ),
|
|
|
|
pin_table_xpm );
|
|
|
|
|
2019-05-15 22:49:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::deleteItemCursor( "eeschema.InteractiveEdit.deleteTool",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-06-15 00:29:42 +00:00
|
|
|
_( "Delete Tool" ), _( "Delete clicked items" ),
|
2019-05-14 19:21:10 +00:00
|
|
|
delete_xpm, AF_ACTIVATE );
|
2019-04-28 16:36:31 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::breakWire( "eeschema.InteractiveEdit.breakWire",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-04-30 13:54:32 +00:00
|
|
|
_( "Break Wire" ), _( "Divide a wire into segments which can be dragged independently" ),
|
|
|
|
break_line_xpm );
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
TOOL_ACTION EE_ACTIONS::breakBus( "eeschema.InteractiveEdit.breakBus",
|
2019-06-09 21:57:23 +00:00
|
|
|
AS_GLOBAL, 0, "",
|
2019-04-30 13:54:32 +00:00
|
|
|
_( "Break Bus" ), _( "Divide a bus into segments which can be dragged independently" ),
|
|
|
|
break_line_xpm );
|
2019-04-28 16:36:31 +00:00
|
|
|
|
2019-04-23 13:06:37 +00:00
|
|
|
|
2019-06-03 13:49:17 +00:00
|
|
|
char g_lastBusEntryShape = '/';
|
|
|
|
|
|
|
|
|
2019-05-14 11:14:00 +00:00
|
|
|
class SYMBOL_UNIT_MENU : public ACTION_MENU
|
2019-05-02 20:03:03 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-06-15 00:29:42 +00:00
|
|
|
SYMBOL_UNIT_MENU() :
|
|
|
|
ACTION_MENU( true )
|
2019-05-02 20:03:03 +00:00
|
|
|
{
|
|
|
|
SetIcon( component_select_unit_xpm );
|
|
|
|
SetTitle( _( "Symbol Unit" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2019-05-14 11:14:00 +00:00
|
|
|
ACTION_MENU* create() const override
|
2019-05-02 20:03:03 +00:00
|
|
|
{
|
|
|
|
return new SYMBOL_UNIT_MENU();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void update() override
|
|
|
|
{
|
2019-05-10 17:19:48 +00:00
|
|
|
EE_SELECTION_TOOL* selTool = getToolManager()->GetTool<EE_SELECTION_TOOL>();
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = selTool->GetSelection();
|
2019-05-10 17:19:48 +00:00
|
|
|
SCH_COMPONENT* component = dynamic_cast<SCH_COMPONENT*>( selection.Front() );
|
2019-05-02 20:03:03 +00:00
|
|
|
|
|
|
|
if( !component )
|
|
|
|
{
|
|
|
|
Append( ID_POPUP_SCH_UNFOLD_BUS, _( "no symbol selected" ), wxEmptyString );
|
|
|
|
Enable( ID_POPUP_SCH_UNFOLD_BUS, false );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int unit = component->GetUnit();
|
|
|
|
auto partRef = component->GetPartRef().lock();
|
|
|
|
|
|
|
|
if( !partRef || partRef->GetUnitCount() < 2 )
|
|
|
|
{
|
|
|
|
Append( ID_POPUP_SCH_UNFOLD_BUS, _( "symbol is not multi-unit" ), wxEmptyString );
|
|
|
|
Enable( ID_POPUP_SCH_UNFOLD_BUS, false );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for( int ii = 0; ii < partRef->GetUnitCount(); ii++ )
|
|
|
|
{
|
|
|
|
wxString num_unit;
|
|
|
|
num_unit.Printf( _( "Unit %s" ), LIB_PART::SubReference( ii + 1, false ) );
|
|
|
|
|
|
|
|
wxMenuItem * item = Append( ID_POPUP_SCH_SELECT_UNIT1 + ii, num_unit, wxEmptyString,
|
|
|
|
wxITEM_CHECK );
|
|
|
|
if( unit == ii + 1 )
|
|
|
|
item->Check(true);
|
|
|
|
|
|
|
|
// The ID max for these submenus is ID_POPUP_SCH_SELECT_UNIT_CMP_MAX
|
|
|
|
// See eeschema_id to modify this value.
|
|
|
|
if( ii >= (ID_POPUP_SCH_SELECT_UNIT_CMP_MAX - ID_POPUP_SCH_SELECT_UNIT1) )
|
|
|
|
break; // We have used all IDs for these submenus
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-04-23 13:06:37 +00:00
|
|
|
SCH_EDIT_TOOL::SCH_EDIT_TOOL() :
|
2019-05-12 11:49:58 +00:00
|
|
|
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveEdit" )
|
2019-04-23 13:06:37 +00:00
|
|
|
{
|
2019-04-26 18:37:47 +00:00
|
|
|
}
|
2019-04-23 13:06:37 +00:00
|
|
|
|
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
using E_C = EE_CONDITIONS;
|
|
|
|
|
2019-04-23 13:06:37 +00:00
|
|
|
bool SCH_EDIT_TOOL::Init()
|
|
|
|
{
|
2019-05-12 11:49:58 +00:00
|
|
|
EE_TOOL_BASE::Init();
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
SCH_DRAWING_TOOLS* drawingTools = m_toolMgr->GetTool<SCH_DRAWING_TOOLS>();
|
2019-05-12 11:49:58 +00:00
|
|
|
SCH_MOVE_TOOL* moveTool = m_toolMgr->GetTool<SCH_MOVE_TOOL>();
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
wxASSERT_MSG( drawingTools, "eeshema.InteractiveDrawing tool is not available" );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-03 22:48:24 +00:00
|
|
|
auto sheetTool = [ this ] ( const SELECTION& aSel ) {
|
2019-06-15 00:29:42 +00:00
|
|
|
return ( m_frame->GetCurrentToolName() == EE_ACTIONS::drawSheet.GetName() );
|
2019-05-03 22:48:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
auto anyTextTool = [ this ] ( const SELECTION& aSel ) {
|
2019-06-15 00:29:42 +00:00
|
|
|
return ( m_frame->GetCurrentToolName() == EE_ACTIONS::placeLabel.GetName()
|
|
|
|
|| m_frame->GetCurrentToolName() == EE_ACTIONS::placeGlobalLabel.GetName()
|
|
|
|
|| m_frame->GetCurrentToolName() == EE_ACTIONS::placeHierLabel.GetName()
|
|
|
|
|| m_frame->GetCurrentToolName() == EE_ACTIONS::placeSchematicText.GetName() );
|
2019-05-03 22:48:24 +00:00
|
|
|
};
|
|
|
|
|
2019-05-04 13:02:05 +00:00
|
|
|
auto duplicateCondition = [] ( const SELECTION& aSel ) {
|
2019-05-05 14:16:29 +00:00
|
|
|
if( SCH_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) )
|
2019-05-02 10:59:36 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2019-04-28 23:34:43 +00:00
|
|
|
};
|
|
|
|
|
2019-05-02 10:59:36 +00:00
|
|
|
auto orientCondition = [] ( const SELECTION& aSel ) {
|
2019-04-29 17:50:46 +00:00
|
|
|
if( aSel.Empty() )
|
|
|
|
return false;
|
|
|
|
|
2019-05-05 14:16:29 +00:00
|
|
|
if( SCH_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) )
|
2019-05-02 10:59:36 +00:00
|
|
|
return false;
|
|
|
|
|
2019-05-01 23:35:05 +00:00
|
|
|
SCH_ITEM* item = (SCH_ITEM*) aSel.Front();
|
|
|
|
|
2019-04-29 17:50:46 +00:00
|
|
|
if( aSel.GetSize() > 1 )
|
|
|
|
return true;
|
|
|
|
|
2019-05-01 23:35:05 +00:00
|
|
|
switch( item->Type() )
|
2019-04-29 17:50:46 +00:00
|
|
|
{
|
|
|
|
case SCH_MARKER_T:
|
|
|
|
case SCH_JUNCTION_T:
|
|
|
|
case SCH_NO_CONNECT_T:
|
|
|
|
case SCH_LINE_T:
|
|
|
|
case SCH_PIN_T:
|
|
|
|
return false;
|
|
|
|
default:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-05-02 10:59:36 +00:00
|
|
|
auto propertiesCondition = [] ( const SELECTION& aSel ) {
|
2019-04-29 20:38:05 +00:00
|
|
|
if( aSel.GetSize() != 1 )
|
|
|
|
return false;
|
|
|
|
|
2019-05-01 21:50:11 +00:00
|
|
|
switch( static_cast<EDA_ITEM*>( aSel.Front() )->Type() )
|
2019-04-29 20:38:05 +00:00
|
|
|
{
|
|
|
|
case SCH_MARKER_T:
|
|
|
|
case SCH_JUNCTION_T:
|
|
|
|
case SCH_NO_CONNECT_T:
|
|
|
|
case SCH_BUS_WIRE_ENTRY_T:
|
|
|
|
case SCH_BUS_BUS_ENTRY_T:
|
|
|
|
case SCH_LINE_T:
|
|
|
|
case SCH_SHEET_PIN_T:
|
|
|
|
case SCH_PIN_T:
|
|
|
|
return false;
|
|
|
|
default:
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-05-20 18:05:27 +00:00
|
|
|
static KICAD_T toLabelTypes[] = { SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
|
2019-05-17 16:45:27 +00:00
|
|
|
auto toLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toLabelTypes );
|
2019-04-28 23:34:43 +00:00
|
|
|
|
2019-05-20 18:05:27 +00:00
|
|
|
static KICAD_T toHLableTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_TEXT_T, EOT };
|
|
|
|
auto toHLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toHLableTypes );
|
2019-04-28 23:34:43 +00:00
|
|
|
|
2019-05-20 18:05:27 +00:00
|
|
|
static KICAD_T toGLableTypes[] = { SCH_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
|
|
|
|
auto toGLabelCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toGLableTypes );
|
2019-04-28 23:34:43 +00:00
|
|
|
|
2019-05-20 18:05:27 +00:00
|
|
|
static KICAD_T toTextTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, EOT };
|
|
|
|
auto toTextlCondition = E_C::Count( 1 ) && E_C::OnlyTypes( toTextTypes );
|
2019-05-01 21:50:11 +00:00
|
|
|
|
2019-05-20 18:05:27 +00:00
|
|
|
static KICAD_T entryTypes[] = { SCH_BUS_WIRE_ENTRY_T, SCH_BUS_BUS_ENTRY_T, EOT };
|
2019-05-17 16:45:27 +00:00
|
|
|
auto entryCondition = E_C::MoreThan( 0 ) && E_C::OnlyTypes( entryTypes );
|
2019-05-01 21:50:11 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
auto singleComponentCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_COMPONENT_T );
|
|
|
|
auto wireSelectionCondition = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_WIRE_T );
|
|
|
|
auto busSelectionCondition = E_C::MoreThan( 0 ) && E_C::OnlyType( SCH_LINE_LOCATE_BUS_T );
|
|
|
|
auto singleSheetCondition = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
|
2019-05-01 23:35:05 +00:00
|
|
|
|
2019-05-02 10:59:36 +00:00
|
|
|
//
|
2019-05-04 13:02:05 +00:00
|
|
|
// Add edit actions to the move tool menu
|
2019-04-28 23:34:43 +00:00
|
|
|
//
|
2019-05-04 13:02:05 +00:00
|
|
|
if( moveTool )
|
|
|
|
{
|
|
|
|
CONDITIONAL_MENU& moveMenu = moveTool->GetToolMenu().GetMenu();
|
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
moveMenu.AddSeparator();
|
2019-05-10 17:19:48 +00:00
|
|
|
moveMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition );
|
|
|
|
moveMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition );
|
|
|
|
moveMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition );
|
|
|
|
moveMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition );
|
2019-05-17 16:45:27 +00:00
|
|
|
moveMenu.AddItem( EE_ACTIONS::doDelete, E_C::NotEmpty );
|
2019-05-10 17:19:48 +00:00
|
|
|
|
|
|
|
moveMenu.AddItem( EE_ACTIONS::properties, propertiesCondition );
|
|
|
|
moveMenu.AddItem( EE_ACTIONS::editReference, singleComponentCondition );
|
|
|
|
moveMenu.AddItem( EE_ACTIONS::editValue, singleComponentCondition );
|
|
|
|
moveMenu.AddItem( EE_ACTIONS::editFootprint, singleComponentCondition );
|
2019-06-01 19:48:01 +00:00
|
|
|
moveMenu.AddItem( EE_ACTIONS::toggleDeMorgan, E_C::SingleDeMorganSymbol );
|
2019-05-04 13:02:05 +00:00
|
|
|
|
|
|
|
std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu = std::make_shared<SYMBOL_UNIT_MENU>();
|
|
|
|
symUnitMenu->SetTool( this );
|
|
|
|
m_menu.AddSubMenu( symUnitMenu );
|
2019-05-17 16:45:27 +00:00
|
|
|
moveMenu.AddMenu( symUnitMenu.get(), E_C::SingleMultiUnitSymbol, 1 );
|
2019-05-04 13:02:05 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
moveMenu.AddSeparator();
|
2019-05-17 16:45:27 +00:00
|
|
|
moveMenu.AddItem( ACTIONS::cut, E_C::IdleSelection );
|
|
|
|
moveMenu.AddItem( ACTIONS::copy, E_C::IdleSelection );
|
2019-05-27 10:40:52 +00:00
|
|
|
moveMenu.AddItem( ACTIONS::duplicate, duplicateCondition );
|
2019-05-04 13:02:05 +00:00
|
|
|
}
|
2019-04-28 23:34:43 +00:00
|
|
|
|
2019-05-02 10:59:36 +00:00
|
|
|
//
|
2019-04-28 23:34:43 +00:00
|
|
|
// Add editing actions to the drawing tool menu
|
|
|
|
//
|
2019-05-08 18:56:03 +00:00
|
|
|
CONDITIONAL_MENU& drawMenu = drawingTools->GetToolMenu().GetMenu();
|
2019-04-28 23:34:43 +00:00
|
|
|
|
2019-05-17 15:44:58 +00:00
|
|
|
drawMenu.AddItem( EE_ACTIONS::rotateCCW, orientCondition, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition, 200 );
|
|
|
|
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::editReference, singleComponentCondition, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::editValue, singleComponentCondition, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::editFootprint, singleComponentCondition, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::autoplaceFields, singleComponentCondition, 200 );
|
2019-06-01 19:48:01 +00:00
|
|
|
drawMenu.AddItem( EE_ACTIONS::toggleDeMorgan, E_C::SingleDeMorganSymbol, 200 );
|
2019-05-02 20:03:03 +00:00
|
|
|
|
|
|
|
std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu2 = std::make_shared<SYMBOL_UNIT_MENU>();
|
2019-05-08 18:56:03 +00:00
|
|
|
symUnitMenu2->SetTool( drawingTools );
|
|
|
|
drawingTools->GetToolMenu().AddSubMenu( symUnitMenu2 );
|
2019-05-17 16:45:27 +00:00
|
|
|
drawMenu.AddMenu( symUnitMenu2.get(), E_C::SingleMultiUnitSymbol, 1 );
|
2019-05-02 20:03:03 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
drawMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition && E_C::Idle, 200 );
|
2019-05-06 20:37:54 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
drawMenu.AddItem( EE_ACTIONS::toShapeSlash, entryCondition, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::toShapeBackslash, entryCondition, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::toLabel, anyTextTool && E_C::Idle, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::toHLabel, anyTextTool && E_C::Idle, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::toGLabel, anyTextTool && E_C::Idle, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::toText, anyTextTool && E_C::Idle, 200 );
|
|
|
|
drawMenu.AddItem( EE_ACTIONS::cleanupSheetPins, sheetTool && E_C::Idle, 250 );
|
2019-04-28 23:34:43 +00:00
|
|
|
|
2019-05-02 10:59:36 +00:00
|
|
|
//
|
2019-04-28 23:34:43 +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, orientCondition, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::rotateCW, orientCondition, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::mirrorX, orientCondition, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::mirrorY, orientCondition, 200 );
|
2019-05-17 16:45:27 +00:00
|
|
|
selToolMenu.AddItem( EE_ACTIONS::doDelete, E_C::NotEmpty, 200 );
|
2019-05-02 10:59:36 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
selToolMenu.AddItem( EE_ACTIONS::properties, propertiesCondition, 200 );
|
2019-05-17 16:45:27 +00:00
|
|
|
selToolMenu.AddItem( EE_ACTIONS::editReference, E_C::SingleSymbol, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::editValue, E_C::SingleSymbol, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::editFootprint, E_C::SingleSymbol, 200 );
|
2019-05-10 17:19:48 +00:00
|
|
|
selToolMenu.AddItem( EE_ACTIONS::autoplaceFields, singleComponentCondition, 200 );
|
2019-06-01 19:48:01 +00:00
|
|
|
selToolMenu.AddItem( EE_ACTIONS::toggleDeMorgan, E_C::SingleSymbol, 200 );
|
2019-05-02 20:03:03 +00:00
|
|
|
|
|
|
|
std::shared_ptr<SYMBOL_UNIT_MENU> symUnitMenu3 = std::make_shared<SYMBOL_UNIT_MENU>();
|
|
|
|
symUnitMenu3->SetTool( m_selectionTool );
|
|
|
|
m_selectionTool->GetToolMenu().AddSubMenu( symUnitMenu3 );
|
2019-05-17 16:45:27 +00:00
|
|
|
selToolMenu.AddMenu( symUnitMenu3.get(), E_C::SingleMultiUnitSymbol, 1 );
|
2019-05-02 20:03:03 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
selToolMenu.AddItem( EE_ACTIONS::editWithLibEdit, singleComponentCondition && E_C::Idle, 200 );
|
2019-05-06 20:37:54 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
selToolMenu.AddItem( EE_ACTIONS::toShapeSlash, entryCondition, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::toShapeBackslash, entryCondition, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::toLabel, toLabelCondition, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::toHLabel, toHLabelCondition, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::toGLabel, toGLabelCondition, 200 );
|
|
|
|
selToolMenu.AddItem( EE_ACTIONS::toText, toTextlCondition, 200 );
|
2019-05-17 15:16:13 +00:00
|
|
|
selToolMenu.AddItem( EE_ACTIONS::cleanupSheetPins, singleSheetCondition, 250 );
|
2019-04-29 10:41:27 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
selToolMenu.AddSeparator( 300 );
|
2019-05-17 16:45:27 +00:00
|
|
|
selToolMenu.AddItem( ACTIONS::cut, E_C::IdleSelection, 300 );
|
|
|
|
selToolMenu.AddItem( ACTIONS::copy, E_C::IdleSelection, 300 );
|
|
|
|
selToolMenu.AddItem( ACTIONS::paste, E_C::Idle, 300 );
|
2019-05-27 10:40:52 +00:00
|
|
|
selToolMenu.AddItem( ACTIONS::duplicate, duplicateCondition, 300 );
|
2019-04-23 13:06:37 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-23 17:40:29 +00:00
|
|
|
int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::RotatableItems );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
|
|
|
if( selection.GetSize() == 0 )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
wxPoint rotPoint;
|
2019-05-10 17:19:48 +00:00
|
|
|
bool clockwise = ( aEvent.Matches( EE_ACTIONS::rotateCW.MakeEvent() ) );
|
2019-05-01 21:50:11 +00:00
|
|
|
SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
|
2019-04-23 17:40:29 +00:00
|
|
|
bool connections = false;
|
|
|
|
bool moving = item->IsMoving();
|
|
|
|
|
|
|
|
if( selection.GetSize() == 1 )
|
|
|
|
{
|
|
|
|
if( !moving )
|
2019-04-26 22:23:12 +00:00
|
|
|
saveCopyInUndoList( item, UR_CHANGED );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
|
2019-04-23 17:40:29 +00:00
|
|
|
{
|
2019-05-17 16:45:27 +00:00
|
|
|
switch( item->Type() )
|
|
|
|
{
|
|
|
|
case SCH_COMPONENT_T:
|
|
|
|
{
|
|
|
|
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
if( clockwise )
|
|
|
|
component->SetOrientation( CMP_ROTATE_CLOCKWISE );
|
|
|
|
else
|
|
|
|
component->SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
if( m_frame->GetAutoplaceFields() )
|
|
|
|
component->AutoAutoplaceFields( m_frame->GetScreen() );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
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 );
|
|
|
|
textItem->SetLabelSpinStyle( ( textItem->GetLabelSpinStyle() + 1 ) & 3 );
|
|
|
|
break;
|
|
|
|
}
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
case SCH_SHEET_PIN_T:
|
|
|
|
{
|
|
|
|
// Rotate pin within parent sheet
|
|
|
|
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
|
|
|
|
SCH_SHEET* sheet = pin->GetParent();
|
|
|
|
pin->Rotate( sheet->GetBoundingBox().GetCenter() );
|
|
|
|
break;
|
|
|
|
}
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
case SCH_BUS_BUS_ENTRY_T:
|
|
|
|
case SCH_BUS_WIRE_ENTRY_T:
|
|
|
|
item->Rotate( item->GetPosition() );
|
|
|
|
break;
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
case SCH_FIELD_T:
|
2019-04-23 17:40:29 +00:00
|
|
|
{
|
2019-05-17 16:45:27 +00:00
|
|
|
SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
if( field->GetTextAngle() == TEXT_ANGLE_HORIZ )
|
|
|
|
field->SetTextAngle( TEXT_ANGLE_VERT );
|
|
|
|
else
|
|
|
|
field->SetTextAngle( TEXT_ANGLE_HORIZ );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
// Now that we're moving 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();
|
|
|
|
}
|
2019-04-26 16:34:04 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
break;
|
|
|
|
}
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
case SCH_BITMAP_T:
|
|
|
|
item->Rotate( item->GetPosition() );
|
|
|
|
// The bitmap is cached in Opengl: clear the cache to redraw
|
|
|
|
getView()->RecacheAllItems();
|
|
|
|
break;
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
case SCH_SHEET_T:
|
|
|
|
// Rotate the sheet on itself. Sheets do not have an anchor point.
|
|
|
|
rotPoint = m_frame->GetNearestGridPosition( item->GetBoundingBox().Centre() );
|
2019-04-26 16:34:04 +00:00
|
|
|
item->Rotate( rotPoint );
|
2019-05-17 16:45:27 +00:00
|
|
|
break;
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2019-04-23 17:40:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
connections = item->IsConnectable();
|
|
|
|
m_frame->RefreshItem( item );
|
|
|
|
}
|
|
|
|
else if( selection.GetSize() > 1 )
|
|
|
|
{
|
2019-05-20 18:51:24 +00:00
|
|
|
rotPoint = (wxPoint)selection.GetReferencePoint();
|
2019-04-23 17:40:29 +00:00
|
|
|
|
|
|
|
for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
|
|
|
|
{
|
|
|
|
item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
|
|
|
|
|
|
|
|
if( !moving )
|
2019-04-26 22:23:12 +00:00
|
|
|
saveCopyInUndoList( item, UR_CHANGED, ii > 0 );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
for( int i = 0; clockwise ? i < 1 : i < 3; ++i )
|
2019-05-03 22:46:44 +00:00
|
|
|
{
|
2019-05-17 16:45:27 +00:00
|
|
|
if( item->Type() == SCH_LINE_T )
|
|
|
|
{
|
|
|
|
SCH_LINE* line = (SCH_LINE*) item;
|
|
|
|
|
|
|
|
if( item->GetFlags() & STARTPOINT )
|
|
|
|
line->RotateStart( rotPoint );
|
|
|
|
|
|
|
|
if( item->GetFlags() & ENDPOINT )
|
|
|
|
line->RotateEnd( rotPoint );
|
|
|
|
}
|
|
|
|
else if( item->Type() == SCH_SHEET_PIN_T )
|
|
|
|
{
|
|
|
|
if( item->GetParent()->IsSelected() )
|
|
|
|
{
|
|
|
|
// parent will rotate us
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// rotate within parent
|
|
|
|
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
|
|
|
|
SCH_SHEET* sheet = pin->GetParent();
|
|
|
|
|
|
|
|
pin->Rotate( sheet->GetBoundingBox().GetCenter() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
item->Rotate( rotPoint );
|
|
|
|
}
|
2019-05-03 22:46:44 +00:00
|
|
|
}
|
2019-04-23 17:40:29 +00:00
|
|
|
|
|
|
|
connections |= item->IsConnectable();
|
|
|
|
m_frame->RefreshItem( item );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
|
|
|
|
2019-05-20 10:22:36 +00:00
|
|
|
if( item->IsMoving() )
|
|
|
|
{
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
|
|
|
|
}
|
|
|
|
else
|
2019-04-23 17:40:29 +00:00
|
|
|
{
|
2019-04-26 16:34:04 +00:00
|
|
|
if( selection.IsHover() )
|
2019-05-10 17:19:48 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
2019-04-26 16:34:04 +00:00
|
|
|
|
|
|
|
if( connections )
|
|
|
|
m_frame->TestDanglingEnds();
|
|
|
|
|
|
|
|
m_frame->OnModify();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::RotatableItems );
|
2019-04-26 16:34:04 +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-01 21:50:11 +00:00
|
|
|
SCH_ITEM* item = static_cast<SCH_ITEM*>( selection.Front() );
|
2019-04-26 16:34:04 +00:00
|
|
|
bool connections = false;
|
|
|
|
bool moving = item->IsMoving();
|
|
|
|
|
|
|
|
if( selection.GetSize() == 1 )
|
|
|
|
{
|
|
|
|
if( !moving )
|
2019-04-26 22:23:12 +00:00
|
|
|
saveCopyInUndoList( item, UR_CHANGED );
|
2019-04-26 16:34:04 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
case SCH_SHEET_PIN_T:
|
|
|
|
{
|
|
|
|
// mirror within parent sheet
|
|
|
|
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
|
|
|
|
SCH_SHEET* sheet = pin->GetParent();
|
|
|
|
|
|
|
|
if( xAxis )
|
|
|
|
pin->MirrorX( sheet->GetBoundingBox().GetCenter().y );
|
|
|
|
else
|
|
|
|
pin->MirrorY( sheet->GetBoundingBox().GetCenter().x );
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-04-26 16:34:04 +00:00
|
|
|
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 )
|
|
|
|
{
|
2019-05-20 18:51:24 +00:00
|
|
|
mirrorPoint = (wxPoint)selection.GetReferencePoint();
|
2019-04-26 16:34:04 +00:00
|
|
|
|
|
|
|
for( unsigned ii = 0; ii < selection.GetSize(); ii++ )
|
|
|
|
{
|
|
|
|
item = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
|
|
|
|
|
|
|
|
if( !moving )
|
2019-04-26 22:23:12 +00:00
|
|
|
saveCopyInUndoList( item, UR_CHANGED, ii > 0 );
|
2019-04-26 16:34:04 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
if( item->Type() == SCH_SHEET_PIN_T )
|
|
|
|
{
|
|
|
|
if( item->GetParent()->IsSelected() )
|
|
|
|
{
|
|
|
|
// parent will mirror us
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// mirror within parent sheet
|
|
|
|
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
|
|
|
|
SCH_SHEET* sheet = pin->GetParent();
|
|
|
|
|
|
|
|
if( xAxis )
|
|
|
|
pin->MirrorX( sheet->GetBoundingBox().GetCenter().y );
|
|
|
|
else
|
|
|
|
pin->MirrorY( sheet->GetBoundingBox().GetCenter().x );
|
|
|
|
}
|
|
|
|
}
|
2019-04-26 16:34:04 +00:00
|
|
|
else
|
2019-05-17 16:45:27 +00:00
|
|
|
{
|
|
|
|
if( xAxis )
|
|
|
|
item->MirrorX( mirrorPoint.y );
|
|
|
|
else
|
|
|
|
item->MirrorY( mirrorPoint.x );
|
|
|
|
}
|
2019-04-26 16:34:04 +00:00
|
|
|
|
|
|
|
connections |= item->IsConnectable();
|
|
|
|
m_frame->RefreshItem( item );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
|
|
|
|
2019-05-20 10:22:36 +00:00
|
|
|
if( item->IsMoving() )
|
|
|
|
{
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
|
|
|
|
}
|
|
|
|
else
|
2019-04-26 16:34:04 +00:00
|
|
|
{
|
|
|
|
if( selection.IsHover() )
|
2019-05-10 17:19:48 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
2019-04-26 16:34:04 +00:00
|
|
|
|
2019-04-23 17:40:29 +00:00
|
|
|
if( connections )
|
|
|
|
m_frame->TestDanglingEnds();
|
|
|
|
|
|
|
|
m_frame->OnModify();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-26 18:37:47 +00:00
|
|
|
int SCH_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-04-30 17:02:38 +00:00
|
|
|
static KICAD_T duplicatableItems[] =
|
|
|
|
{
|
|
|
|
SCH_JUNCTION_T,
|
|
|
|
SCH_LINE_T,
|
|
|
|
SCH_BUS_BUS_ENTRY_T,
|
|
|
|
SCH_BUS_WIRE_ENTRY_T,
|
|
|
|
SCH_TEXT_T,
|
|
|
|
SCH_LABEL_T,
|
|
|
|
SCH_GLOBAL_LABEL_T,
|
|
|
|
SCH_HIER_LABEL_T,
|
|
|
|
SCH_NO_CONNECT_T,
|
|
|
|
SCH_SHEET_T,
|
|
|
|
SCH_COMPONENT_T,
|
|
|
|
EOT
|
|
|
|
};
|
|
|
|
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection( duplicatableItems );
|
2019-04-26 18:37:47 +00:00
|
|
|
|
|
|
|
if( selection.GetSize() == 0 )
|
|
|
|
return 0;
|
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
// Doing a duplicate of a new object doesn't really make any sense; we'd just end
|
|
|
|
// up dragging around a stack of objects...
|
2019-05-03 11:49:59 +00:00
|
|
|
if( selection.Front()->IsNew() )
|
|
|
|
return 0;
|
|
|
|
|
2019-05-03 22:46:44 +00:00
|
|
|
EDA_ITEMS newItems;
|
2019-04-26 18:37:47 +00:00
|
|
|
|
|
|
|
// Keep track of existing sheet paths. Duplicating a selection can modify this list
|
2019-05-03 11:49:59 +00:00
|
|
|
bool copiedSheets = false;
|
2019-04-26 18:37:47 +00:00
|
|
|
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
|
|
|
|
|
|
|
|
for( unsigned ii = 0; ii < selection.GetSize(); ++ii )
|
|
|
|
{
|
|
|
|
SCH_ITEM* oldItem = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
|
2019-05-04 13:02:05 +00:00
|
|
|
SCH_ITEM* newItem = oldItem->Duplicate();
|
2019-04-30 23:18:47 +00:00
|
|
|
newItem->SetFlags( IS_NEW );
|
2019-05-03 11:49:59 +00:00
|
|
|
newItems.push_back( newItem );
|
2019-04-26 22:23:12 +00:00
|
|
|
saveCopyInUndoList( newItem, UR_NEW, ii > 0 );
|
2019-04-26 18:37:47 +00:00
|
|
|
|
|
|
|
switch( newItem->Type() )
|
|
|
|
{
|
|
|
|
case SCH_JUNCTION_T:
|
|
|
|
case SCH_LINE_T:
|
|
|
|
case SCH_BUS_BUS_ENTRY_T:
|
|
|
|
case SCH_BUS_WIRE_ENTRY_T:
|
|
|
|
case SCH_TEXT_T:
|
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIER_LABEL_T:
|
|
|
|
case SCH_NO_CONNECT_T:
|
|
|
|
newItem->SetParent( m_frame->GetScreen() );
|
|
|
|
m_frame->AddToScreen( newItem );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_SHEET_T:
|
|
|
|
{
|
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) newItem;
|
|
|
|
// Duplicate sheet names and sheet time stamps are not valid. Use a time stamp
|
|
|
|
// based sheet name and update the time stamp for each sheet in the block.
|
|
|
|
timestamp_t timeStamp = GetNewTimeStamp();
|
|
|
|
|
|
|
|
sheet->SetName( wxString::Format( wxT( "sheet%8.8lX" ), (unsigned long)timeStamp ) );
|
|
|
|
sheet->SetTimeStamp( timeStamp );
|
|
|
|
|
|
|
|
sheet->SetParent( m_frame->GetScreen() );
|
|
|
|
m_frame->AddToScreen( sheet );
|
|
|
|
|
2019-05-03 11:49:59 +00:00
|
|
|
copiedSheets = true;
|
2019-04-26 18:37:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case SCH_COMPONENT_T:
|
|
|
|
{
|
|
|
|
SCH_COMPONENT* component = (SCH_COMPONENT*) newItem;
|
|
|
|
|
|
|
|
component->SetTimeStamp( GetNewTimeStamp() );
|
|
|
|
component->ClearAnnotation( NULL );
|
|
|
|
|
|
|
|
component->SetParent( m_frame->GetScreen() );
|
|
|
|
m_frame->AddToScreen( component );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-03 11:49:59 +00:00
|
|
|
if( copiedSheets )
|
2019-04-26 18:37:47 +00:00
|
|
|
{
|
|
|
|
// We clear annotation of new sheet paths.
|
|
|
|
// Annotation of new components added in current sheet is already cleared.
|
|
|
|
SCH_SCREENS screensList( g_RootSheet );
|
|
|
|
screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
|
2019-05-03 11:49:59 +00:00
|
|
|
m_frame->SetSheetNumberAndCount();
|
2019-04-26 18:37:47 +00:00
|
|
|
}
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &newItems );
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::move, false );
|
2019-04-26 18:37:47 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-26 22:23:12 +00:00
|
|
|
int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
SCH_ITEM* sourceItem = m_frame->GetRepeatItem();
|
|
|
|
|
|
|
|
if( !sourceItem )
|
|
|
|
return 0;
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
2019-04-26 22:23:12 +00:00
|
|
|
|
|
|
|
SCH_ITEM* newItem = (SCH_ITEM*) sourceItem->Clone();
|
|
|
|
bool performDrag = false;
|
|
|
|
|
|
|
|
// If cloning a component then put into 'move' mode.
|
|
|
|
if( newItem->Type() == SCH_COMPONENT_T )
|
|
|
|
{
|
|
|
|
( (SCH_COMPONENT*) newItem )->SetTimeStamp( GetNewTimeStamp() );
|
|
|
|
|
2019-05-04 13:02:05 +00:00
|
|
|
wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( true );
|
|
|
|
newItem->Move( cursorPos - newItem->GetPosition() );
|
2019-04-26 22:23:12 +00:00
|
|
|
performDrag = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( newItem->CanIncrementLabel() )
|
|
|
|
( (SCH_TEXT*) newItem )->IncrementLabel( m_frame->GetRepeatDeltaLabel() );
|
|
|
|
|
|
|
|
newItem->Move( m_frame->GetRepeatStep() );
|
|
|
|
}
|
|
|
|
|
|
|
|
newItem->SetFlags( IS_NEW );
|
|
|
|
m_frame->AddToScreen( newItem );
|
|
|
|
m_frame->SaveCopyInUndoList( newItem, UR_NEW );
|
|
|
|
|
2019-05-01 20:15:51 +00:00
|
|
|
m_selectionTool->AddItemToSel( newItem );
|
2019-04-26 22:23:12 +00:00
|
|
|
|
|
|
|
if( performDrag )
|
2019-05-10 17:19:48 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::move, true );
|
2019-04-26 22:23:12 +00:00
|
|
|
|
|
|
|
newItem->ClearFlags();
|
|
|
|
|
|
|
|
if( newItem->IsConnectable() )
|
|
|
|
m_frame->TestDanglingEnds();
|
|
|
|
|
|
|
|
// newItem newItem, now that it has been moved, thus saving new position.
|
2019-05-10 16:48:46 +00:00
|
|
|
m_frame->SaveCopyForRepeatItem( newItem );
|
2019-04-26 22:23:12 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-28 16:36:31 +00:00
|
|
|
int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
2019-04-23 13:06:37 +00:00
|
|
|
{
|
2019-05-04 13:02:05 +00:00
|
|
|
SCH_SCREEN* screen = m_frame->GetScreen();
|
|
|
|
auto items = m_selectionTool->RequestSelection().GetItems();
|
|
|
|
bool appendToUndo = false;
|
2019-04-23 13:06:37 +00:00
|
|
|
|
2019-05-04 13:02:05 +00:00
|
|
|
if( items.empty() )
|
2019-04-23 13:06:37 +00:00
|
|
|
return 0;
|
|
|
|
|
2019-05-04 13:02:05 +00:00
|
|
|
// 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-04-23 13:06:37 +00:00
|
|
|
|
2019-05-04 13:02:05 +00:00
|
|
|
for( EDA_ITEM* item : items )
|
2019-04-23 13:06:37 +00:00
|
|
|
{
|
2019-04-27 14:59:38 +00:00
|
|
|
// Junctions, in particular, may have already been deleted if deleting wires made
|
|
|
|
// them redundant
|
|
|
|
if( item->GetEditFlags() & STRUCT_DELETED )
|
|
|
|
continue;
|
2019-04-23 13:06:37 +00:00
|
|
|
|
2019-05-04 13:02:05 +00:00
|
|
|
if( item->Type() == SCH_JUNCTION_T )
|
|
|
|
{
|
|
|
|
m_frame->DeleteJunction( (SCH_ITEM*) item, appendToUndo );
|
|
|
|
appendToUndo = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
item->SetFlags( STRUCT_DELETED );
|
|
|
|
saveCopyInUndoList( item, UR_DELETED, appendToUndo );
|
|
|
|
appendToUndo = true;
|
|
|
|
|
2019-05-06 15:30:29 +00:00
|
|
|
updateView( item );
|
2019-05-04 13:02:05 +00:00
|
|
|
|
|
|
|
SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
|
|
|
|
|
|
|
|
if( sch_item && sch_item->IsConnectable() )
|
|
|
|
{
|
|
|
|
std::vector< wxPoint > pts;
|
|
|
|
sch_item->GetConnectionPoints( pts );
|
|
|
|
|
|
|
|
for( auto point : pts )
|
|
|
|
{
|
|
|
|
SCH_ITEM* junction = screen->GetItem( point, 0, SCH_JUNCTION_T );
|
|
|
|
if( junction && !screen->IsJunctionNeeded( point ) )
|
|
|
|
m_frame->DeleteJunction( junction, appendToUndo );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-06 15:30:29 +00:00
|
|
|
if( item->Type() == SCH_SHEET_PIN_T )
|
|
|
|
static_cast<SCH_SHEET*>( item->GetParent() )->RemovePin( (SCH_SHEET_PIN*) item );
|
|
|
|
else
|
|
|
|
m_frame->RemoveFromScreen( item );
|
2019-05-04 13:02:05 +00:00
|
|
|
}
|
2019-04-23 13:06:37 +00:00
|
|
|
}
|
|
|
|
|
2019-04-27 14:59:38 +00:00
|
|
|
m_frame->TestDanglingEnds();
|
|
|
|
|
2019-04-23 13:06:37 +00:00
|
|
|
m_frame->GetCanvas()->Refresh();
|
|
|
|
m_frame->OnModify();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-05 10:33:34 +00:00
|
|
|
static bool deleteItem( SCH_BASE_FRAME* aFrame, const VECTOR2D& aPosition )
|
2019-04-28 16:36:31 +00:00
|
|
|
{
|
2019-05-10 17:19:48 +00:00
|
|
|
EE_SELECTION_TOOL* selectionTool = aFrame->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
|
2019-04-28 16:36:31 +00:00
|
|
|
wxCHECK( selectionTool, false );
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
aFrame->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true );
|
2019-04-28 16:36:31 +00:00
|
|
|
|
2019-05-05 10:33:34 +00:00
|
|
|
EDA_ITEM* item = selectionTool->SelectPoint( aPosition );
|
|
|
|
SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
|
2019-04-28 16:36:31 +00:00
|
|
|
|
2019-05-05 10:33:34 +00:00
|
|
|
if( sch_item && sch_item->IsLocked() )
|
2019-04-28 16:36:31 +00:00
|
|
|
{
|
2019-05-05 10:33:34 +00:00
|
|
|
STATUS_TEXT_POPUP statusPopup( aFrame );
|
|
|
|
statusPopup.SetText( _( "Item locked." ) );
|
2019-05-19 21:04:04 +00:00
|
|
|
statusPopup.PopupFor( 2000 );
|
2019-05-05 10:33:34 +00:00
|
|
|
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
|
|
|
|
return true;
|
2019-04-28 16:36:31 +00:00
|
|
|
}
|
|
|
|
|
2019-05-05 10:33:34 +00:00
|
|
|
if( item )
|
2019-05-10 17:19:48 +00:00
|
|
|
aFrame->GetToolManager()->RunAction( EE_ACTIONS::doDelete, true );
|
2019-05-05 10:33:34 +00:00
|
|
|
|
2019-04-28 16:36:31 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-15 00:29:42 +00:00
|
|
|
m_frame->SetTool( aEvent.GetCommandStr().get() );
|
|
|
|
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_BULLSEYE );
|
2019-04-28 16:36:31 +00:00
|
|
|
Activate();
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
|
2019-04-28 16:36:31 +00:00
|
|
|
wxCHECK( picker, 0 );
|
|
|
|
|
|
|
|
picker->SetClickHandler( std::bind( deleteItem, m_frame, std::placeholders::_1 ) );
|
|
|
|
picker->Activate();
|
|
|
|
Wait();
|
|
|
|
|
2019-06-15 00:29:42 +00:00
|
|
|
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
2019-04-28 16:36:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-27 23:50:35 +00:00
|
|
|
int SCH_EDIT_TOOL::EditField( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
static KICAD_T Nothing[] = { EOT };
|
|
|
|
static KICAD_T CmpOrReference[] = { SCH_FIELD_LOCATE_REFERENCE_T, SCH_COMPONENT_T, EOT };
|
|
|
|
static KICAD_T CmpOrValue[] = { SCH_FIELD_LOCATE_VALUE_T, SCH_COMPONENT_T, EOT };
|
|
|
|
static KICAD_T CmpOrFootprint[] = { SCH_FIELD_LOCATE_FOOTPRINT_T, SCH_COMPONENT_T, EOT };
|
|
|
|
|
|
|
|
KICAD_T* filter = Nothing;
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
|
2019-04-27 23:50:35 +00:00
|
|
|
filter = CmpOrReference;
|
2019-05-10 17:19:48 +00:00
|
|
|
else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
|
2019-04-27 23:50:35 +00:00
|
|
|
filter = CmpOrValue;
|
2019-05-10 17:19:48 +00:00
|
|
|
else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
|
2019-04-27 23:50:35 +00:00
|
|
|
filter = CmpOrFootprint;
|
|
|
|
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection( filter );
|
2019-04-27 23:50:35 +00:00
|
|
|
|
2019-04-28 23:34:43 +00:00
|
|
|
if( selection.Empty() )
|
2019-04-27 23:50:35 +00:00
|
|
|
return 0;
|
|
|
|
|
2019-05-01 21:50:11 +00:00
|
|
|
SCH_ITEM* item = (SCH_ITEM*) selection.Front();
|
2019-04-28 23:34:43 +00:00
|
|
|
|
2019-04-27 23:50:35 +00:00
|
|
|
if( item->Type() == SCH_COMPONENT_T )
|
|
|
|
{
|
|
|
|
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
if( aEvent.IsAction( &EE_ACTIONS::editReference ) )
|
2019-04-27 23:50:35 +00:00
|
|
|
m_frame->EditComponentFieldText( component->GetField( REFERENCE ) );
|
2019-05-10 17:19:48 +00:00
|
|
|
else if( aEvent.IsAction( &EE_ACTIONS::editValue ) )
|
2019-04-27 23:50:35 +00:00
|
|
|
m_frame->EditComponentFieldText( component->GetField( VALUE ) );
|
2019-05-10 17:19:48 +00:00
|
|
|
else if( aEvent.IsAction( &EE_ACTIONS::editFootprint ) )
|
2019-04-27 23:50:35 +00:00
|
|
|
m_frame->EditComponentFieldText( component->GetField( FOOTPRINT ) );
|
|
|
|
}
|
|
|
|
else if( item->Type() == SCH_FIELD_T )
|
|
|
|
{
|
|
|
|
m_frame->EditComponentFieldText( (SCH_FIELD*) item );
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-28 23:34:43 +00:00
|
|
|
int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent )
|
2019-04-27 23:50:35 +00:00
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::ComponentsOnly );
|
2019-04-27 23:50:35 +00:00
|
|
|
|
2019-04-28 23:34:43 +00:00
|
|
|
if( selection.Empty() )
|
|
|
|
return 0;
|
|
|
|
|
2019-05-01 21:50:11 +00:00
|
|
|
SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
|
2019-04-28 23:34:43 +00:00
|
|
|
|
|
|
|
if( !component->IsNew() )
|
|
|
|
m_frame->SaveCopyInUndoList( component, UR_CHANGED );
|
|
|
|
|
|
|
|
component->AutoplaceFields( m_frame->GetScreen(), /* aManual */ true );
|
|
|
|
|
|
|
|
updateView( component );
|
|
|
|
m_frame->OnModify();
|
2019-04-27 23:50:35 +00:00
|
|
|
|
2019-04-28 23:34:43 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-03 13:49:17 +00:00
|
|
|
int SCH_EDIT_TOOL::UpdateFields( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
std::list<SCH_COMPONENT*> components;
|
|
|
|
|
|
|
|
for( SCH_ITEM* item = m_frame->GetScreen()->GetDrawItems(); item; item = item->Next() )
|
|
|
|
{
|
|
|
|
if( item->Type() == SCH_COMPONENT_T )
|
|
|
|
components.push_back( static_cast<SCH_COMPONENT*>( item ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( InvokeDialogUpdateFields( m_frame, components, true ) == wxID_OK )
|
|
|
|
m_frame->GetCanvas()->Refresh();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-01 21:50:11 +00:00
|
|
|
int SCH_EDIT_TOOL::ConvertDeMorgan( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::ComponentsOnly );
|
2019-05-01 21:50:11 +00:00
|
|
|
|
|
|
|
if( selection.Empty() )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
SCH_COMPONENT* component = (SCH_COMPONENT*) selection.Front();
|
|
|
|
|
2019-06-01 19:48:01 +00:00
|
|
|
if( aEvent.IsAction( &EE_ACTIONS::showDeMorganStandard )
|
|
|
|
&& component->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if( aEvent.IsAction( &EE_ACTIONS::showDeMorganAlternate )
|
|
|
|
&& component->GetConvert() != LIB_ITEM::LIB_CONVERT::DEMORGAN )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if( !component->IsNew() )
|
2019-05-01 21:50:11 +00:00
|
|
|
m_frame->SaveCopyInUndoList( component, UR_CHANGED );
|
|
|
|
|
|
|
|
m_frame->ConvertPart( component );
|
|
|
|
|
2019-06-01 19:48:01 +00:00
|
|
|
if( component->IsNew() )
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::refreshPreview );
|
|
|
|
|
2019-05-01 21:50:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-28 23:34:43 +00:00
|
|
|
int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::EditableItems );
|
2019-04-28 23:34:43 +00:00
|
|
|
|
|
|
|
if( selection.Empty() )
|
|
|
|
return 0;
|
|
|
|
|
2019-05-01 21:50:11 +00:00
|
|
|
SCH_ITEM* item = (SCH_ITEM*) selection.Front();
|
2019-04-28 23:34:43 +00:00
|
|
|
|
2019-04-27 23:50:35 +00:00
|
|
|
switch( item->Type() )
|
|
|
|
{
|
|
|
|
case SCH_COMPONENT_T:
|
|
|
|
m_frame->EditComponent( (SCH_COMPONENT*) item );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_SHEET_T:
|
|
|
|
{
|
|
|
|
bool doClearAnnotation;
|
|
|
|
bool doRefresh = false;
|
|
|
|
// Keep track of existing sheet paths. EditSheet() can modify this list
|
|
|
|
SCH_SHEET_LIST initial_sheetpathList( g_RootSheet );
|
|
|
|
|
|
|
|
doRefresh = m_frame->EditSheet( (SCH_SHEET*) item, g_CurrentSheet, &doClearAnnotation );
|
|
|
|
|
|
|
|
if( doClearAnnotation ) // happens when the current sheet load a existing file
|
|
|
|
{ // we must clear "new" components annotation
|
|
|
|
SCH_SCREENS screensList( g_RootSheet );
|
|
|
|
// We clear annotation of new sheet paths here:
|
|
|
|
screensList.ClearAnnotationOfNewSheetPaths( initial_sheetpathList );
|
|
|
|
// Clear annotation of g_CurrentSheet itself, because its sheetpath
|
|
|
|
// is not a new path, but components managed by its sheet path must have
|
|
|
|
// their annotation cleared, becuase they are new:
|
|
|
|
((SCH_SHEET*) item)->GetScreen()->ClearAnnotation( g_CurrentSheet );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( doRefresh )
|
2019-05-08 18:56:03 +00:00
|
|
|
{
|
|
|
|
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
2019-04-27 23:50:35 +00:00
|
|
|
m_frame->GetCanvas()->Refresh();
|
2019-05-08 18:56:03 +00:00
|
|
|
}
|
2019-04-27 23:50:35 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case SCH_SHEET_PIN_T:
|
|
|
|
m_frame->EditSheetPin( (SCH_SHEET_PIN*) item, true );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_TEXT_T:
|
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIER_LABEL_T:
|
|
|
|
m_frame->EditSchematicText( (SCH_TEXT*) item );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_FIELD_T:
|
|
|
|
m_frame->EditComponentFieldText( (SCH_FIELD*) item );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_BITMAP_T:
|
|
|
|
if( m_frame->EditImage( (SCH_BITMAP*) item ) )
|
|
|
|
{
|
|
|
|
// The bitmap is cached in Opengl: clear the cache in case it has become invalid
|
|
|
|
getView()->RecacheAllItems();
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_LINE_T:
|
|
|
|
m_frame->EditLine( (SCH_LINE*) item, true );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCH_MARKER_T: // These items have no properties to edit
|
|
|
|
case SCH_JUNCTION_T:
|
|
|
|
case SCH_NO_CONNECT_T:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: // Unexpected item
|
|
|
|
wxFAIL_MSG( wxString( "Cannot edit schematic item type " ) + item->GetClass() );
|
|
|
|
}
|
|
|
|
|
|
|
|
updateView( item );
|
|
|
|
|
2019-05-20 07:38:00 +00:00
|
|
|
if( selection.IsHover() )
|
|
|
|
{
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
|
|
|
}
|
|
|
|
|
2019-04-27 23:50:35 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-29 17:50:46 +00:00
|
|
|
int SCH_EDIT_TOOL::ChangeShape( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->GetSelection();
|
|
|
|
char shape;
|
2019-04-29 17:50:46 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
if( aEvent.IsAction( &EE_ACTIONS::toShapeSlash ) )
|
2019-04-29 17:50:46 +00:00
|
|
|
shape = '/';
|
2019-05-10 17:19:48 +00:00
|
|
|
else if( aEvent.IsAction( &EE_ACTIONS::toShapeBackslash ) )
|
2019-04-29 17:50:46 +00:00
|
|
|
shape = '\\';
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
|
2019-05-09 15:10:53 +00:00
|
|
|
for( unsigned int i = 0; i < selection.GetSize(); ++i )
|
2019-04-29 17:50:46 +00:00
|
|
|
{
|
|
|
|
SCH_BUS_ENTRY_BASE* entry = dynamic_cast<SCH_BUS_ENTRY_BASE*>( selection.GetItem( i ) );
|
|
|
|
|
|
|
|
if( entry )
|
|
|
|
{
|
|
|
|
if( entry->GetEditFlags() == 0 )
|
|
|
|
m_frame->SaveCopyInUndoList( entry, UR_CHANGED );
|
|
|
|
|
|
|
|
entry->SetBusEntryShape( shape );
|
|
|
|
m_frame->TestDanglingEnds();
|
|
|
|
|
|
|
|
updateView( entry );
|
|
|
|
m_frame->OnModify( );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_lastBusEntryShape = shape;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
KICAD_T allTextTypes[] = { SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T, SCH_TEXT_T, EOT };
|
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection( allTextTypes );
|
|
|
|
KICAD_T convertTo;
|
2019-04-29 17:50:46 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
if( aEvent.IsAction( &EE_ACTIONS::toLabel ) )
|
2019-05-03 22:48:24 +00:00
|
|
|
convertTo = SCH_LABEL_T;
|
2019-05-10 17:19:48 +00:00
|
|
|
else if( aEvent.IsAction( &EE_ACTIONS::toHLabel ) )
|
2019-05-03 22:48:24 +00:00
|
|
|
convertTo = SCH_HIER_LABEL_T;
|
2019-05-10 17:19:48 +00:00
|
|
|
else if( aEvent.IsAction( &EE_ACTIONS::toGLabel ) )
|
2019-05-03 22:48:24 +00:00
|
|
|
convertTo = SCH_GLOBAL_LABEL_T;
|
2019-05-10 17:19:48 +00:00
|
|
|
else if( aEvent.IsAction( &EE_ACTIONS::toText ) )
|
2019-05-03 22:48:24 +00:00
|
|
|
convertTo = SCH_TEXT_T;
|
2019-04-29 17:50:46 +00:00
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
|
2019-05-09 15:10:53 +00:00
|
|
|
for( unsigned int i = 0; i < selection.GetSize(); ++i )
|
2019-04-29 17:50:46 +00:00
|
|
|
{
|
|
|
|
SCH_TEXT* text = dynamic_cast<SCH_TEXT*>( selection.GetItem( i ) );
|
|
|
|
|
|
|
|
if( text )
|
2019-05-03 22:48:24 +00:00
|
|
|
m_frame->ConvertTextType( text, convertTo );
|
2019-04-29 17:50:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-30 13:54:32 +00:00
|
|
|
int SCH_EDIT_TOOL::BreakWire( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-05-04 13:02:05 +00:00
|
|
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( !aEvent.Modifier( MD_ALT ) );
|
2019-04-30 13:54:32 +00:00
|
|
|
|
|
|
|
if( m_frame->BreakSegments( (wxPoint) cursorPos ) )
|
|
|
|
{
|
|
|
|
m_frame->TestDanglingEnds();
|
|
|
|
|
|
|
|
m_frame->OnModify();
|
|
|
|
m_frame->GetCanvas()->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-01 22:14:21 +00:00
|
|
|
int SCH_EDIT_TOOL::CleanupSheetPins( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::SheetsOnly );
|
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) selection.Front();
|
2019-05-01 22:14:21 +00:00
|
|
|
|
|
|
|
if( !sheet )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if( !sheet->HasUndefinedPins() )
|
|
|
|
{
|
|
|
|
DisplayInfoMessage( m_frame, _( "There are no unreferenced pins in this sheet to remove." ) );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !IsOK( m_frame, _( "Do you wish to delete the unreferenced pins from this sheet?" ) ) )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
m_frame->SaveCopyInUndoList( sheet, UR_CHANGED );
|
|
|
|
|
|
|
|
sheet->CleanupSheet();
|
|
|
|
|
|
|
|
updateView( sheet );
|
|
|
|
m_frame->OnModify();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-23 13:06:37 +00:00
|
|
|
void SCH_EDIT_TOOL::setTransitions()
|
|
|
|
{
|
2019-05-27 10:40:52 +00:00
|
|
|
Go( &SCH_EDIT_TOOL::Duplicate, ACTIONS::duplicate.MakeEvent() );
|
2019-05-10 17:19:48 +00:00
|
|
|
Go( &SCH_EDIT_TOOL::RepeatDrawItem, EE_ACTIONS::repeatDrawItem.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::Rotate, EE_ACTIONS::rotateCW.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::Rotate, EE_ACTIONS::rotateCCW.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorX.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::Mirror, EE_ACTIONS::mirrorY.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::DoDelete, EE_ACTIONS::doDelete.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::DeleteItemCursor, EE_ACTIONS::deleteItemCursor.MakeEvent() );
|
|
|
|
|
|
|
|
Go( &SCH_EDIT_TOOL::Properties, EE_ACTIONS::properties.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::EditField, EE_ACTIONS::editReference.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::EditField, EE_ACTIONS::editValue.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::EditField, EE_ACTIONS::editFootprint.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::AutoplaceFields, EE_ACTIONS::autoplaceFields.MakeEvent() );
|
2019-06-03 13:49:17 +00:00
|
|
|
Go( &SCH_EDIT_TOOL::UpdateFields, EE_ACTIONS::updateFieldsFromLibrary.MakeEvent() );
|
2019-06-01 19:48:01 +00:00
|
|
|
Go( &SCH_EDIT_TOOL::ConvertDeMorgan, EE_ACTIONS::toggleDeMorgan.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::ConvertDeMorgan, EE_ACTIONS::showDeMorganStandard.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::ConvertDeMorgan, EE_ACTIONS::showDeMorganAlternate.MakeEvent() );
|
2019-05-10 17:19:48 +00:00
|
|
|
|
|
|
|
Go( &SCH_EDIT_TOOL::ChangeShape, EE_ACTIONS::toShapeSlash.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::ChangeShape, EE_ACTIONS::toShapeBackslash.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::ChangeTextType, EE_ACTIONS::toLabel.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::ChangeTextType, EE_ACTIONS::toHLabel.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::ChangeTextType, EE_ACTIONS::toGLabel.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::ChangeTextType, EE_ACTIONS::toText.MakeEvent() );
|
|
|
|
|
|
|
|
Go( &SCH_EDIT_TOOL::BreakWire, EE_ACTIONS::breakWire.MakeEvent() );
|
|
|
|
Go( &SCH_EDIT_TOOL::BreakWire, EE_ACTIONS::breakBus.MakeEvent() );
|
|
|
|
|
|
|
|
Go( &SCH_EDIT_TOOL::CleanupSheetPins, EE_ACTIONS::cleanupSheetPins.MakeEvent() );
|
2019-04-23 13:06:37 +00:00
|
|
|
}
|