2019-04-15 14:34:58 +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
|
2022-01-16 20:29:03 +00:00
|
|
|
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2019-04-15 14:34:58 +00:00
|
|
|
*
|
|
|
|
* 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-21 23:45:34 +00:00
|
|
|
#include <core/typeinfo.h>
|
2021-03-22 12:51:32 +00:00
|
|
|
#include <core/kicad_algo.h>
|
2021-11-01 21:05:30 +00:00
|
|
|
#include <geometry/shape_compound.h>
|
2020-01-04 23:05:57 +00:00
|
|
|
#include <ee_actions.h>
|
|
|
|
#include <ee_collectors.h>
|
2019-05-10 17:19:48 +00:00
|
|
|
#include <ee_selection_tool.h>
|
2022-07-12 01:03:45 +00:00
|
|
|
#include <eeschema_id.h>
|
2020-10-31 01:27:16 +00:00
|
|
|
#include <symbol_edit_frame.h>
|
2020-01-04 23:05:57 +00:00
|
|
|
#include <lib_item.h>
|
2020-12-25 23:37:01 +00:00
|
|
|
#include <symbol_viewer_frame.h>
|
2020-01-04 23:05:57 +00:00
|
|
|
#include <math/util.h>
|
2021-09-19 10:05:58 +00:00
|
|
|
#include <geometry/shape_rect.h>
|
2020-01-04 23:05:57 +00:00
|
|
|
#include <menus_helpers.h>
|
|
|
|
#include <painter.h>
|
|
|
|
#include <preview_items/selection_area.h>
|
|
|
|
#include <sch_base_frame.h>
|
2021-02-24 13:48:02 +00:00
|
|
|
#include <sch_symbol.h>
|
2021-02-01 16:39:26 +00:00
|
|
|
#include <sch_field.h>
|
2020-01-04 23:05:57 +00:00
|
|
|
#include <sch_edit_frame.h>
|
|
|
|
#include <sch_item.h>
|
2019-06-11 20:17:05 +00:00
|
|
|
#include <sch_line.h>
|
2021-12-30 20:05:32 +00:00
|
|
|
#include <sch_bus_entry.h>
|
2021-09-23 21:13:32 +00:00
|
|
|
#include <sch_junction.h>
|
2021-12-30 16:51:04 +00:00
|
|
|
#include <sch_marker.h>
|
2020-01-04 23:05:57 +00:00
|
|
|
#include <sch_sheet.h>
|
2021-04-06 21:15:49 +00:00
|
|
|
#include <sch_sheet_pin.h>
|
2021-11-27 14:18:01 +00:00
|
|
|
#include <lib_shape.h>
|
2020-05-13 02:00:37 +00:00
|
|
|
#include <schematic.h>
|
2019-04-21 23:45:34 +00:00
|
|
|
#include <tool/tool_event.h>
|
|
|
|
#include <tool/tool_manager.h>
|
2020-10-01 23:53:47 +00:00
|
|
|
#include <tools/ee_grid_helper.h>
|
2021-09-29 17:50:22 +00:00
|
|
|
#include <tools/ee_point_editor.h>
|
2019-06-16 13:42:40 +00:00
|
|
|
#include <tools/sch_line_wire_bus_tool.h>
|
2022-07-09 17:55:40 +00:00
|
|
|
#include <tools/sch_editor_control.h>
|
2020-10-14 03:37:48 +00:00
|
|
|
#include <trigo.h>
|
2020-01-04 23:05:57 +00:00
|
|
|
#include <view/view.h>
|
|
|
|
#include <view/view_controls.h>
|
2021-11-13 16:38:19 +00:00
|
|
|
#include <wx/log.h>
|
|
|
|
|
2022-07-12 01:03:45 +00:00
|
|
|
|
2021-02-22 00:35:37 +00:00
|
|
|
SELECTION_CONDITION EE_CONDITIONS::SingleSymbol = []( const SELECTION& aSel )
|
2019-05-02 10:59:36 +00:00
|
|
|
{
|
|
|
|
if( aSel.GetSize() == 1 )
|
|
|
|
{
|
2021-06-10 14:10:55 +00:00
|
|
|
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
|
2019-05-02 10:59:36 +00:00
|
|
|
|
2021-01-19 23:50:18 +00:00
|
|
|
if( symbol )
|
2021-06-15 12:31:28 +00:00
|
|
|
return !symbol->GetLibSymbolRef() || !symbol->GetLibSymbolRef()->IsPower();
|
2019-05-02 10:59:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-02-22 00:35:37 +00:00
|
|
|
SELECTION_CONDITION EE_CONDITIONS::SingleSymbolOrPower = []( const SELECTION& aSel )
|
2021-02-17 00:14:23 +00:00
|
|
|
{
|
2021-06-10 14:10:55 +00:00
|
|
|
return aSel.GetSize() == 1 && aSel.Front()->Type() == SCH_SYMBOL_T;
|
2021-02-17 00:14:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-02-22 00:35:37 +00:00
|
|
|
SELECTION_CONDITION EE_CONDITIONS::SingleDeMorganSymbol = []( const SELECTION& aSel )
|
2019-05-02 10:59:36 +00:00
|
|
|
{
|
|
|
|
if( aSel.GetSize() == 1 )
|
|
|
|
{
|
2021-06-10 14:10:55 +00:00
|
|
|
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
|
2019-05-02 10:59:36 +00:00
|
|
|
|
2021-01-19 23:50:18 +00:00
|
|
|
if( symbol )
|
2021-06-15 12:31:28 +00:00
|
|
|
return symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->HasConversion();
|
2019-05-02 10:59:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-02-22 00:35:37 +00:00
|
|
|
SELECTION_CONDITION EE_CONDITIONS::SingleMultiUnitSymbol = []( const SELECTION& aSel )
|
2019-05-02 20:03:03 +00:00
|
|
|
{
|
|
|
|
if( aSel.GetSize() == 1 )
|
|
|
|
{
|
2021-06-10 14:10:55 +00:00
|
|
|
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
|
2019-05-02 20:03:03 +00:00
|
|
|
|
2021-01-19 23:50:18 +00:00
|
|
|
if( symbol )
|
2021-06-15 12:31:28 +00:00
|
|
|
return symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->GetUnitCount() >= 2;
|
2019-05-02 20:03:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-12-30 16:51:04 +00:00
|
|
|
SELECTION_CONDITION EE_CONDITIONS::SingleNonExcludedMarker = []( const SELECTION& aSel )
|
|
|
|
{
|
|
|
|
if( aSel.CountType( SCH_MARKER_T ) != 1 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return !static_cast<SCH_MARKER*>( aSel.Front() )->IsExcluded();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-05-10 19:28:16 +00:00
|
|
|
#define HITTEST_THRESHOLD_PIXELS 5
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
EE_SELECTION_TOOL::EE_SELECTION_TOOL() :
|
2022-07-12 01:03:45 +00:00
|
|
|
SELECTION_TOOL( "eeschema.InteractiveSelection" ),
|
2019-04-28 23:34:43 +00:00
|
|
|
m_frame( nullptr ),
|
2020-11-21 20:57:13 +00:00
|
|
|
m_nonModifiedCursor( KICURSOR::ARROW ),
|
2020-10-31 01:27:16 +00:00
|
|
|
m_isSymbolEditor( false ),
|
2020-12-25 23:37:01 +00:00
|
|
|
m_isSymbolViewer( false ),
|
2019-05-06 02:32:01 +00:00
|
|
|
m_unit( 0 ),
|
2019-06-05 19:15:57 +00:00
|
|
|
m_convert( 0 )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2020-08-20 23:05:21 +00:00
|
|
|
m_selection.Clear();
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
EE_SELECTION_TOOL::~EE_SELECTION_TOOL()
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
|
|
|
getView()->Remove( &m_selection );
|
|
|
|
}
|
|
|
|
|
2020-10-18 20:30:37 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
using E_C = EE_CONDITIONS;
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2020-10-18 20:30:37 +00:00
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
bool EE_SELECTION_TOOL::Init()
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2019-05-06 02:32:01 +00:00
|
|
|
m_frame = getEditFrame<SCH_BASE_FRAME>();
|
|
|
|
|
2020-12-25 23:37:01 +00:00
|
|
|
SYMBOL_VIEWER_FRAME* symbolViewerFrame = dynamic_cast<SYMBOL_VIEWER_FRAME*>( m_frame );
|
|
|
|
SYMBOL_EDIT_FRAME* symbolEditorFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
|
2019-05-06 02:32:01 +00:00
|
|
|
|
2020-10-31 01:27:16 +00:00
|
|
|
if( symbolEditorFrame )
|
2019-05-06 02:32:01 +00:00
|
|
|
{
|
2020-10-31 01:27:16 +00:00
|
|
|
m_isSymbolEditor = true;
|
|
|
|
m_unit = symbolEditorFrame->GetUnit();
|
|
|
|
m_convert = symbolEditorFrame->GetConvert();
|
2019-05-06 02:32:01 +00:00
|
|
|
}
|
2019-05-25 08:09:26 +00:00
|
|
|
else
|
2020-10-31 01:27:16 +00:00
|
|
|
{
|
2020-12-25 23:37:01 +00:00
|
|
|
m_isSymbolViewer = symbolViewerFrame != nullptr;
|
2020-10-31 01:27:16 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2021-07-17 19:56:18 +00:00
|
|
|
static KICAD_T wireOrBusTypes[] = { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T, EOT };
|
2021-10-12 20:05:37 +00:00
|
|
|
static KICAD_T connectedTypes[] = { SCH_ITEM_LOCATE_WIRE_T,
|
|
|
|
SCH_ITEM_LOCATE_BUS_T,
|
|
|
|
SCH_GLOBAL_LABEL_T,
|
|
|
|
SCH_HIER_LABEL_T,
|
|
|
|
SCH_LABEL_T,
|
2022-01-24 13:40:39 +00:00
|
|
|
SCH_DIRECTIVE_LABEL_T,
|
2021-10-12 20:05:37 +00:00
|
|
|
SCH_SHEET_PIN_T,
|
|
|
|
SCH_PIN_T,
|
|
|
|
EOT };
|
2019-05-02 15:01:51 +00:00
|
|
|
|
2022-01-16 20:29:03 +00:00
|
|
|
static KICAD_T crossProbingTypes[] = { SCH_SYMBOL_T, SCH_PIN_T, SCH_SHEET_T, EOT };
|
|
|
|
|
2022-02-27 20:14:22 +00:00
|
|
|
auto wireSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_ITEM_LOCATE_WIRE_T );
|
|
|
|
auto busSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_ITEM_LOCATE_BUS_T );
|
|
|
|
auto wireOrBusSelection = E_C::Count( 1 ) && E_C::OnlyTypes( wireOrBusTypes );
|
|
|
|
auto connectedSelection = E_C::Count( 1 ) && E_C::OnlyTypes( connectedTypes );
|
|
|
|
auto sheetSelection = E_C::Count( 1 ) && E_C::OnlyType( SCH_SHEET_T );
|
2022-01-16 20:29:03 +00:00
|
|
|
auto crossProbingSelection = E_C::MoreThan( 0 ) && E_C::HasTypes( crossProbingTypes );
|
2020-07-07 10:17:30 +00:00
|
|
|
|
2020-12-11 20:02:20 +00:00
|
|
|
auto schEditSheetPageNumberCondition =
|
2021-02-19 14:51:18 +00:00
|
|
|
[&] ( const SELECTION& aSel )
|
2020-12-11 20:02:20 +00:00
|
|
|
{
|
2021-02-19 14:51:18 +00:00
|
|
|
if( m_isSymbolEditor || m_isSymbolViewer )
|
|
|
|
return false;
|
|
|
|
|
2021-02-19 19:04:44 +00:00
|
|
|
return E_C::LessThan( 2 )( aSel ) && E_C::OnlyType( SCH_SHEET_T )( aSel );
|
2020-12-11 20:02:20 +00:00
|
|
|
};
|
|
|
|
|
2020-07-07 10:17:30 +00:00
|
|
|
auto schEditCondition =
|
|
|
|
[this] ( const SELECTION& aSel )
|
|
|
|
{
|
2020-12-25 23:37:01 +00:00
|
|
|
return !m_isSymbolEditor && !m_isSymbolViewer;
|
2020-07-07 10:17:30 +00:00
|
|
|
};
|
|
|
|
|
2020-05-13 02:00:37 +00:00
|
|
|
auto belowRootSheetCondition =
|
|
|
|
[&]( const SELECTION& aSel )
|
|
|
|
{
|
2020-12-25 23:37:01 +00:00
|
|
|
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
|
2020-05-13 02:00:37 +00:00
|
|
|
|
2020-12-25 23:37:01 +00:00
|
|
|
return editFrame
|
|
|
|
&& editFrame->GetCurrentSheet().Last() != &editFrame->Schematic().Root();
|
2020-05-13 02:00:37 +00:00
|
|
|
};
|
|
|
|
|
2022-07-10 23:14:29 +00:00
|
|
|
auto haveHighlight =
|
|
|
|
[&]( const SELECTION& sel )
|
|
|
|
{
|
|
|
|
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
|
|
|
|
|
|
|
|
return editFrame && editFrame->GetHighlightedConnection() != nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
auto haveSymbol =
|
2020-05-13 02:00:37 +00:00
|
|
|
[&]( const SELECTION& sel )
|
|
|
|
{
|
2021-06-15 12:31:28 +00:00
|
|
|
return m_isSymbolEditor &&
|
|
|
|
static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
|
2020-05-13 02:00:37 +00:00
|
|
|
};
|
2019-05-02 15:01:51 +00:00
|
|
|
|
|
|
|
auto& menu = m_menu.GetMenu();
|
|
|
|
|
2022-07-10 23:14:29 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::clearHighlight, haveHighlight && EE_CONDITIONS::Idle, 1 );
|
|
|
|
menu.AddSeparator( haveHighlight && EE_CONDITIONS::Idle, 1 );
|
|
|
|
|
|
|
|
menu.AddItem( EE_ACTIONS::enterSheet, sheetSelection && EE_CONDITIONS::Idle, 2 );
|
|
|
|
menu.AddItem( EE_ACTIONS::selectOnPCB, crossProbingSelection && EE_CONDITIONS::Idle, 2 );
|
|
|
|
menu.AddItem( EE_ACTIONS::leaveSheet, belowRootSheetCondition, 2 );
|
2019-05-03 22:48:24 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
menu.AddSeparator( 100 );
|
2019-06-15 00:29:42 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::drawWire, schEditCondition && EE_CONDITIONS::Empty, 100 );
|
|
|
|
menu.AddItem( EE_ACTIONS::drawBus, schEditCondition && EE_CONDITIONS::Empty, 100 );
|
2019-05-03 22:48:24 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
menu.AddSeparator( 100 );
|
2020-07-07 10:17:30 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::finishWire, SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire, 100 );
|
2019-05-02 15:01:51 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
menu.AddSeparator( 100 );
|
2020-07-07 10:17:30 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::finishBus, SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus, 100 );
|
2019-05-10 17:19:48 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
menu.AddSeparator( 200 );
|
2022-02-27 20:14:22 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::selectConnection, connectedSelection && EE_CONDITIONS::Idle, 250 );
|
2019-06-15 00:29:42 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::placeJunction, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
|
|
|
|
menu.AddItem( EE_ACTIONS::placeLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
|
2021-10-12 20:05:37 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::placeClassLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
|
2019-06-15 00:29:42 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::placeGlobalLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
|
|
|
|
menu.AddItem( EE_ACTIONS::placeHierLabel, wireOrBusSelection && EE_CONDITIONS::Idle, 250 );
|
2019-05-17 15:16:13 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::breakWire, wireSelection && EE_CONDITIONS::Idle, 250 );
|
|
|
|
menu.AddItem( EE_ACTIONS::breakBus, busSelection && EE_CONDITIONS::Idle, 250 );
|
2021-02-21 15:44:38 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::importSingleSheetPin, sheetSelection && EE_CONDITIONS::Idle, 250 );
|
2020-07-07 10:17:30 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::assignNetclass, connectedSelection && EE_CONDITIONS::Idle, 250 );
|
2020-12-11 20:02:20 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::editPageNumber, schEditSheetPageNumberCondition, 250 );
|
2019-05-11 14:38:05 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
menu.AddSeparator( 400 );
|
2022-07-10 23:14:29 +00:00
|
|
|
menu.AddItem( EE_ACTIONS::symbolProperties, haveSymbol && EE_CONDITIONS::Empty, 400 );
|
|
|
|
menu.AddItem( EE_ACTIONS::pinTable, haveSymbol && EE_CONDITIONS::Empty, 400 );
|
2019-05-01 13:24:51 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
menu.AddSeparator( 1000 );
|
2019-06-11 14:38:21 +00:00
|
|
|
m_frame->AddStandardSubMenus( m_menu );
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2021-09-05 20:37:52 +00:00
|
|
|
m_disambiguateTimer.SetOwner( this );
|
|
|
|
Connect( wxEVT_TIMER, wxTimerEventHandler( EE_SELECTION_TOOL::onDisambiguationExpire ), nullptr, this );
|
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
void EE_SELECTION_TOOL::Reset( RESET_REASON aReason )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2019-05-06 02:32:01 +00:00
|
|
|
m_frame = getEditFrame<SCH_BASE_FRAME>();
|
2019-04-21 23:45:34 +00:00
|
|
|
|
|
|
|
if( aReason == TOOL_BASE::MODEL_RELOAD )
|
|
|
|
{
|
|
|
|
// Remove pointers to the selected items from containers without changing their
|
|
|
|
// properties (as they are already deleted while a new sheet is loaded)
|
|
|
|
m_selection.Clear();
|
|
|
|
getView()->GetPainter()->GetSettings()->SetHighlight( false );
|
2019-05-06 02:32:01 +00:00
|
|
|
|
2020-12-25 23:37:01 +00:00
|
|
|
SYMBOL_EDIT_FRAME* symbolEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
|
|
|
|
SYMBOL_VIEWER_FRAME* symbolViewerFrame = dynamic_cast<SYMBOL_VIEWER_FRAME*>( m_frame );
|
2019-05-06 02:32:01 +00:00
|
|
|
|
2020-12-25 23:37:01 +00:00
|
|
|
if( symbolEditFrame )
|
2019-05-06 02:32:01 +00:00
|
|
|
{
|
2020-10-31 01:27:16 +00:00
|
|
|
m_isSymbolEditor = true;
|
2020-12-25 23:37:01 +00:00
|
|
|
m_unit = symbolEditFrame->GetUnit();
|
|
|
|
m_convert = symbolEditFrame->GetConvert();
|
2019-05-06 02:32:01 +00:00
|
|
|
}
|
2019-05-25 08:09:26 +00:00
|
|
|
else
|
2022-07-12 01:03:45 +00:00
|
|
|
{
|
2020-12-25 23:37:01 +00:00
|
|
|
m_isSymbolViewer = symbolViewerFrame != nullptr;
|
2022-07-12 01:03:45 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
else
|
2022-02-25 15:32:13 +00:00
|
|
|
{
|
2019-04-21 23:45:34 +00:00
|
|
|
// Restore previous properties of selected items and remove them from containers
|
2019-05-19 21:04:04 +00:00
|
|
|
ClearSelection();
|
2022-02-25 15:32:13 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
|
|
|
|
// Reinsert the VIEW_GROUP, in case it was removed from the VIEW
|
|
|
|
getView()->Remove( &m_selection );
|
|
|
|
getView()->Add( &m_selection );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-23 22:57:34 +00:00
|
|
|
const KICAD_T movableSymbolItems[] =
|
|
|
|
{
|
2021-10-12 20:05:37 +00:00
|
|
|
LIB_SHAPE_T,
|
2020-04-23 22:57:34 +00:00
|
|
|
LIB_TEXT_T,
|
2022-03-07 10:33:39 +00:00
|
|
|
LIB_TEXTBOX_T,
|
2020-04-23 22:57:34 +00:00
|
|
|
LIB_PIN_T,
|
|
|
|
LIB_FIELD_T,
|
|
|
|
EOT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-07-01 20:03:14 +00:00
|
|
|
const KICAD_T movableSymbolAliasItems[] =
|
|
|
|
{
|
|
|
|
LIB_FIELD_T,
|
|
|
|
EOT
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2020-10-08 00:50:28 +00:00
|
|
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
2019-05-20 18:51:24 +00:00
|
|
|
|
2020-10-02 20:18:07 +00:00
|
|
|
KIID lastRolloverItem = niluuid;
|
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
// Main loop: keep receiving events
|
2019-06-17 13:43:22 +00:00
|
|
|
while( TOOL_EVENT* evt = Wait() )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2022-02-14 00:53:47 +00:00
|
|
|
bool selCancelled = false;
|
2020-10-08 00:50:28 +00:00
|
|
|
bool displayWireCursor = false;
|
2021-02-15 14:57:06 +00:00
|
|
|
bool displayBusCursor = false;
|
2021-02-17 19:43:07 +00:00
|
|
|
bool displayLineCursor = false;
|
2020-11-29 16:31:43 +00:00
|
|
|
KIID rolloverItem = lastRolloverItem;
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2021-02-24 19:26:50 +00:00
|
|
|
// on left click, a selection is made, depending on modifiers ALT, SHIFT, CTRL:
|
2021-03-25 09:28:20 +00:00
|
|
|
setModifiersState( evt->Modifier( MD_SHIFT ), evt->Modifier( MD_CTRL ),
|
|
|
|
evt->Modifier( MD_ALT ) );
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2021-02-24 19:26:50 +00:00
|
|
|
bool modifier_enabled = m_subtractive || m_additive || m_exclusive_or;
|
|
|
|
|
|
|
|
MOUSE_DRAG_ACTION drag_action = m_frame->GetDragAction();
|
2020-10-02 20:18:07 +00:00
|
|
|
EE_GRID_HELPER grid( m_toolMgr );
|
|
|
|
|
2021-09-05 20:37:52 +00:00
|
|
|
if( evt->IsMouseDown( BUT_LEFT ) )
|
|
|
|
{
|
|
|
|
// Avoid triggering when running under other tools
|
2022-04-17 07:54:19 +00:00
|
|
|
if( m_frame->ToolStackIsEmpty() && m_toolMgr->GetTool<EE_POINT_EDITOR>()
|
|
|
|
&& !m_toolMgr->GetTool<EE_POINT_EDITOR>()->HasPoint() )
|
2021-09-09 23:23:00 +00:00
|
|
|
{
|
|
|
|
m_originalCursor = m_toolMgr->GetMousePosition();
|
2021-09-05 20:37:52 +00:00
|
|
|
m_disambiguateTimer.StartOnce( 500 );
|
2021-09-09 23:23:00 +00:00
|
|
|
}
|
2021-09-05 20:37:52 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
// Single click? Select single object
|
2021-09-05 20:37:52 +00:00
|
|
|
else if( evt->IsClick( BUT_LEFT ) )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2021-09-05 20:37:52 +00:00
|
|
|
// If the timer has stopped, then we have already run the disambiguate routine
|
|
|
|
// and we don't want to register an extra click here
|
|
|
|
if( !m_disambiguateTimer.IsRunning() )
|
|
|
|
{
|
|
|
|
evt->SetPassEvent();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_disambiguateTimer.Stop();
|
|
|
|
|
2020-10-02 20:18:07 +00:00
|
|
|
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
2020-05-13 02:00:37 +00:00
|
|
|
schframe->FocusOnItem( nullptr );
|
2020-03-16 11:05:01 +00:00
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
// Collect items at the clicked location (doesn't select them yet)
|
2020-10-01 23:53:47 +00:00
|
|
|
EE_COLLECTOR collector;
|
2022-02-14 00:53:47 +00:00
|
|
|
CollectHits( collector, evt->Position() );
|
2022-03-03 14:35:57 +00:00
|
|
|
narrowSelection( collector, evt->Position(), false );
|
2020-10-01 23:53:47 +00:00
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
if( collector.GetCount() == 1 && !m_isSymbolEditor && !modifier_enabled )
|
2020-10-01 23:53:47 +00:00
|
|
|
{
|
2022-02-14 00:53:47 +00:00
|
|
|
OPT_TOOL_EVENT autostart = autostartEvent( evt, grid, collector[0] );
|
2020-10-01 23:53:47 +00:00
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
if( autostart )
|
2020-10-01 23:53:47 +00:00
|
|
|
{
|
2022-02-14 00:53:47 +00:00
|
|
|
DRAW_SEGMENT_EVENT_PARAMS* params = new DRAW_SEGMENT_EVENT_PARAMS();
|
2020-10-03 19:05:28 +00:00
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
params->layer = autostart->Parameter<DRAW_SEGMENT_EVENT_PARAMS*>()->layer;
|
|
|
|
params->quitOnDraw = true;
|
|
|
|
params->sourceSegment = dynamic_cast<SCH_LINE*>( collector[0] );
|
2021-02-17 19:43:07 +00:00
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
autostart->SetParameter( params );
|
|
|
|
m_toolMgr->ProcessEvent( *autostart );
|
2020-10-02 20:18:07 +00:00
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
selCancelled = true;
|
|
|
|
}
|
|
|
|
else if( collector[0]->IsHypertext() )
|
|
|
|
{
|
|
|
|
collector[0]->DoHypertextMenu( m_frame );
|
|
|
|
selCancelled = true;
|
2020-10-01 23:53:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
if( !selCancelled )
|
2020-10-01 23:53:47 +00:00
|
|
|
{
|
2022-03-03 14:35:57 +00:00
|
|
|
selectPoint( collector, evt->Position(), nullptr, nullptr, m_additive,
|
|
|
|
m_subtractive, m_exclusive_or );
|
2021-12-02 16:54:13 +00:00
|
|
|
m_selection.SetIsHover( false );
|
2020-10-01 23:53:47 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
else if( evt->IsClick( BUT_RIGHT ) )
|
|
|
|
{
|
2021-09-05 20:37:52 +00:00
|
|
|
m_disambiguateTimer.Stop();
|
|
|
|
|
2020-11-23 19:46:17 +00:00
|
|
|
// right click? if there is any object - show the context menu
|
2021-01-31 14:59:18 +00:00
|
|
|
if( m_selection.Empty() )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2019-10-29 15:11:06 +00:00
|
|
|
ClearSelection();
|
2022-02-14 00:53:47 +00:00
|
|
|
SelectPoint( evt->Position(), EE_COLLECTOR::AllItems, nullptr, &selCancelled );
|
2019-04-21 23:45:34 +00:00
|
|
|
m_selection.SetIsHover( true );
|
|
|
|
}
|
2021-01-31 14:59:18 +00:00
|
|
|
// If the cursor has moved off the bounding box of the selection by more than
|
|
|
|
// a grid square, check to see if there is another item available for selection
|
|
|
|
// under the cursor. If there is, the user likely meant to get the context menu
|
|
|
|
// for that item. If there is no new item, then keep the original selection and
|
|
|
|
// show the context menu for it.
|
2022-02-14 00:53:47 +00:00
|
|
|
else if( !m_selection.GetBoundingBox().Inflate( grid.GetGrid().x, grid.GetGrid().y )
|
|
|
|
.Contains( evt->Position() ) )
|
2021-01-31 14:59:18 +00:00
|
|
|
{
|
|
|
|
EE_SELECTION saved_selection = m_selection;
|
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
for( EDA_ITEM* item : saved_selection )
|
2021-01-31 14:59:18 +00:00
|
|
|
RemoveItemFromSel( item, true );
|
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
SelectPoint( evt->Position(), EE_COLLECTOR::AllItems, nullptr, &selCancelled );
|
2021-01-31 14:59:18 +00:00
|
|
|
|
|
|
|
if( m_selection.Empty() )
|
|
|
|
{
|
|
|
|
m_selection.SetIsHover( false );
|
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
for( EDA_ITEM* item : saved_selection )
|
2021-01-31 14:59:18 +00:00
|
|
|
AddItemToSel( item, true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_selection.SetIsHover( true );
|
|
|
|
}
|
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
if( !selCancelled )
|
2019-05-19 21:04:04 +00:00
|
|
|
m_menu.ShowContextMenu( m_selection );
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
else if( evt->IsDblClick( BUT_LEFT ) )
|
|
|
|
{
|
2021-09-06 19:26:20 +00:00
|
|
|
m_disambiguateTimer.Stop();
|
|
|
|
|
2020-11-23 19:46:17 +00:00
|
|
|
// double click? Display the properties window
|
2020-12-14 21:11:33 +00:00
|
|
|
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
2020-05-13 02:00:37 +00:00
|
|
|
schframe->FocusOnItem( nullptr );
|
2020-03-16 11:05:01 +00:00
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
if( m_selection.Empty() )
|
2020-11-23 19:46:17 +00:00
|
|
|
SelectPoint( evt->Position() );
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2019-05-03 20:14:03 +00:00
|
|
|
EDA_ITEM* item = m_selection.Front();
|
|
|
|
|
|
|
|
if( item && item->Type() == SCH_SHEET_T )
|
2019-05-10 17:19:48 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::enterSheet );
|
2019-05-03 20:14:03 +00:00
|
|
|
else
|
2019-05-10 17:19:48 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::properties );
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
2020-09-17 00:19:31 +00:00
|
|
|
else if( evt->IsDblClick( BUT_MIDDLE ) )
|
|
|
|
{
|
2021-09-05 20:37:52 +00:00
|
|
|
m_disambiguateTimer.Stop();
|
|
|
|
|
2020-11-23 19:46:17 +00:00
|
|
|
// Middle double click? Do zoom to fit or zoom to objects
|
2021-03-05 06:43:03 +00:00
|
|
|
if( evt->Modifier( MD_CTRL ) ) // Is CTRL key down?
|
2020-09-17 00:19:31 +00:00
|
|
|
m_toolMgr->RunAction( ACTIONS::zoomFitObjects, true );
|
|
|
|
else
|
|
|
|
m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true );
|
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
else if( evt->IsDrag( BUT_LEFT ) )
|
|
|
|
{
|
2021-09-05 20:37:52 +00:00
|
|
|
m_disambiguateTimer.Stop();
|
|
|
|
|
2021-03-05 00:01:17 +00:00
|
|
|
// Is another tool already moving a new object? Don't allow a drag start
|
2021-05-30 21:04:07 +00:00
|
|
|
if( !m_selection.Empty() && m_selection[0]->HasFlag( IS_NEW | IS_MOVING ) )
|
2021-03-05 00:01:17 +00:00
|
|
|
{
|
|
|
|
evt->SetPassEvent();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-11-23 19:46:17 +00:00
|
|
|
// drag with LMB? Select multiple objects (or at least draw a selection box) or
|
|
|
|
// drag them
|
2020-12-14 21:11:33 +00:00
|
|
|
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
2020-05-13 02:00:37 +00:00
|
|
|
schframe->FocusOnItem( nullptr );
|
2020-03-16 11:05:01 +00:00
|
|
|
|
2021-01-11 15:46:41 +00:00
|
|
|
if( modifier_enabled || drag_action == MOUSE_DRAG_ACTION::SELECT )
|
2021-01-11 11:48:51 +00:00
|
|
|
{
|
|
|
|
selectMultiple();
|
|
|
|
}
|
2021-01-11 15:46:41 +00:00
|
|
|
else if( m_selection.Empty() && drag_action != MOUSE_DRAG_ACTION::DRAG_ANY )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2019-04-23 17:40:29 +00:00
|
|
|
selectMultiple();
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-01 20:03:14 +00:00
|
|
|
if( m_isSymbolEditor )
|
|
|
|
{
|
|
|
|
if( static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->IsSymbolAlias() )
|
|
|
|
m_selection = RequestSelection( movableSymbolAliasItems );
|
|
|
|
else
|
|
|
|
m_selection = RequestSelection( movableSymbolItems );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-10-12 20:05:37 +00:00
|
|
|
m_selection = RequestSelection( EE_COLLECTOR::MovableItems );
|
2021-07-01 20:03:14 +00:00
|
|
|
}
|
2019-07-09 19:50:40 +00:00
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
// Check if dragging has started within any of selected items bounding box
|
|
|
|
if( selectionContains( evt->Position() ) )
|
|
|
|
{
|
|
|
|
// Yes -> run the move tool and wait till it finishes
|
2020-10-31 01:27:16 +00:00
|
|
|
if( m_isSymbolEditor )
|
2021-07-01 20:03:14 +00:00
|
|
|
m_toolMgr->InvokeTool( "eeschema.SymbolMoveTool" );
|
2020-04-23 22:57:34 +00:00
|
|
|
else
|
|
|
|
m_toolMgr->InvokeTool( "eeschema.InteractiveMove" );
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-07-09 19:50:40 +00:00
|
|
|
// No -> drag a selection box
|
|
|
|
selectMultiple();
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-06-02 21:56:17 +00:00
|
|
|
else if( evt->IsMouseDown( BUT_AUX1 ) )
|
|
|
|
{
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::navigateBack, true );
|
|
|
|
}
|
|
|
|
else if( evt->IsMouseDown( BUT_AUX2 ) )
|
|
|
|
{
|
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::navigateForward, true );
|
|
|
|
}
|
2019-06-15 00:29:42 +00:00
|
|
|
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CHOICE_MENU_CHOICE )
|
2019-05-02 20:03:03 +00:00
|
|
|
{
|
2021-09-05 20:37:52 +00:00
|
|
|
m_disambiguateTimer.Stop();
|
|
|
|
|
2020-11-23 19:46:17 +00:00
|
|
|
// context sub-menu selection? Handle unit selection or bus unfolding
|
2019-05-02 20:03:03 +00:00
|
|
|
if( evt->GetCommandId().get() >= ID_POPUP_SCH_SELECT_UNIT_CMP
|
2021-06-10 14:10:55 +00:00
|
|
|
&& evt->GetCommandId().get() <= ID_POPUP_SCH_SELECT_UNIT_SYM_MAX )
|
2019-05-02 20:03:03 +00:00
|
|
|
{
|
2021-06-10 14:10:55 +00:00
|
|
|
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( m_selection.Front() );
|
2019-05-02 20:44:23 +00:00
|
|
|
int unit = evt->GetCommandId().get() - ID_POPUP_SCH_SELECT_UNIT_CMP;
|
2019-05-02 20:03:03 +00:00
|
|
|
|
2021-06-10 14:10:55 +00:00
|
|
|
if( symbol )
|
|
|
|
static_cast<SCH_EDIT_FRAME*>( m_frame )->SelectUnit( symbol, unit );
|
2019-05-02 20:03:03 +00:00
|
|
|
}
|
2019-05-05 14:16:29 +00:00
|
|
|
else if( evt->GetCommandId().get() >= ID_POPUP_SCH_UNFOLD_BUS
|
|
|
|
&& evt->GetCommandId().get() <= ID_POPUP_SCH_UNFOLD_BUS_END )
|
|
|
|
{
|
|
|
|
wxString* net = new wxString( *evt->Parameter<wxString*>() );
|
2019-05-10 17:19:48 +00:00
|
|
|
m_toolMgr->RunAction( EE_ACTIONS::unfoldBus, true, net );
|
2019-05-05 14:16:29 +00:00
|
|
|
}
|
2019-05-02 20:03:03 +00:00
|
|
|
}
|
2019-07-01 21:01:33 +00:00
|
|
|
else if( evt->IsCancelInteractive() )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2021-09-05 20:37:52 +00:00
|
|
|
m_disambiguateTimer.Stop();
|
|
|
|
|
2020-12-14 21:11:33 +00:00
|
|
|
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
2020-05-13 02:00:37 +00:00
|
|
|
schframe->FocusOnItem( nullptr );
|
2020-03-16 11:05:01 +00:00
|
|
|
|
2022-07-09 17:55:40 +00:00
|
|
|
if( !GetSelection().Empty() )
|
|
|
|
{
|
|
|
|
ClearSelection();
|
|
|
|
}
|
2022-07-10 23:14:29 +00:00
|
|
|
else if( evt->FirstResponder() == this && evt->GetCommandId() != (int) ID_SEL_TOOL )
|
2022-07-09 17:55:40 +00:00
|
|
|
{
|
|
|
|
SCH_EDITOR_CONTROL* editor = m_toolMgr->GetTool<SCH_EDITOR_CONTROL>();
|
|
|
|
|
|
|
|
if( editor )
|
|
|
|
editor->ClearHighlight( *evt );
|
|
|
|
}
|
2019-05-06 20:55:35 +00:00
|
|
|
}
|
|
|
|
else if( evt->Action() == TA_UNDO_REDO_PRE )
|
|
|
|
{
|
2020-12-14 21:11:33 +00:00
|
|
|
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
2020-05-13 02:00:37 +00:00
|
|
|
schframe->FocusOnItem( nullptr );
|
2020-03-16 11:05:01 +00:00
|
|
|
|
2019-05-19 21:04:04 +00:00
|
|
|
ClearSelection();
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
2022-07-09 17:55:40 +00:00
|
|
|
else if( evt->IsMotion() && !m_isSymbolEditor && evt->FirstResponder() == this )
|
2020-10-01 23:53:47 +00:00
|
|
|
{
|
2022-02-14 00:53:47 +00:00
|
|
|
// Update cursor and rollover item
|
2020-11-29 16:31:43 +00:00
|
|
|
rolloverItem = niluuid;
|
2020-10-02 20:18:07 +00:00
|
|
|
EE_COLLECTOR collector;
|
|
|
|
|
2021-10-06 03:26:59 +00:00
|
|
|
getViewControls()->ForceCursorPosition( false );
|
|
|
|
|
2021-09-18 17:18:41 +00:00
|
|
|
if( CollectHits( collector, evt->Position() ) )
|
2020-10-01 23:53:47 +00:00
|
|
|
{
|
2022-03-03 14:35:57 +00:00
|
|
|
narrowSelection( collector, evt->Position(), false );
|
2020-10-01 23:53:47 +00:00
|
|
|
|
2020-10-08 00:50:28 +00:00
|
|
|
if( collector.GetCount() == 1 && !modifier_enabled )
|
2020-10-01 23:53:47 +00:00
|
|
|
{
|
2022-02-14 00:53:47 +00:00
|
|
|
OPT_TOOL_EVENT autostartEvt = autostartEvent( evt, grid, collector[0] );
|
2021-10-01 00:25:33 +00:00
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
if( autostartEvt )
|
2020-10-02 20:18:07 +00:00
|
|
|
{
|
2022-02-14 00:53:47 +00:00
|
|
|
if( autostartEvt->Matches( EE_ACTIONS::drawBus.MakeEvent() ) )
|
2021-02-15 14:57:06 +00:00
|
|
|
displayBusCursor = true;
|
2022-02-14 00:53:47 +00:00
|
|
|
else if( autostartEvt->Matches( EE_ACTIONS::drawWire.MakeEvent() ) )
|
|
|
|
displayWireCursor = true;
|
|
|
|
else if( autostartEvt->Matches( EE_ACTIONS::drawLines.MakeEvent() ) )
|
2021-02-17 19:43:07 +00:00
|
|
|
displayLineCursor = true;
|
2020-10-02 20:18:07 +00:00
|
|
|
}
|
2022-02-14 00:53:47 +00:00
|
|
|
else if( collector[0]->IsHypertext() && !collector[0]->IsSelected() )
|
2020-10-01 23:53:47 +00:00
|
|
|
{
|
2020-10-02 20:18:07 +00:00
|
|
|
rolloverItem = collector[0]->m_Uuid;
|
2020-10-01 23:53:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-05-28 14:39:14 +00:00
|
|
|
else
|
2020-11-23 19:46:17 +00:00
|
|
|
{
|
2019-06-16 11:06:49 +00:00
|
|
|
evt->SetPassEvent();
|
2020-11-23 19:46:17 +00:00
|
|
|
}
|
2020-10-01 23:53:47 +00:00
|
|
|
|
2020-10-02 20:18:07 +00:00
|
|
|
if( rolloverItem != lastRolloverItem )
|
|
|
|
{
|
|
|
|
EDA_ITEM* item = m_frame->GetItem( lastRolloverItem );
|
|
|
|
|
|
|
|
if( item )
|
|
|
|
{
|
|
|
|
item->ClearFlags( IS_ROLLOVER );
|
|
|
|
lastRolloverItem = niluuid;
|
2020-11-17 16:02:47 +00:00
|
|
|
|
|
|
|
if( item->Type() == SCH_FIELD_T )
|
|
|
|
m_frame->GetCanvas()->GetView()->Update( item->GetParent() );
|
|
|
|
else
|
|
|
|
m_frame->GetCanvas()->GetView()->Update( item );
|
2020-10-02 20:18:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
item = m_frame->GetItem( rolloverItem );
|
|
|
|
|
2020-10-12 09:32:51 +00:00
|
|
|
if( item )
|
2020-10-02 20:18:07 +00:00
|
|
|
{
|
|
|
|
item->SetFlags( IS_ROLLOVER );
|
|
|
|
lastRolloverItem = rolloverItem;
|
2020-11-17 16:02:47 +00:00
|
|
|
|
|
|
|
if( item->Type() == SCH_FIELD_T )
|
|
|
|
m_frame->GetCanvas()->GetView()->Update( item->GetParent() );
|
|
|
|
else
|
|
|
|
m_frame->GetCanvas()->GetView()->Update( item );
|
2020-10-02 20:18:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-01 23:53:47 +00:00
|
|
|
if( m_frame->ToolStackIsEmpty() )
|
|
|
|
{
|
2020-10-08 00:50:28 +00:00
|
|
|
if( displayWireCursor )
|
2020-11-18 12:02:52 +00:00
|
|
|
{
|
2020-11-18 15:23:05 +00:00
|
|
|
m_nonModifiedCursor = KICURSOR::LINE_WIRE_ADD;
|
2020-11-18 12:02:52 +00:00
|
|
|
}
|
2021-02-15 14:57:06 +00:00
|
|
|
else if( displayBusCursor )
|
|
|
|
{
|
|
|
|
m_nonModifiedCursor = KICURSOR::LINE_BUS;
|
|
|
|
}
|
2021-02-17 19:43:07 +00:00
|
|
|
else if( displayLineCursor )
|
|
|
|
{
|
|
|
|
m_nonModifiedCursor = KICURSOR::LINE_GRAPHIC;
|
|
|
|
}
|
2020-10-02 20:18:07 +00:00
|
|
|
else if( rolloverItem != niluuid )
|
2020-11-18 12:02:52 +00:00
|
|
|
{
|
2020-11-18 15:23:05 +00:00
|
|
|
m_nonModifiedCursor = KICURSOR::HAND;
|
2020-11-18 12:02:52 +00:00
|
|
|
}
|
2021-01-11 11:48:51 +00:00
|
|
|
else if( !m_selection.Empty()
|
2021-01-11 15:46:41 +00:00
|
|
|
&& drag_action == MOUSE_DRAG_ACTION::DRAG_SELECTED
|
2021-01-11 11:48:51 +00:00
|
|
|
&& evt->HasPosition()
|
|
|
|
&& selectionContains( evt->Position() ) ) //move/drag option prediction
|
2020-11-18 12:02:52 +00:00
|
|
|
{
|
2020-11-18 15:23:05 +00:00
|
|
|
m_nonModifiedCursor = KICURSOR::MOVING;
|
2020-11-18 12:02:52 +00:00
|
|
|
}
|
2020-10-01 23:53:47 +00:00
|
|
|
else
|
2020-10-08 00:50:28 +00:00
|
|
|
{
|
2020-11-18 15:23:05 +00:00
|
|
|
m_nonModifiedCursor = KICURSOR::ARROW;
|
2020-10-08 00:50:28 +00:00
|
|
|
}
|
2020-10-01 23:53:47 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
|
2021-09-05 20:37:52 +00:00
|
|
|
m_disambiguateTimer.Stop();
|
|
|
|
|
2020-10-30 13:57:59 +00:00
|
|
|
// Shutting down; clear the selection
|
|
|
|
m_selection.Clear();
|
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
OPT_TOOL_EVENT EE_SELECTION_TOOL::autostartEvent( TOOL_EVENT* aEvent, EE_GRID_HELPER& aGrid,
|
|
|
|
SCH_ITEM* aItem )
|
|
|
|
{
|
|
|
|
VECTOR2I pos = aGrid.BestSnapAnchor( aEvent->Position(), LAYER_CONNECTABLE );
|
|
|
|
|
|
|
|
if( m_frame->eeconfig()->m_Drawing.auto_start_wires
|
|
|
|
&& !m_toolMgr->GetTool<EE_POINT_EDITOR>()->HasPoint()
|
|
|
|
&& aItem->IsPointClickableAnchor( pos ) )
|
|
|
|
{
|
|
|
|
OPT_TOOL_EVENT newEvt = EE_ACTIONS::drawWire.MakeEvent();
|
|
|
|
|
|
|
|
if( aItem->Type() == SCH_BUS_BUS_ENTRY_T )
|
|
|
|
{
|
|
|
|
newEvt = EE_ACTIONS::drawBus.MakeEvent();
|
|
|
|
}
|
|
|
|
else if( aItem->Type() == SCH_BUS_WIRE_ENTRY_T )
|
|
|
|
{
|
|
|
|
SCH_BUS_WIRE_ENTRY* busEntry = static_cast<SCH_BUS_WIRE_ENTRY*>( aItem );
|
|
|
|
|
|
|
|
if( !busEntry->m_connected_bus_item )
|
|
|
|
newEvt = EE_ACTIONS::drawBus.MakeEvent();
|
|
|
|
}
|
|
|
|
else if( aItem->Type() == SCH_LINE_T )
|
|
|
|
{
|
|
|
|
SCH_LINE* line = static_cast<SCH_LINE*>( aItem );
|
|
|
|
|
|
|
|
if( line->IsBus() )
|
|
|
|
newEvt = EE_ACTIONS::drawBus.MakeEvent();
|
|
|
|
else if( line->IsGraphicLine() )
|
|
|
|
newEvt = EE_ACTIONS::drawLines.MakeEvent();
|
|
|
|
}
|
|
|
|
|
|
|
|
newEvt->SetMousePosition( pos );
|
|
|
|
newEvt->SetHasPosition( true );
|
|
|
|
newEvt->SetForceImmediate( true );
|
|
|
|
|
|
|
|
getViewControls()->ForceCursorPosition( true, pos );
|
|
|
|
|
|
|
|
return newEvt;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OPT_TOOL_EVENT();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-09-05 20:37:52 +00:00
|
|
|
int EE_SELECTION_TOOL::disambiguateCursor( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2022-02-26 00:14:41 +00:00
|
|
|
wxMouseState keyboardState = wxGetMouseState();
|
|
|
|
|
|
|
|
setModifiersState( keyboardState.ShiftDown(), keyboardState.ControlDown(),
|
|
|
|
keyboardState.AltDown() );
|
|
|
|
|
2021-09-05 20:37:52 +00:00
|
|
|
m_skip_heuristics = true;
|
2021-09-24 19:44:26 +00:00
|
|
|
SelectPoint( m_originalCursor, EE_COLLECTOR::AllItems, nullptr, &m_canceledMenu, false,
|
|
|
|
m_additive, m_subtractive, m_exclusive_or );
|
2021-09-05 20:37:52 +00:00
|
|
|
m_skip_heuristics = false;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-18 15:23:05 +00:00
|
|
|
void EE_SELECTION_TOOL::OnIdle( wxIdleEvent& aEvent )
|
|
|
|
{
|
2020-12-30 00:51:34 +00:00
|
|
|
if( m_frame->ToolStackIsEmpty() && !m_multiple )
|
2020-11-18 15:23:05 +00:00
|
|
|
{
|
|
|
|
wxMouseState keyboardState = wxGetMouseState();
|
|
|
|
|
2021-03-25 09:28:20 +00:00
|
|
|
setModifiersState( keyboardState.ShiftDown(), keyboardState.ControlDown(),
|
|
|
|
keyboardState.AltDown() );
|
2020-11-18 15:23:05 +00:00
|
|
|
|
|
|
|
if( m_additive )
|
|
|
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ADD );
|
|
|
|
else if( m_subtractive )
|
|
|
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::SUBTRACT );
|
|
|
|
else if( m_exclusive_or )
|
|
|
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::XOR );
|
|
|
|
else
|
|
|
|
m_frame->GetCanvas()->SetCurrentCursor( m_nonModifiedCursor );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& EE_SELECTION_TOOL::GetSelection()
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
|
|
|
return m_selection;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-19 21:10:04 +00:00
|
|
|
bool EE_SELECTION_TOOL::CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere,
|
2020-10-02 20:18:07 +00:00
|
|
|
const KICAD_T* aFilterList )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2021-09-19 10:05:58 +00:00
|
|
|
int pixelThreshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
|
2021-11-28 18:59:55 +00:00
|
|
|
int gridThreshold = KiROUND( getView()->GetGAL()->GetGridSize().EuclideanNorm() / 2 );
|
2021-09-19 10:05:58 +00:00
|
|
|
aCollector.m_Threshold = std::max( pixelThreshold, gridThreshold );
|
2019-06-25 23:39:58 +00:00
|
|
|
|
2020-10-31 01:27:16 +00:00
|
|
|
if( m_isSymbolEditor )
|
2019-06-25 23:39:58 +00:00
|
|
|
{
|
2021-06-15 12:31:28 +00:00
|
|
|
LIB_SYMBOL* symbol = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
|
2019-05-06 02:32:01 +00:00
|
|
|
|
2021-06-10 18:51:46 +00:00
|
|
|
if( !symbol )
|
2020-05-24 23:35:04 +00:00
|
|
|
return false;
|
2019-05-09 03:11:36 +00:00
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
aCollector.Collect( symbol->GetDrawItems(), aFilterList, aWhere, m_unit, m_convert );
|
2019-06-25 23:39:58 +00:00
|
|
|
}
|
|
|
|
else
|
2020-10-01 23:53:47 +00:00
|
|
|
{
|
2022-02-14 00:53:47 +00:00
|
|
|
aCollector.Collect( m_frame->GetScreen(), aFilterList, aWhere, m_unit, m_convert );
|
2020-10-01 23:53:47 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2020-10-02 20:18:07 +00:00
|
|
|
return aCollector.GetCount() > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EE_SELECTION_TOOL::narrowSelection( EE_COLLECTOR& collector, const VECTOR2I& aWhere,
|
2022-03-03 14:35:57 +00:00
|
|
|
bool aCheckLocked )
|
2020-10-02 20:18:07 +00:00
|
|
|
{
|
|
|
|
for( int i = collector.GetCount() - 1; i >= 0; --i )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2021-09-19 10:05:58 +00:00
|
|
|
if( !Selectable( collector[i], &aWhere ) )
|
2019-06-14 11:00:39 +00:00
|
|
|
{
|
2020-10-02 20:18:07 +00:00
|
|
|
collector.Remove( i );
|
2019-06-14 11:00:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2020-10-02 20:18:07 +00:00
|
|
|
if( aCheckLocked && collector[i]->IsLocked() )
|
2019-06-14 11:00:39 +00:00
|
|
|
{
|
2020-10-02 20:18:07 +00:00
|
|
|
collector.Remove( i );
|
2019-06-14 11:00:39 +00:00
|
|
|
continue;
|
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Apply some ugly heuristics to avoid disambiguation menus whenever possible
|
2020-10-02 20:18:07 +00:00
|
|
|
if( collector.GetCount() > 1 && !m_skip_heuristics )
|
|
|
|
GuessSelectionCandidates( collector, aWhere );
|
2020-10-01 23:53:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-03-03 14:35:57 +00:00
|
|
|
bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, const VECTOR2I& aWhere,
|
|
|
|
EDA_ITEM** aItem, bool* aSelectionCancelledFlag, bool aAdd,
|
|
|
|
bool aSubtract, bool aExclusiveOr )
|
2020-10-01 23:53:47 +00:00
|
|
|
{
|
|
|
|
m_selection.ClearReferencePoint();
|
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
// If still more than one item we're going to have to ask the user.
|
2020-10-01 23:53:47 +00:00
|
|
|
if( aCollector.GetCount() > 1 )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2021-09-13 17:14:59 +00:00
|
|
|
// Try to call selectionMenu via RunAction() to avoid event-loop contention
|
|
|
|
// But it we cannot handle the event, then we don't have an active tool loop, so
|
|
|
|
// handle it directly.
|
|
|
|
if( !m_toolMgr->RunAction( EE_ACTIONS::selectionMenu, true, &aCollector ) )
|
2021-09-23 18:46:07 +00:00
|
|
|
{
|
|
|
|
if( !doSelectionMenu( &aCollector ) )
|
|
|
|
aCollector.m_MenuCancelled = true;
|
|
|
|
}
|
2021-09-13 17:14:59 +00:00
|
|
|
|
|
|
|
if( aCollector.m_MenuCancelled )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
|
|
|
if( aSelectionCancelledFlag )
|
|
|
|
*aSelectionCancelledFlag = true;
|
|
|
|
|
2020-05-24 23:35:04 +00:00
|
|
|
return false;
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-09 19:50:40 +00:00
|
|
|
if( !aAdd && !aSubtract && !aExclusiveOr )
|
|
|
|
ClearSelection();
|
|
|
|
|
2020-05-24 23:35:04 +00:00
|
|
|
bool anyAdded = false;
|
|
|
|
bool anySubtracted = false;
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2020-10-01 23:53:47 +00:00
|
|
|
if( aCollector.GetCount() > 0 )
|
2020-05-24 23:35:04 +00:00
|
|
|
{
|
2020-10-01 23:53:47 +00:00
|
|
|
for( int i = 0; i < aCollector.GetCount(); ++i )
|
2019-07-09 19:50:40 +00:00
|
|
|
{
|
2022-03-03 14:35:57 +00:00
|
|
|
EDA_ITEM_FLAGS flags = 0;
|
|
|
|
|
|
|
|
// Handle line ends specially
|
|
|
|
if( aCollector[i]->Type() == SCH_LINE_T )
|
|
|
|
{
|
|
|
|
SCH_LINE* line = (SCH_LINE*) aCollector[i];
|
|
|
|
|
|
|
|
if( HitTestPoints( line->GetStartPoint(), aWhere, aCollector.m_Threshold ) )
|
|
|
|
flags = STARTPOINT;
|
|
|
|
else if( HitTestPoints( line->GetEndPoint(), aWhere, aCollector.m_Threshold ) )
|
|
|
|
flags = ENDPOINT;
|
|
|
|
else
|
|
|
|
flags = STARTPOINT | ENDPOINT;
|
|
|
|
}
|
|
|
|
|
2020-10-01 23:53:47 +00:00
|
|
|
if( aSubtract || ( aExclusiveOr && aCollector[i]->IsSelected() ) )
|
2020-05-24 23:35:04 +00:00
|
|
|
{
|
2022-03-03 14:35:57 +00:00
|
|
|
aCollector[i]->ClearFlags( flags );
|
2022-07-12 01:03:45 +00:00
|
|
|
|
2022-03-03 14:35:57 +00:00
|
|
|
if( !aCollector[i]->HasFlag( STARTPOINT ) && !aCollector[i]->HasFlag( ENDPOINT ) )
|
|
|
|
{
|
|
|
|
unselect( aCollector[i] );
|
|
|
|
anySubtracted = true;
|
|
|
|
}
|
2020-05-24 23:35:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-03-03 14:35:57 +00:00
|
|
|
aCollector[i]->SetFlags( flags );
|
2020-10-01 23:53:47 +00:00
|
|
|
select( aCollector[i] );
|
2020-05-27 15:18:12 +00:00
|
|
|
anyAdded = true;
|
2020-05-24 23:35:04 +00:00
|
|
|
}
|
2019-07-09 19:50:40 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
|
2020-05-24 23:35:04 +00:00
|
|
|
if( anyAdded )
|
|
|
|
{
|
|
|
|
m_toolMgr->ProcessEvent( EVENTS::SelectedEvent );
|
|
|
|
|
2020-10-01 23:53:47 +00:00
|
|
|
if( aItem && aCollector.GetCount() == 1 )
|
|
|
|
*aItem = aCollector[0];
|
2020-05-24 23:35:04 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if( anySubtracted )
|
|
|
|
{
|
|
|
|
m_toolMgr->ProcessEvent( EVENTS::UnselectedEvent );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-01 23:53:47 +00:00
|
|
|
bool EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T* aFilterList,
|
2020-10-05 10:54:37 +00:00
|
|
|
EDA_ITEM** aItem, bool* aSelectionCancelledFlag,
|
|
|
|
bool aCheckLocked, bool aAdd, bool aSubtract,
|
|
|
|
bool aExclusiveOr )
|
2020-10-01 23:53:47 +00:00
|
|
|
{
|
|
|
|
EE_COLLECTOR collector;
|
|
|
|
|
2021-01-19 21:10:04 +00:00
|
|
|
if( !CollectHits( collector, aWhere, aFilterList ) )
|
2020-10-01 23:53:47 +00:00
|
|
|
return false;
|
2020-10-02 20:18:07 +00:00
|
|
|
|
2022-03-03 14:35:57 +00:00
|
|
|
narrowSelection( collector, aWhere, aCheckLocked );
|
2020-10-01 23:53:47 +00:00
|
|
|
|
2022-03-03 14:35:57 +00:00
|
|
|
return selectPoint( collector, aWhere, aItem, aSelectionCancelledFlag, aAdd, aSubtract,
|
|
|
|
aExclusiveOr );
|
2020-10-01 23:53:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-20 23:05:21 +00:00
|
|
|
int EE_SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
m_multiple = true; // Multiple selection mode is active
|
|
|
|
KIGFX::VIEW* view = getView();
|
|
|
|
|
|
|
|
// hold all visible items
|
|
|
|
std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
|
|
|
|
std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> sheetPins;
|
|
|
|
|
|
|
|
// Filter the view items based on the selection box
|
|
|
|
BOX2I selectionBox;
|
|
|
|
|
|
|
|
selectionBox.SetMaximum();
|
|
|
|
view->Query( selectionBox, selectedItems ); // Get the list of selected items
|
|
|
|
|
|
|
|
// Sheet pins aren't in the view; add them by hand
|
|
|
|
for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : selectedItems )
|
|
|
|
{
|
|
|
|
SCH_SHEET* sheet = dynamic_cast<SCH_SHEET*>( pair.first );
|
|
|
|
|
|
|
|
if( sheet )
|
|
|
|
{
|
|
|
|
int layer = pair.second;
|
|
|
|
|
|
|
|
for( SCH_SHEET_PIN* pin : sheet->GetPins() )
|
|
|
|
sheetPins.emplace_back( KIGFX::VIEW::LAYER_ITEM_PAIR( pin, layer ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
selectedItems.insert( selectedItems.end(), sheetPins.begin(), sheetPins.end() );
|
|
|
|
|
2020-12-14 21:11:33 +00:00
|
|
|
for( const std::pair<KIGFX::VIEW_ITEM*, int>& item_pair : selectedItems )
|
2020-08-20 23:05:21 +00:00
|
|
|
{
|
|
|
|
if( EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( item_pair.first ) )
|
|
|
|
{
|
|
|
|
if( Selectable( item ) )
|
2022-04-11 18:32:16 +00:00
|
|
|
{
|
|
|
|
if( item->Type() == SCH_LINE_T )
|
|
|
|
item->SetFlags( STARTPOINT | ENDPOINT );
|
|
|
|
|
2020-08-20 23:05:21 +00:00
|
|
|
select( item );
|
2022-04-11 18:32:16 +00:00
|
|
|
}
|
2020-08-20 23:05:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_multiple = false;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-28 19:11:26 +00:00
|
|
|
void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const VECTOR2I& aPos )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2019-06-28 19:11:26 +00:00
|
|
|
// Prefer exact hits to sloppy ones
|
2021-09-19 10:05:58 +00:00
|
|
|
std::set<EDA_ITEM*> exactHits;
|
2019-06-26 18:43:37 +00:00
|
|
|
|
|
|
|
for( int i = collector.GetCount() - 1; i >= 0; --i )
|
2019-05-16 23:48:39 +00:00
|
|
|
{
|
2021-11-27 14:18:01 +00:00
|
|
|
EDA_ITEM* item = collector[ i ];
|
|
|
|
SCH_LINE* line = dynamic_cast<SCH_LINE*>( item );
|
|
|
|
LIB_SHAPE* shape = dynamic_cast<LIB_SHAPE*>( item );
|
2019-05-16 23:48:39 +00:00
|
|
|
|
2021-09-21 17:15:41 +00:00
|
|
|
// Lines are hard to hit. Give them a bit more slop to still be considered "exact".
|
|
|
|
|
2021-11-27 14:18:01 +00:00
|
|
|
if( line || ( shape && shape->GetShape() == SHAPE_T::POLY ) )
|
2021-09-21 17:15:41 +00:00
|
|
|
{
|
2022-02-14 00:53:47 +00:00
|
|
|
if( item->HitTest( aPos, Mils2iu( DANGLING_SYMBOL_SIZE ) ) )
|
2021-11-27 14:18:01 +00:00
|
|
|
exactHits.insert( item );
|
2021-09-21 17:15:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-14 00:53:47 +00:00
|
|
|
if( item->HitTest( aPos, 0 ) )
|
2021-09-21 17:15:41 +00:00
|
|
|
exactHits.insert( item );
|
|
|
|
}
|
2019-05-16 23:48:39 +00:00
|
|
|
}
|
|
|
|
|
2021-09-19 10:05:58 +00:00
|
|
|
if( exactHits.size() > 0 && exactHits.size() < (unsigned) collector.GetCount() )
|
2019-06-26 18:43:37 +00:00
|
|
|
{
|
|
|
|
for( int i = collector.GetCount() - 1; i >= 0; --i )
|
|
|
|
{
|
|
|
|
EDA_ITEM* item = collector[ i ];
|
|
|
|
|
2021-09-21 17:15:41 +00:00
|
|
|
if( !exactHits.count( item ) )
|
2020-07-07 04:51:12 +00:00
|
|
|
collector.Transfer( item );
|
2019-06-26 18:43:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-19 10:05:58 +00:00
|
|
|
// Find the closest item. (Note that at this point all hits are either exact or non-exact.)
|
2022-02-14 00:53:47 +00:00
|
|
|
VECTOR2I pos( aPos );
|
2021-11-27 14:18:01 +00:00
|
|
|
SEG poss( m_isSymbolEditor ? mapCoords( pos ) : pos,
|
|
|
|
m_isSymbolEditor ? mapCoords( pos ) : pos );
|
2020-09-19 14:55:05 +00:00
|
|
|
EDA_ITEM* closest = nullptr;
|
2021-11-01 21:05:30 +00:00
|
|
|
int closestDist = INT_MAX / 2;
|
2020-09-19 14:55:05 +00:00
|
|
|
|
|
|
|
for( EDA_ITEM* item : collector )
|
|
|
|
{
|
2021-09-19 10:05:58 +00:00
|
|
|
EDA_RECT bbox = item->GetBoundingBox();
|
2021-11-01 21:05:30 +00:00
|
|
|
int dist = INT_MAX / 2;
|
2021-09-19 10:05:58 +00:00
|
|
|
|
|
|
|
if( exactHits.count( item ) )
|
|
|
|
{
|
2021-09-23 22:58:46 +00:00
|
|
|
if( item->Type() == SCH_PIN_T || item->Type() == SCH_JUNCTION_T )
|
|
|
|
{
|
|
|
|
closest = item;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-11-01 21:05:30 +00:00
|
|
|
SCH_LINE* line = dynamic_cast<SCH_LINE*>( item );
|
|
|
|
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( item );
|
|
|
|
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item );
|
2021-09-21 17:15:41 +00:00
|
|
|
|
2021-09-23 22:58:46 +00:00
|
|
|
if( line )
|
2021-11-01 21:05:30 +00:00
|
|
|
{
|
2021-09-21 17:15:41 +00:00
|
|
|
dist = DistanceLinePoint( line->GetStartPoint(), line->GetEndPoint(), pos );
|
2021-11-01 21:05:30 +00:00
|
|
|
}
|
|
|
|
else if( text )
|
|
|
|
{
|
|
|
|
text->GetEffectiveTextShape()->Collide( poss, closestDist, &dist );
|
|
|
|
}
|
|
|
|
else if( symbol )
|
|
|
|
{
|
2021-11-13 16:38:19 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
bbox = symbol->GetBodyBoundingBox();
|
|
|
|
}
|
|
|
|
catch( const boost::bad_pointer& exc )
|
|
|
|
{
|
|
|
|
// This may be overkill and could be an assertion but we are more likely to
|
|
|
|
// find any boost pointer container errors this way.
|
|
|
|
wxLogError( wxT( "Boost bad pointer exception '%s' occurred." ), exc.what() );
|
|
|
|
}
|
|
|
|
|
2021-11-01 21:05:30 +00:00
|
|
|
SHAPE_RECT rect( bbox.GetPosition(), bbox.GetWidth(), bbox.GetHeight() );
|
|
|
|
|
|
|
|
if( bbox.Contains( pos ) )
|
|
|
|
dist = EuclideanNorm( bbox.GetCenter() - pos );
|
|
|
|
else
|
|
|
|
rect.Collide( poss, closestDist, &dist );
|
|
|
|
}
|
2021-09-21 17:15:41 +00:00
|
|
|
else
|
2021-11-01 21:05:30 +00:00
|
|
|
{
|
|
|
|
dist = EuclideanNorm( bbox.GetCenter() - pos );
|
|
|
|
}
|
2021-09-19 10:05:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SHAPE_RECT rect( bbox.GetPosition(), bbox.GetWidth(), bbox.GetHeight() );
|
2021-11-01 21:05:30 +00:00
|
|
|
rect.Collide( poss, collector.m_Threshold, &dist );
|
2021-09-19 10:05:58 +00:00
|
|
|
}
|
|
|
|
|
2022-03-19 16:36:32 +00:00
|
|
|
if( dist == closestDist )
|
|
|
|
{
|
|
|
|
if( item->GetParent() == closest )
|
|
|
|
closest = item;
|
|
|
|
}
|
|
|
|
else if( dist < closestDist )
|
2020-09-19 14:55:05 +00:00
|
|
|
{
|
|
|
|
closestDist = dist;
|
|
|
|
closest = item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-19 10:05:58 +00:00
|
|
|
// Construct a tight box (1/2 height and width) around the center of the closest item.
|
|
|
|
// All items which exist at least partly outside this box have sufficient other areas
|
|
|
|
// for selection and can be dropped.
|
2020-09-30 02:28:23 +00:00
|
|
|
if( closest ) // Don't try and get a tight bbox if nothing is near the mouse pointer
|
2020-09-19 14:55:05 +00:00
|
|
|
{
|
2020-09-30 02:28:23 +00:00
|
|
|
EDA_RECT tightBox = closest->GetBoundingBox();
|
|
|
|
tightBox.Inflate( -tightBox.GetWidth() / 4, -tightBox.GetHeight() / 4 );
|
2020-09-19 14:55:05 +00:00
|
|
|
|
2020-09-30 02:28:23 +00:00
|
|
|
for( int i = collector.GetCount() - 1; i >= 0; --i )
|
|
|
|
{
|
|
|
|
EDA_ITEM* item = collector[i];
|
|
|
|
|
|
|
|
if( item == closest )
|
|
|
|
continue;
|
2020-09-19 14:55:05 +00:00
|
|
|
|
2020-09-30 02:28:23 +00:00
|
|
|
if( !item->HitTest( tightBox, true ) )
|
|
|
|
collector.Transfer( item );
|
|
|
|
}
|
2020-09-19 14:55:05 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-06-08 21:48:22 +00:00
|
|
|
EE_SELECTION& EE_SELECTION_TOOL::RequestSelection( const KICAD_T aFilterList[] )
|
2019-04-23 12:51:48 +00:00
|
|
|
{
|
2020-03-06 20:02:58 +00:00
|
|
|
if( m_selection.Empty() )
|
|
|
|
{
|
|
|
|
VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
|
|
|
|
|
|
|
|
ClearSelection();
|
|
|
|
SelectPoint( cursorPos, aFilterList );
|
|
|
|
m_selection.SetIsHover( true );
|
|
|
|
m_selection.ClearReferencePoint();
|
|
|
|
}
|
|
|
|
else // Trim an existing selection by aFilterList
|
2019-04-23 17:12:10 +00:00
|
|
|
{
|
2021-10-18 12:24:06 +00:00
|
|
|
bool isMoving = false;
|
|
|
|
|
2020-03-06 20:02:58 +00:00
|
|
|
for( int i = (int) m_selection.GetSize() - 1; i >= 0; --i )
|
2019-04-27 23:50:35 +00:00
|
|
|
{
|
2019-05-05 10:33:34 +00:00
|
|
|
EDA_ITEM* item = (EDA_ITEM*) m_selection.GetItem( i );
|
2021-11-06 16:03:41 +00:00
|
|
|
isMoving |= static_cast<SCH_ITEM*>( item )->IsMoving();
|
2019-04-23 17:12:10 +00:00
|
|
|
|
2019-04-30 13:54:32 +00:00
|
|
|
if( !item->IsType( aFilterList ) )
|
2019-07-09 19:50:40 +00:00
|
|
|
{
|
|
|
|
unselect( item );
|
|
|
|
m_toolMgr->ProcessEvent( EVENTS::UnselectedEvent );
|
|
|
|
}
|
2019-04-23 17:12:10 +00:00
|
|
|
}
|
2019-05-20 15:42:49 +00:00
|
|
|
|
2021-10-18 12:24:06 +00:00
|
|
|
if( !isMoving )
|
|
|
|
updateReferencePoint();
|
|
|
|
}
|
2019-05-31 18:23:49 +00:00
|
|
|
|
|
|
|
return m_selection;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void EE_SELECTION_TOOL::updateReferencePoint()
|
|
|
|
{
|
2019-05-22 21:09:20 +00:00
|
|
|
VECTOR2I refP( 0, 0 );
|
2019-05-22 02:42:33 +00:00
|
|
|
|
2019-05-22 21:09:20 +00:00
|
|
|
if( m_selection.Size() > 0 )
|
|
|
|
{
|
2020-10-31 01:27:16 +00:00
|
|
|
if( m_isSymbolEditor )
|
2019-05-22 21:09:20 +00:00
|
|
|
refP = static_cast<LIB_ITEM*>( m_selection.GetTopLeftItem() )->GetPosition();
|
2019-05-22 02:42:33 +00:00
|
|
|
else
|
2019-05-22 21:09:20 +00:00
|
|
|
refP = static_cast<SCH_ITEM*>( m_selection.GetTopLeftItem() )->GetPosition();
|
2019-05-07 09:38:34 +00:00
|
|
|
}
|
|
|
|
|
2019-05-22 21:09:20 +00:00
|
|
|
m_selection.SetReferencePoint( refP );
|
2019-04-23 12:51:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-07 23:00:39 +00:00
|
|
|
// Some navigation actions are allowed in selectMultiple
|
|
|
|
const TOOL_ACTION* allowedActions[] = { &ACTIONS::panUp, &ACTIONS::panDown,
|
|
|
|
&ACTIONS::panLeft, &ACTIONS::panRight,
|
|
|
|
&ACTIONS::cursorUp, &ACTIONS::cursorDown,
|
|
|
|
&ACTIONS::cursorLeft, &ACTIONS::cursorRight,
|
|
|
|
&ACTIONS::cursorUpFast, &ACTIONS::cursorDownFast,
|
|
|
|
&ACTIONS::cursorLeftFast, &ACTIONS::cursorRightFast,
|
|
|
|
&ACTIONS::zoomIn, &ACTIONS::zoomOut,
|
|
|
|
&ACTIONS::zoomInCenter, &ACTIONS::zoomOutCenter,
|
|
|
|
&ACTIONS::zoomCenter, &ACTIONS::zoomFitScreen,
|
|
|
|
&ACTIONS::zoomFitObjects, nullptr };
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
bool EE_SELECTION_TOOL::selectMultiple()
|
2019-04-23 17:40:29 +00:00
|
|
|
{
|
2020-10-18 20:30:37 +00:00
|
|
|
bool cancelled = false; // Was the tool canceled while it was running?
|
2019-04-23 17:40:29 +00:00
|
|
|
m_multiple = true; // Multiple selection mode is active
|
|
|
|
KIGFX::VIEW* view = getView();
|
|
|
|
|
|
|
|
KIGFX::PREVIEW::SELECTION_AREA area;
|
|
|
|
view->Add( &area );
|
|
|
|
|
2019-06-17 13:43:22 +00:00
|
|
|
while( TOOL_EVENT* evt = Wait() )
|
2019-04-23 17:40:29 +00:00
|
|
|
{
|
2020-10-09 01:24:26 +00:00
|
|
|
int width = area.GetEnd().x - area.GetOrigin().x;
|
2021-12-10 18:43:35 +00:00
|
|
|
int height = area.GetEnd().y - area.GetOrigin().y;
|
2020-10-09 01:24:26 +00:00
|
|
|
|
|
|
|
/* Selection mode depends on direction of drag-selection:
|
|
|
|
* Left > Right : Select objects that are fully enclosed by selection
|
|
|
|
* Right > Left : Select objects that are crossed by selection
|
|
|
|
*/
|
2021-12-10 18:43:35 +00:00
|
|
|
bool isWindowSelection = width >= 0;
|
2020-10-09 01:24:26 +00:00
|
|
|
|
|
|
|
if( view->IsMirroredX() )
|
2021-12-10 18:43:35 +00:00
|
|
|
isWindowSelection = !isWindowSelection;
|
2020-10-09 01:24:26 +00:00
|
|
|
|
2021-12-10 18:43:35 +00:00
|
|
|
m_frame->GetCanvas()->SetCurrentCursor( isWindowSelection ? KICURSOR::SELECT_WINDOW
|
|
|
|
: KICURSOR::SELECT_LASSO );
|
2020-10-09 01:24:26 +00:00
|
|
|
|
2019-07-01 21:01:33 +00:00
|
|
|
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
2019-04-23 17:40:29 +00:00
|
|
|
{
|
|
|
|
cancelled = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( evt->IsDrag( BUT_LEFT ) )
|
|
|
|
{
|
2021-09-05 20:37:52 +00:00
|
|
|
if( !m_drag_additive && !m_drag_subtractive )
|
2019-07-09 19:50:40 +00:00
|
|
|
ClearSelection();
|
|
|
|
|
2019-04-23 17:40:29 +00:00
|
|
|
// Start drawing a selection box
|
|
|
|
area.SetOrigin( evt->DragOrigin() );
|
|
|
|
area.SetEnd( evt->Position() );
|
2021-09-05 20:37:52 +00:00
|
|
|
area.SetAdditive( m_drag_additive );
|
|
|
|
area.SetSubtractive( m_drag_subtractive );
|
|
|
|
area.SetExclusiveOr( false );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
|
|
|
view->SetVisible( &area, true );
|
|
|
|
view->Update( &area );
|
|
|
|
getViewControls()->SetAutoPan( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( evt->IsMouseUp( BUT_LEFT ) )
|
|
|
|
{
|
|
|
|
getViewControls()->SetAutoPan( false );
|
|
|
|
|
|
|
|
// End drawing the selection box
|
|
|
|
view->SetVisible( &area, false );
|
|
|
|
|
2021-12-10 18:43:35 +00:00
|
|
|
// Fetch items from the RTree that are in our area of interest
|
|
|
|
std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> nearbyViewItems;
|
|
|
|
view->Query( area.ViewBBox(), nearbyViewItems );
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2021-12-10 18:43:35 +00:00
|
|
|
// Build lists of nearby items and their children
|
2021-12-12 17:38:16 +00:00
|
|
|
std::vector<EDA_ITEM*> nearbyItems;
|
|
|
|
std::vector<EDA_ITEM*> nearbyChildren;
|
2022-04-16 22:44:34 +00:00
|
|
|
std::vector<EDA_ITEM*> flaggedItems;
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2021-12-10 18:43:35 +00:00
|
|
|
for( KIGFX::VIEW::LAYER_ITEM_PAIR& pair : nearbyViewItems )
|
2019-08-27 20:08:09 +00:00
|
|
|
{
|
2021-12-12 17:38:16 +00:00
|
|
|
EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( pair.first );
|
2019-08-29 14:59:36 +00:00
|
|
|
|
2021-12-10 18:43:35 +00:00
|
|
|
if( item )
|
2019-08-27 20:08:09 +00:00
|
|
|
{
|
2022-03-03 14:35:57 +00:00
|
|
|
item->ClearFlags( CANDIDATE );
|
2021-12-10 18:43:35 +00:00
|
|
|
nearbyItems.push_back( item );
|
2021-12-12 17:38:16 +00:00
|
|
|
}
|
2021-12-10 18:43:35 +00:00
|
|
|
|
2021-12-12 17:38:16 +00:00
|
|
|
if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item ) )
|
|
|
|
{
|
|
|
|
sch_item->RunOnChildren(
|
2021-12-10 18:43:35 +00:00
|
|
|
[&]( SCH_ITEM* aChild )
|
|
|
|
{
|
|
|
|
nearbyChildren.push_back( aChild );
|
|
|
|
} );
|
2021-03-07 14:32:49 +00:00
|
|
|
}
|
2019-08-27 20:08:09 +00:00
|
|
|
}
|
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
EDA_RECT selectionRect( area.GetOrigin(), wxSize( width, height ) );
|
2021-12-10 18:43:35 +00:00
|
|
|
selectionRect.Normalize();
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2019-07-09 19:50:40 +00:00
|
|
|
bool anyAdded = false;
|
|
|
|
bool anySubtracted = false;
|
2022-03-03 14:35:57 +00:00
|
|
|
auto selectItem = [&]( EDA_ITEM* aItem )
|
|
|
|
{
|
|
|
|
EDA_ITEM_FLAGS flags = 0;
|
2022-02-10 18:38:40 +00:00
|
|
|
|
2022-03-03 14:35:57 +00:00
|
|
|
// Handle line ends specially
|
|
|
|
if( aItem->Type() == SCH_LINE_T )
|
|
|
|
{
|
|
|
|
SCH_LINE* line = (SCH_LINE*) aItem;
|
2022-02-10 18:38:40 +00:00
|
|
|
|
2022-03-03 14:35:57 +00:00
|
|
|
if( selectionRect.Contains( line->GetStartPoint() ) )
|
|
|
|
flags |= STARTPOINT;
|
2022-02-10 18:38:40 +00:00
|
|
|
|
2022-03-03 14:35:57 +00:00
|
|
|
if( selectionRect.Contains( line->GetEndPoint() ) )
|
|
|
|
flags |= ENDPOINT;
|
2022-02-10 18:38:40 +00:00
|
|
|
|
|
|
|
|
2022-03-03 14:35:57 +00:00
|
|
|
// If no ends were selected, select whole line (both ends)
|
|
|
|
// Also select both ends if the selection overlaps the midpoint
|
|
|
|
if( ( !( flags & STARTPOINT ) && !( flags & ENDPOINT ) )
|
|
|
|
|| selectionRect.Contains( line->GetMidPoint() ) )
|
|
|
|
{
|
|
|
|
flags = STARTPOINT | ENDPOINT;
|
|
|
|
}
|
|
|
|
}
|
2022-02-10 18:38:40 +00:00
|
|
|
|
2022-03-03 14:35:57 +00:00
|
|
|
if( m_subtractive || ( m_exclusive_or && aItem->IsSelected() ) )
|
|
|
|
{
|
|
|
|
aItem->ClearFlags( flags );
|
2022-07-12 01:03:45 +00:00
|
|
|
|
2022-03-03 14:35:57 +00:00
|
|
|
if( !aItem->HasFlag( STARTPOINT ) && !aItem->HasFlag( ENDPOINT ) )
|
|
|
|
{
|
|
|
|
unselect( aItem );
|
|
|
|
anySubtracted = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aItem->SetFlags( flags );
|
|
|
|
select( aItem );
|
|
|
|
anyAdded = true;
|
|
|
|
}
|
|
|
|
};
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2021-12-12 17:38:16 +00:00
|
|
|
for( EDA_ITEM* item : nearbyItems )
|
2019-04-23 17:40:29 +00:00
|
|
|
{
|
2021-12-10 18:43:35 +00:00
|
|
|
if( Selectable( item ) && item->HitTest( selectionRect, isWindowSelection ) )
|
|
|
|
{
|
2022-03-03 14:35:57 +00:00
|
|
|
item->SetFlags( CANDIDATE );
|
2022-04-16 22:44:34 +00:00
|
|
|
flaggedItems.push_back( item );
|
2021-12-10 18:43:35 +00:00
|
|
|
selectItem( item );
|
|
|
|
}
|
|
|
|
}
|
2019-04-23 17:40:29 +00:00
|
|
|
|
2021-12-12 17:38:16 +00:00
|
|
|
for( EDA_ITEM* item : nearbyChildren )
|
2021-12-10 18:43:35 +00:00
|
|
|
{
|
|
|
|
if( Selectable( item )
|
2022-03-03 14:35:57 +00:00
|
|
|
&& !item->GetParent()->HasFlag( CANDIDATE )
|
2021-12-10 18:43:35 +00:00
|
|
|
&& item->HitTest( selectionRect, isWindowSelection ) )
|
2019-04-23 17:40:29 +00:00
|
|
|
{
|
2021-12-10 18:43:35 +00:00
|
|
|
selectItem( item );
|
2019-04-23 17:40:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-16 22:44:34 +00:00
|
|
|
for( EDA_ITEM* item : flaggedItems )
|
|
|
|
item->ClearFlags( CANDIDATE );
|
|
|
|
|
2019-06-13 18:57:11 +00:00
|
|
|
m_selection.SetIsHover( false );
|
|
|
|
|
2019-04-23 17:40:29 +00:00
|
|
|
// Inform other potentially interested tools
|
2019-07-09 19:50:40 +00:00
|
|
|
if( anyAdded )
|
2019-04-23 17:40:29 +00:00
|
|
|
m_toolMgr->ProcessEvent( EVENTS::SelectedEvent );
|
|
|
|
|
2019-07-09 19:50:40 +00:00
|
|
|
if( anySubtracted )
|
|
|
|
m_toolMgr->ProcessEvent( EVENTS::UnselectedEvent );
|
|
|
|
|
2019-04-23 17:40:29 +00:00
|
|
|
break; // Stop waiting for events
|
|
|
|
}
|
2021-12-07 23:00:39 +00:00
|
|
|
|
|
|
|
// Allow some actions for navigation
|
|
|
|
for( int i = 0; allowedActions[i]; ++i )
|
|
|
|
{
|
|
|
|
if( evt->IsAction( allowedActions[i] ) )
|
|
|
|
{
|
|
|
|
evt->SetPassEvent();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-04-23 17:40:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
getViewControls()->SetAutoPan( false );
|
|
|
|
|
|
|
|
// Stop drawing the selection box
|
|
|
|
view->Remove( &area );
|
|
|
|
m_multiple = false; // Multiple selection mode is inactive
|
|
|
|
|
|
|
|
if( !cancelled )
|
|
|
|
m_selection.ClearReferencePoint();
|
|
|
|
|
|
|
|
return cancelled;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-30 13:54:32 +00:00
|
|
|
static KICAD_T nodeTypes[] =
|
|
|
|
{
|
2022-01-24 13:40:39 +00:00
|
|
|
SCH_SYMBOL_LOCATE_POWER_T,
|
|
|
|
SCH_PIN_T,
|
|
|
|
SCH_ITEM_LOCATE_WIRE_T,
|
|
|
|
SCH_ITEM_LOCATE_BUS_T,
|
|
|
|
SCH_BUS_WIRE_ENTRY_T,
|
|
|
|
SCH_BUS_BUS_ENTRY_T,
|
|
|
|
SCH_LABEL_T,
|
|
|
|
SCH_HIER_LABEL_T,
|
|
|
|
SCH_GLOBAL_LABEL_T,
|
|
|
|
SCH_SHEET_PIN_T,
|
|
|
|
SCH_DIRECTIVE_LABEL_T,
|
|
|
|
SCH_JUNCTION_T,
|
|
|
|
EOT
|
2019-04-30 13:54:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
EDA_ITEM* EE_SELECTION_TOOL::GetNode( VECTOR2I aPosition )
|
2019-04-30 13:54:32 +00:00
|
|
|
{
|
2019-05-10 19:22:26 +00:00
|
|
|
EE_COLLECTOR collector;
|
2019-04-30 13:54:32 +00:00
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
//TODO(snh): Reimplement after exposing KNN interface
|
2021-09-19 10:05:58 +00:00
|
|
|
int pixelThreshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
|
|
|
|
int gridThreshold = KiROUND( getView()->GetGAL()->GetGridSize().EuclideanNorm() );
|
|
|
|
int thresholdMax = std::max( pixelThreshold, gridThreshold );
|
2019-05-15 17:00:49 +00:00
|
|
|
|
2021-09-19 10:05:58 +00:00
|
|
|
for( int threshold : { 0, thresholdMax/4, thresholdMax/2, thresholdMax } )
|
2019-05-15 17:00:49 +00:00
|
|
|
{
|
|
|
|
collector.m_Threshold = threshold;
|
2022-02-14 00:53:47 +00:00
|
|
|
collector.Collect( m_frame->GetScreen(), nodeTypes, aPosition );
|
2019-05-15 17:00:49 +00:00
|
|
|
|
|
|
|
if( collector.GetCount() > 0 )
|
|
|
|
break;
|
|
|
|
}
|
2019-04-30 13:54:32 +00:00
|
|
|
|
|
|
|
return collector.GetCount() ? collector[ 0 ] : nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
int EE_SELECTION_TOOL::SelectNode( const TOOL_EVENT& aEvent )
|
2019-04-30 13:54:32 +00:00
|
|
|
{
|
2021-05-09 17:14:41 +00:00
|
|
|
VECTOR2I cursorPos = getViewControls()->GetCursorPosition( false );
|
2019-04-30 13:54:32 +00:00
|
|
|
|
|
|
|
SelectPoint( cursorPos, nodeTypes );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
int EE_SELECTION_TOOL::SelectConnection( const TOOL_EVENT& aEvent )
|
2019-04-30 13:54:32 +00:00
|
|
|
{
|
2021-07-17 19:56:18 +00:00
|
|
|
static KICAD_T wiresAndBuses[] = { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T, EOT };
|
2019-04-30 17:02:38 +00:00
|
|
|
|
2020-04-02 17:03:53 +00:00
|
|
|
RequestSelection( wiresAndBuses );
|
2019-04-30 13:54:32 +00:00
|
|
|
|
|
|
|
if( m_selection.Empty() )
|
|
|
|
return 0;
|
|
|
|
|
2019-05-01 21:50:11 +00:00
|
|
|
SCH_LINE* line = (SCH_LINE*) m_selection.Front();
|
2019-04-30 13:54:32 +00:00
|
|
|
EDA_ITEMS items;
|
2022-05-29 21:51:07 +00:00
|
|
|
unsigned done = false;
|
2019-04-30 13:54:32 +00:00
|
|
|
|
|
|
|
m_frame->GetScreen()->ClearDrawingState();
|
2022-05-29 21:51:07 +00:00
|
|
|
std::set<SCH_ITEM*> conns = m_frame->GetScreen()->MarkConnections( line, false );
|
2019-04-30 13:54:32 +00:00
|
|
|
|
2020-12-14 21:11:33 +00:00
|
|
|
for( SCH_ITEM* item : conns )
|
2022-05-29 21:51:07 +00:00
|
|
|
{
|
|
|
|
if( item->IsType( wiresAndBuses ) && !item->IsSelected() )
|
|
|
|
done = true;
|
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
select( item );
|
2022-05-29 21:51:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !done )
|
|
|
|
{
|
|
|
|
conns = m_frame->GetScreen()->MarkConnections( line, true );
|
|
|
|
|
|
|
|
for( SCH_ITEM* item : conns )
|
|
|
|
select( item );
|
|
|
|
}
|
2019-04-30 13:54:32 +00:00
|
|
|
|
2019-05-03 08:48:53 +00:00
|
|
|
if( m_selection.GetSize() > 1 )
|
2019-04-30 13:54:32 +00:00
|
|
|
m_toolMgr->ProcessEvent( EVENTS::SelectedEvent );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
int EE_SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2019-05-19 21:04:04 +00:00
|
|
|
ClearSelection();
|
2019-04-21 23:45:34 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-11 10:06:28 +00:00
|
|
|
void EE_SELECTION_TOOL::RebuildSelection()
|
|
|
|
{
|
|
|
|
m_selection.Clear();
|
|
|
|
|
2020-10-31 01:27:16 +00:00
|
|
|
if( m_isSymbolEditor )
|
2019-06-25 23:39:58 +00:00
|
|
|
{
|
2021-06-15 12:31:28 +00:00
|
|
|
LIB_SYMBOL* start = static_cast<SYMBOL_EDIT_FRAME*>( m_frame )->GetCurSymbol();
|
2019-05-11 10:06:28 +00:00
|
|
|
|
2020-03-06 12:05:21 +00:00
|
|
|
for( LIB_ITEM& item : start->GetDrawItems() )
|
2020-01-04 23:05:57 +00:00
|
|
|
{
|
|
|
|
if( item.IsSelected() )
|
2022-07-12 01:03:45 +00:00
|
|
|
select( &item );
|
2020-01-04 23:05:57 +00:00
|
|
|
}
|
2019-06-25 23:39:58 +00:00
|
|
|
}
|
|
|
|
else
|
2019-05-11 10:06:28 +00:00
|
|
|
{
|
2020-11-17 16:02:47 +00:00
|
|
|
for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
|
2019-10-27 17:47:26 +00:00
|
|
|
{
|
2021-06-10 14:10:55 +00:00
|
|
|
// If the field and symbol are selected, only use the symbol
|
2020-02-05 04:48:33 +00:00
|
|
|
if( item->IsSelected() )
|
2019-06-25 23:39:58 +00:00
|
|
|
{
|
|
|
|
select( item );
|
|
|
|
}
|
2020-02-05 04:48:33 +00:00
|
|
|
else
|
|
|
|
{
|
2020-11-17 16:02:47 +00:00
|
|
|
item->RunOnChildren(
|
|
|
|
[&]( SCH_ITEM* aChild )
|
|
|
|
{
|
|
|
|
if( aChild->IsSelected() )
|
|
|
|
select( aChild );
|
|
|
|
} );
|
2020-02-05 04:48:33 +00:00
|
|
|
}
|
2019-10-27 17:47:26 +00:00
|
|
|
}
|
2019-06-25 23:39:58 +00:00
|
|
|
}
|
2019-05-31 18:23:49 +00:00
|
|
|
|
|
|
|
updateReferencePoint();
|
2019-06-29 18:57:23 +00:00
|
|
|
|
|
|
|
// Inform other potentially interested tools
|
|
|
|
m_toolMgr->ProcessEvent( EVENTS::SelectedEvent );
|
2019-05-11 10:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-09-19 10:05:58 +00:00
|
|
|
bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, const VECTOR2I* aPos,
|
|
|
|
bool checkVisibilityOnly ) const
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2020-10-18 20:30:37 +00:00
|
|
|
// NOTE: in the future this is where Eeschema layer/itemtype visibility will be handled
|
2021-03-07 11:58:11 +00:00
|
|
|
|
|
|
|
SYMBOL_EDIT_FRAME* symEditFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
|
2020-11-23 19:46:17 +00:00
|
|
|
|
|
|
|
// Do not allow selection of anything except fields when the current symbol in the symbol
|
|
|
|
// editor is a derived symbol.
|
2021-03-07 11:58:11 +00:00
|
|
|
if( symEditFrame && symEditFrame->IsSymbolAlias() && aItem->Type() != LIB_FIELD_T )
|
2020-11-23 19:46:17 +00:00
|
|
|
return false;
|
2019-12-12 15:44:53 +00:00
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
switch( aItem->Type() )
|
|
|
|
{
|
|
|
|
case SCH_PIN_T:
|
2021-09-19 10:05:58 +00:00
|
|
|
{
|
|
|
|
const SCH_PIN* pin = static_cast<const SCH_PIN*>( aItem );
|
|
|
|
|
|
|
|
if( !pin->IsVisible() && !m_frame->GetShowAllPins() )
|
2019-04-21 23:45:34 +00:00
|
|
|
return false;
|
2021-09-19 10:05:58 +00:00
|
|
|
|
|
|
|
if( m_frame->eeconfig()->m_Selection.select_pin_selects_symbol )
|
|
|
|
{
|
|
|
|
// Pin anchors have to be allowed for auto-starting wires.
|
|
|
|
if( aPos )
|
|
|
|
{
|
|
|
|
EE_GRID_HELPER grid( m_toolMgr );
|
|
|
|
|
2022-02-14 00:53:47 +00:00
|
|
|
if( pin->IsPointClickableAnchor( grid.BestSnapAnchor( *aPos, LAYER_CONNECTABLE ) ) )
|
2021-09-19 10:05:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2022-02-14 00:53:47 +00:00
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
break;
|
2022-02-14 00:53:47 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2021-06-10 18:51:46 +00:00
|
|
|
case LIB_SYMBOL_T: // In symbol_editor we do not want to select the symbol itself.
|
2019-04-21 23:45:34 +00:00
|
|
|
return false;
|
|
|
|
|
2021-09-19 10:05:58 +00:00
|
|
|
case LIB_FIELD_T: // LIB_FIELD object can always be edited.
|
2019-12-12 15:44:53 +00:00
|
|
|
break;
|
|
|
|
|
2021-07-18 23:08:54 +00:00
|
|
|
case LIB_SHAPE_T:
|
2019-08-15 07:09:52 +00:00
|
|
|
case LIB_TEXT_T:
|
2019-05-08 18:56:03 +00:00
|
|
|
case LIB_PIN_T:
|
2020-11-23 19:46:17 +00:00
|
|
|
if( symEditFrame )
|
2019-12-12 16:42:11 +00:00
|
|
|
{
|
|
|
|
LIB_ITEM* lib_item = (LIB_ITEM*) aItem;
|
2019-05-08 18:56:03 +00:00
|
|
|
|
2020-11-23 19:46:17 +00:00
|
|
|
if( lib_item->GetUnit() && lib_item->GetUnit() != symEditFrame->GetUnit() )
|
2019-12-12 16:42:11 +00:00
|
|
|
return false;
|
2019-08-01 04:31:19 +00:00
|
|
|
|
2020-11-23 19:46:17 +00:00
|
|
|
if( lib_item->GetConvert() && lib_item->GetConvert() != symEditFrame->GetConvert() )
|
2019-12-12 16:42:11 +00:00
|
|
|
return false;
|
|
|
|
}
|
2019-08-01 04:31:19 +00:00
|
|
|
|
2019-05-08 18:56:03 +00:00
|
|
|
break;
|
2019-12-12 15:44:53 +00:00
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
case SCH_MARKER_T: // Always selectable
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default: // Suppress warnings
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-19 21:04:04 +00:00
|
|
|
void EE_SELECTION_TOOL::ClearSelection()
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
|
|
|
if( m_selection.Empty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
while( m_selection.GetSize() )
|
2022-07-12 01:03:45 +00:00
|
|
|
unhighlight( m_selection.Front(), SELECTED, &m_selection );
|
2019-04-21 23:45:34 +00:00
|
|
|
|
|
|
|
getView()->Update( &m_selection );
|
|
|
|
|
|
|
|
m_selection.SetIsHover( false );
|
|
|
|
m_selection.ClearReferencePoint();
|
|
|
|
|
|
|
|
// Inform other potentially interested tools
|
|
|
|
m_toolMgr->ProcessEvent( EVENTS::ClearedEvent );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
void EE_SELECTION_TOOL::select( EDA_ITEM* aItem )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
|
|
|
highlight( aItem, SELECTED, &m_selection );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
void EE_SELECTION_TOOL::unselect( EDA_ITEM* aItem )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
|
|
|
unhighlight( aItem, SELECTED, &m_selection );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-07-12 01:03:45 +00:00
|
|
|
void EE_SELECTION_TOOL::highlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2019-05-17 16:45:27 +00:00
|
|
|
KICAD_T itemType = aItem->Type();
|
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
if( aMode == SELECTED )
|
|
|
|
aItem->SetSelected();
|
|
|
|
else if( aMode == BRIGHTENED )
|
|
|
|
aItem->SetBrightened();
|
|
|
|
|
|
|
|
if( aGroup )
|
|
|
|
aGroup->Add( aItem );
|
|
|
|
|
2021-06-10 14:10:55 +00:00
|
|
|
// Highlight pins and fields. (All the other symbol children are currently only
|
2021-06-10 18:51:46 +00:00
|
|
|
// represented in the LIB_SYMBOL and will inherit the settings of the parent symbol.)
|
2020-11-17 22:28:10 +00:00
|
|
|
if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
|
|
|
|
{
|
|
|
|
sch_item->RunOnChildren(
|
2021-10-12 20:05:37 +00:00
|
|
|
[&]( SCH_ITEM* aChild )
|
|
|
|
{
|
|
|
|
if( aMode == SELECTED )
|
|
|
|
aChild->SetSelected();
|
|
|
|
else if( aMode == BRIGHTENED )
|
|
|
|
aChild->SetBrightened();
|
|
|
|
} );
|
2020-11-17 22:28:10 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
|
2019-04-23 17:40:29 +00:00
|
|
|
getView()->Update( aItem->GetParent() );
|
|
|
|
else
|
|
|
|
getView()->Update( aItem );
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-07-12 01:03:45 +00:00
|
|
|
void EE_SELECTION_TOOL::unhighlight( EDA_ITEM* aItem, int aMode, SELECTION* aGroup )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2019-05-17 16:45:27 +00:00
|
|
|
KICAD_T itemType = aItem->Type();
|
|
|
|
|
2019-04-21 23:45:34 +00:00
|
|
|
if( aMode == SELECTED )
|
2022-03-03 14:35:57 +00:00
|
|
|
{
|
2019-04-21 23:45:34 +00:00
|
|
|
aItem->ClearSelected();
|
2022-03-03 14:35:57 +00:00
|
|
|
// Lines need endpoints cleared here
|
|
|
|
if( aItem->Type() == SCH_LINE_T )
|
|
|
|
aItem->ClearFlags( STARTPOINT | ENDPOINT );
|
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
else if( aMode == BRIGHTENED )
|
|
|
|
aItem->ClearBrightened();
|
|
|
|
|
|
|
|
if( aGroup )
|
|
|
|
aGroup->Remove( aItem );
|
|
|
|
|
2021-06-10 14:10:55 +00:00
|
|
|
// Unhighlight pins and fields. (All the other symbol children are currently only
|
2021-06-10 18:51:46 +00:00
|
|
|
// represented in the LIB_SYMBOL.)
|
2020-11-17 22:28:10 +00:00
|
|
|
if( SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( aItem ) )
|
|
|
|
{
|
|
|
|
sch_item->RunOnChildren(
|
2022-07-12 01:03:45 +00:00
|
|
|
[&]( SCH_ITEM* aChild )
|
|
|
|
{
|
|
|
|
if( aMode == SELECTED )
|
|
|
|
aChild->ClearSelected();
|
|
|
|
else if( aMode == BRIGHTENED )
|
|
|
|
aChild->ClearBrightened();
|
|
|
|
} );
|
2020-11-17 22:28:10 +00:00
|
|
|
}
|
2019-04-21 23:45:34 +00:00
|
|
|
|
2019-05-17 16:45:27 +00:00
|
|
|
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
|
2019-04-23 17:40:29 +00:00
|
|
|
getView()->Update( aItem->GetParent() );
|
|
|
|
else
|
|
|
|
getView()->Update( aItem );
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
bool EE_SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
|
|
|
const unsigned GRIP_MARGIN = 20;
|
|
|
|
VECTOR2I margin = getView()->ToWorld( VECTOR2I( GRIP_MARGIN, GRIP_MARGIN ), false );
|
|
|
|
|
|
|
|
// Check if the point is located within any of the currently selected items bounding boxes
|
2020-12-14 21:11:33 +00:00
|
|
|
for( EDA_ITEM* item : m_selection )
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
|
|
|
BOX2I itemBox = item->ViewBBox();
|
|
|
|
itemBox.Inflate( margin.x, margin.y ); // Give some margin for gripping an item
|
|
|
|
|
|
|
|
if( itemBox.Contains( aPoint ) )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
void EE_SELECTION_TOOL::setTransitions()
|
2019-04-21 23:45:34 +00:00
|
|
|
{
|
2019-05-13 20:42:40 +00:00
|
|
|
Go( &EE_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
|
|
|
|
|
2019-05-10 17:19:48 +00:00
|
|
|
Go( &EE_SELECTION_TOOL::Main, EE_ACTIONS::selectionActivate.MakeEvent() );
|
|
|
|
Go( &EE_SELECTION_TOOL::SelectNode, EE_ACTIONS::selectNode.MakeEvent() );
|
|
|
|
Go( &EE_SELECTION_TOOL::SelectConnection, EE_ACTIONS::selectConnection.MakeEvent() );
|
|
|
|
Go( &EE_SELECTION_TOOL::ClearSelection, EE_ACTIONS::clearSelection.MakeEvent() );
|
|
|
|
|
|
|
|
Go( &EE_SELECTION_TOOL::AddItemToSel, EE_ACTIONS::addItemToSel.MakeEvent() );
|
|
|
|
Go( &EE_SELECTION_TOOL::AddItemsToSel, EE_ACTIONS::addItemsToSel.MakeEvent() );
|
|
|
|
Go( &EE_SELECTION_TOOL::RemoveItemFromSel, EE_ACTIONS::removeItemFromSel.MakeEvent() );
|
|
|
|
Go( &EE_SELECTION_TOOL::RemoveItemsFromSel, EE_ACTIONS::removeItemsFromSel.MakeEvent() );
|
|
|
|
Go( &EE_SELECTION_TOOL::SelectionMenu, EE_ACTIONS::selectionMenu.MakeEvent() );
|
2020-08-20 23:05:21 +00:00
|
|
|
|
|
|
|
Go( &EE_SELECTION_TOOL::SelectAll, EE_ACTIONS::selectAll.MakeEvent() );
|
2021-09-05 20:37:52 +00:00
|
|
|
|
|
|
|
Go( &EE_SELECTION_TOOL::disambiguateCursor, EVENTS::DisambiguatePoint );
|
2019-04-21 23:45:34 +00:00
|
|
|
}
|
|
|
|
|
2019-04-15 14:34:58 +00:00
|
|
|
|