Re-enable selection of intersheet references.
Un-modified roll-overs and clicks still produce hypertext action, but modified clicks and drag-selects will select.
This commit is contained in:
parent
37906511f5
commit
c9096c7168
|
@ -24,14 +24,12 @@
|
||||||
|
|
||||||
#include <sch_text.h>
|
#include <sch_text.h>
|
||||||
#include <sch_iref.h>
|
#include <sch_iref.h>
|
||||||
#include <sch_sheet.h>
|
|
||||||
#include <schematic.h>
|
#include <schematic.h>
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tools/sch_editor_control.h>
|
#include <tools/sch_editor_control.h>
|
||||||
#include <tools/sch_navigate_tool.h>
|
#include <tools/sch_navigate_tool.h>
|
||||||
|
|
||||||
SCH_IREF::SCH_IREF( const wxPoint& pos, const wxString& text, SCH_GLOBALLABEL* aParent,
|
SCH_IREF::SCH_IREF( const wxPoint& pos, const wxString& text, SCH_GLOBALLABEL* aParent ) :
|
||||||
KICAD_T aType ) :
|
|
||||||
SCH_TEXT( pos, text, SCH_IREF_T )
|
SCH_TEXT( pos, text, SCH_IREF_T )
|
||||||
{
|
{
|
||||||
m_Layer = LAYER_GLOBLABEL;
|
m_Layer = LAYER_GLOBLABEL;
|
||||||
|
|
|
@ -39,7 +39,7 @@ class SCH_IREF : public SCH_TEXT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SCH_IREF( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
|
SCH_IREF( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
|
||||||
SCH_GLOBALLABEL* aParent = nullptr, KICAD_T aType = SCH_IREF_T );
|
SCH_GLOBALLABEL* aParent = nullptr );
|
||||||
|
|
||||||
~SCH_IREF() { }
|
~SCH_IREF() { }
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,8 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
m_toolMgr->ProcessEvent( *newEvt );
|
m_toolMgr->ProcessEvent( *newEvt );
|
||||||
continueSelect = false;
|
continueSelect = false;
|
||||||
}
|
}
|
||||||
else if( collector[0]->Type() == SCH_IREF_T )
|
else if( collector[0]->Type() == SCH_IREF_T
|
||||||
|
&& !m_additive && !m_subtractive && !m_exclusive_or )
|
||||||
{
|
{
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
|
|
||||||
|
@ -363,6 +364,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
intptr_t sel = m_frame->GetPopupMenuSelectionFromUser( menu );
|
intptr_t sel = m_frame->GetPopupMenuSelectionFromUser( menu );
|
||||||
m_toolMgr->RunAction( EE_ACTIONS::hypertextCommand, true, (void*) sel );
|
m_toolMgr->RunAction( EE_ACTIONS::hypertextCommand, true, (void*) sel );
|
||||||
|
continueSelect = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -371,7 +373,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
// If we didn't click on an anchor, we perform a normal select, pass in the
|
// If we didn't click on an anchor, we perform a normal select, pass in the
|
||||||
// items we previously collected
|
// items we previously collected
|
||||||
SelectPoint( collector, nullptr, nullptr, m_additive, m_subtractive,
|
selectPoint( collector, nullptr, nullptr, m_additive, m_subtractive,
|
||||||
m_exclusive_or );
|
m_exclusive_or );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -513,7 +515,8 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
displayPencil = true;
|
displayPencil = true;
|
||||||
}
|
}
|
||||||
else if( collector[0]->Type() == SCH_IREF_T )
|
else if( collector[0]->Type() == SCH_IREF_T
|
||||||
|
&& !m_additive && !m_subtractive && !m_exclusive_or )
|
||||||
{
|
{
|
||||||
rolloverItem = collector[0]->m_Uuid;
|
rolloverItem = collector[0]->m_Uuid;
|
||||||
}
|
}
|
||||||
|
@ -631,18 +634,20 @@ void EE_SELECTION_TOOL::narrowSelection( EE_COLLECTOR& collector, const VECTOR2I
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EE_SELECTION_TOOL::SelectPoint( EE_COLLECTOR& aCollector, EDA_ITEM** aItem,
|
bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, EDA_ITEM** aItem,
|
||||||
bool* aSelectionCancelledFlag, bool aAdd, bool aSubtract,
|
bool* aSelectionCancelledFlag, bool aAdd, bool aSubtract,
|
||||||
bool aExclusiveOr )
|
bool aExclusiveOr )
|
||||||
{
|
{
|
||||||
m_selection.ClearReferencePoint();
|
m_selection.ClearReferencePoint();
|
||||||
|
|
||||||
// We have to allow SCH_IREFs in Selectable() for hypertext rollovers and linking to work,
|
// Unmodified clicking of SCH_IREFs results in hypertext links rather than selection.
|
||||||
// but at the end of the day we don't actually want them to be selectable.
|
if( !aAdd && !aSubtract && !aExclusiveOr )
|
||||||
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
|
|
||||||
{
|
{
|
||||||
if( aCollector[i]->Type() == SCH_IREF_T )
|
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
|
||||||
aCollector.Remove( i );
|
{
|
||||||
|
if( aCollector[i]->Type() == SCH_IREF_T )
|
||||||
|
aCollector.Remove( i );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If still more than one item we're going to have to ask the user.
|
// If still more than one item we're going to have to ask the user.
|
||||||
|
@ -704,8 +709,9 @@ bool EE_SELECTION_TOOL::SelectPoint( EE_COLLECTOR& aCollector, EDA_ITEM** aItem,
|
||||||
|
|
||||||
|
|
||||||
bool EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T* aFilterList,
|
bool EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T* aFilterList,
|
||||||
EDA_ITEM** aItem, bool* aSelectionCancelledFlag, bool aCheckLocked, bool aAdd,
|
EDA_ITEM** aItem, bool* aSelectionCancelledFlag,
|
||||||
bool aSubtract, bool aExclusiveOr )
|
bool aCheckLocked, bool aAdd, bool aSubtract,
|
||||||
|
bool aExclusiveOr )
|
||||||
{
|
{
|
||||||
EE_COLLECTOR collector;
|
EE_COLLECTOR collector;
|
||||||
|
|
||||||
|
@ -714,7 +720,7 @@ bool EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T* aFil
|
||||||
|
|
||||||
narrowSelection( collector, aWhere, aCheckLocked );
|
narrowSelection( collector, aWhere, aCheckLocked );
|
||||||
|
|
||||||
return SelectPoint( collector, aItem, aSelectionCancelledFlag, aAdd, aSubtract, aExclusiveOr );
|
return selectPoint( collector, aItem, aSelectionCancelledFlag, aAdd, aSubtract, aExclusiveOr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1032,8 +1038,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
|
||||||
{
|
{
|
||||||
EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( pair.first );
|
EDA_ITEM* item = dynamic_cast<EDA_ITEM*>( pair.first );
|
||||||
|
|
||||||
if( item && Selectable( item ) && item->Type() != SCH_IREF_T
|
if( item && Selectable( item ) && item->HitTest( selectionRect, windowSelection ) )
|
||||||
&& item->HitTest( selectionRect, windowSelection ) )
|
|
||||||
{
|
{
|
||||||
if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
|
if( m_subtractive || ( m_exclusive_or && item->IsSelected() ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,9 +92,11 @@ public:
|
||||||
* before calling the primary SelectPoint method.
|
* before calling the primary SelectPoint method.
|
||||||
*
|
*
|
||||||
* @param aWhere is the location where the item(s) should be collected
|
* @param aWhere is the location where the item(s) should be collected
|
||||||
* @param aItem is set to the newly selected item if only one was selected, otherwise is unchanged.
|
* @param aItem is set to the newly selected item if only one was selected, otherwise is
|
||||||
|
* unchanged.
|
||||||
* @param aSelectionCancelledFlag allows the function to inform its caller that a selection
|
* @param aSelectionCancelledFlag allows the function to inform its caller that a selection
|
||||||
* was cancelled (for instance, by clicking outside of the disambiguation menu).
|
* was cancelled (for instance, by clicking outside of the
|
||||||
|
* disambiguation menu).
|
||||||
* @param aCheckLocked indicates if locked items should be excluded.
|
* @param aCheckLocked indicates if locked items should be excluded.
|
||||||
* @param aAdd indicates if found item(s) should be added to the selection
|
* @param aAdd indicates if found item(s) should be added to the selection
|
||||||
* @param aSubtract indicates if found item(s) should be subtracted from the selection
|
* @param aSubtract indicates if found item(s) should be subtracted from the selection
|
||||||
|
@ -105,23 +107,6 @@ public:
|
||||||
bool aCheckLocked = false, bool aAdd = false, bool aSubtract = false,
|
bool aCheckLocked = false, bool aAdd = false, bool aSubtract = false,
|
||||||
bool aExclusiveOr = false );
|
bool aExclusiveOr = false );
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SelectPoint()
|
|
||||||
* This is the primary SelectPoint method that will prompt the user with a menu to disambiguate multiple selections
|
|
||||||
* and then finish by adding, subtracting or toggling the item(s) to the actual selection group.
|
|
||||||
*
|
|
||||||
* @param aCollector is an EE_COLLECTOR that already has collected items
|
|
||||||
* @param aItem is set to the newly selected item if only one was selected, otherwise is unchanged.
|
|
||||||
* @param aSelectionCancelledFlag allows the function to inform its caller that a selection
|
|
||||||
* was cancelled (for instance, by clicking outside of the disambiguation menu).
|
|
||||||
* @param aAdd indicates if found item(s) should be added to the selection
|
|
||||||
* @param aSubtract indicates if found item(s) should be subtracted from the selection
|
|
||||||
* @param aExclusiveOr indicates if found item(s) should be toggle in the selection
|
|
||||||
*/
|
|
||||||
bool SelectPoint( EE_COLLECTOR& aCollector, EDA_ITEM** aItem = nullptr,
|
|
||||||
bool* aSelectionCancelledFlag = nullptr, bool aAdd = false,
|
|
||||||
bool aSubtract = false, bool aExclusiveOr = false );
|
|
||||||
|
|
||||||
int AddItemToSel( const TOOL_EVENT& aEvent );
|
int AddItemToSel( const TOOL_EVENT& aEvent );
|
||||||
void AddItemToSel( EDA_ITEM* aItem, bool aQuietMode = false );
|
void AddItemToSel( EDA_ITEM* aItem, bool aQuietMode = false );
|
||||||
int AddItemsToSel( const TOOL_EVENT& aEvent );
|
int AddItemsToSel( const TOOL_EVENT& aEvent );
|
||||||
|
@ -206,6 +191,26 @@ private:
|
||||||
*/
|
*/
|
||||||
void narrowSelection( EE_COLLECTOR& collector, const VECTOR2I& aWhere, bool aCheckLocked );
|
void narrowSelection( EE_COLLECTOR& collector, const VECTOR2I& aWhere, bool aCheckLocked );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SelectPoint()
|
||||||
|
* This is the primary SelectPoint method that will prompt the user with a menu to disambiguate
|
||||||
|
* multiple selections and then finish by adding, subtracting or toggling the item(s) to the
|
||||||
|
* actual selection group.
|
||||||
|
*
|
||||||
|
* @param aCollector is an EE_COLLECTOR that already has collected items
|
||||||
|
* @param aItem is set to the newly selected item if only one was selected, otherwise is
|
||||||
|
* unchanged.
|
||||||
|
* @param aSelectionCancelledFlag allows the function to inform its caller that a selection
|
||||||
|
* was cancelled (for instance, by clicking outside of the
|
||||||
|
* disambiguation menu).
|
||||||
|
* @param aAdd indicates if found item(s) should be added to the selection
|
||||||
|
* @param aSubtract indicates if found item(s) should be subtracted from the selection
|
||||||
|
* @param aExclusiveOr indicates if found item(s) should be toggle in the selection
|
||||||
|
*/
|
||||||
|
bool selectPoint( EE_COLLECTOR& aCollector, EDA_ITEM** aItem = nullptr,
|
||||||
|
bool* aSelectionCancelledFlag = nullptr, bool aAdd = false,
|
||||||
|
bool aSubtract = false, bool aExclusiveOr = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function selectMultiple()
|
* Function selectMultiple()
|
||||||
* Handles drawing a selection box that allows one to select many items at
|
* Handles drawing a selection box that allows one to select many items at
|
||||||
|
|
Loading…
Reference in New Issue