mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 02:33:15 +02:00
eda frame: hoist FocusItem calls up a layer
Prep for SCH_GROUPs
This commit is contained in:
parent
f40b24d04a
commit
5fd294cad2
@ -343,7 +343,7 @@ void DIALOG_ERC::OnCancelClick( wxCommandEvent& aEvent )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->FocusOnItem( nullptr );
|
m_parent->ClearFocus();
|
||||||
|
|
||||||
aEvent.Skip();
|
aEvent.Skip();
|
||||||
}
|
}
|
||||||
@ -351,7 +351,7 @@ void DIALOG_ERC::OnCancelClick( wxCommandEvent& aEvent )
|
|||||||
|
|
||||||
void DIALOG_ERC::OnCloseErcDialog( wxCloseEvent& aEvent )
|
void DIALOG_ERC::OnCloseErcDialog( wxCloseEvent& aEvent )
|
||||||
{
|
{
|
||||||
m_parent->FocusOnItem( nullptr );
|
m_parent->ClearFocus();
|
||||||
|
|
||||||
// Dialog is mode-less so let the parent know that it needs to be destroyed.
|
// Dialog is mode-less so let the parent know that it needs to be destroyed.
|
||||||
if( !IsModal() && !IsQuasiModal() )
|
if( !IsModal() && !IsQuasiModal() )
|
||||||
|
@ -877,7 +877,7 @@ DIALOG_LIB_EDIT_PIN_TABLE::~DIALOG_LIB_EDIT_PIN_TABLE()
|
|||||||
|
|
||||||
WINDOW_THAWER thawer( m_editFrame );
|
WINDOW_THAWER thawer( m_editFrame );
|
||||||
|
|
||||||
m_editFrame->FocusOnItem( nullptr );
|
m_editFrame->ClearFocus();
|
||||||
m_editFrame->GetCanvas()->Refresh();
|
m_editFrame->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1201,7 +1201,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnTableRangeSelected( wxGridRangeSelectEvent& a
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_parent->FocusOnItem( nullptr );
|
m_parent->ClearFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( m_radioSelect->GetValue() )
|
else if( m_radioSelect->GetValue() )
|
||||||
@ -1553,7 +1553,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnClose( wxCloseEvent& aEvent )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent->FocusOnItem( nullptr );
|
m_parent->ClearFocus();
|
||||||
|
|
||||||
wxCommandEvent* evt = new wxCommandEvent( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, wxID_ANY );
|
wxCommandEvent* evt = new wxCommandEvent( EDA_EVT_CLOSE_DIALOG_SYMBOL_FIELDS_TABLE, wxID_ANY );
|
||||||
|
|
||||||
|
@ -926,7 +926,7 @@ void SCH_EDIT_FRAME::SetCurrentSheet( const SCH_SHEET_PATH& aSheet )
|
|||||||
{
|
{
|
||||||
if( aSheet != GetCurrentSheet() )
|
if( aSheet != GetCurrentSheet() )
|
||||||
{
|
{
|
||||||
FocusOnItem( nullptr );
|
ClearFocus();
|
||||||
|
|
||||||
Schematic().SetCurrentSheet( aSheet );
|
Schematic().SetCurrentSheet( aSheet );
|
||||||
GetCanvas()->DisplaySheet( aSheet.LastScreen() );
|
GetCanvas()->DisplaySheet( aSheet.LastScreen() );
|
||||||
@ -950,7 +950,7 @@ void SCH_EDIT_FRAME::HardRedraw()
|
|||||||
if( Schematic().Settings().m_IntersheetRefsShow )
|
if( Schematic().Settings().m_IntersheetRefsShow )
|
||||||
RecomputeIntersheetRefs();
|
RecomputeIntersheetRefs();
|
||||||
|
|
||||||
FocusOnItem( nullptr );
|
ClearFocus();
|
||||||
|
|
||||||
GetCanvas()->DisplaySheet( GetCurrentSheet().LastScreen() );
|
GetCanvas()->DisplaySheet( GetCurrentSheet().LastScreen() );
|
||||||
|
|
||||||
@ -2285,8 +2285,12 @@ bool SCH_EDIT_FRAME::GetShowAllPins() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::FocusOnItem( SCH_ITEM* aItem )
|
void SCH_EDIT_FRAME::FocusOnItem( EDA_ITEM* aItem )
|
||||||
{
|
{
|
||||||
|
// nullptr will clear the current focus
|
||||||
|
if( aItem != nullptr && !aItem->IsSCH_ITEM() )
|
||||||
|
return;
|
||||||
|
|
||||||
static KIID lastBrightenedItemID( niluuid );
|
static KIID lastBrightenedItemID( niluuid );
|
||||||
|
|
||||||
SCH_SHEET_PATH dummy;
|
SCH_SHEET_PATH dummy;
|
||||||
|
@ -814,7 +814,7 @@ public:
|
|||||||
|
|
||||||
int GetSchematicJunctionSize();
|
int GetSchematicJunctionSize();
|
||||||
|
|
||||||
void FocusOnItem( SCH_ITEM* aItem );
|
void FocusOnItem( EDA_ITEM* aItem ) override;
|
||||||
|
|
||||||
bool IsSyncingSelection() { return m_syncingPcbToSchSelection; }
|
bool IsSyncingSelection() { return m_syncingPcbToSchSelection; }
|
||||||
|
|
||||||
|
@ -1496,12 +1496,16 @@ const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) con
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SYMBOL_EDIT_FRAME::FocusOnItem( SCH_ITEM* aItem )
|
void SYMBOL_EDIT_FRAME::FocusOnItem( EDA_ITEM* aItem )
|
||||||
{
|
{
|
||||||
static KIID lastBrightenedItemID( niluuid );
|
static KIID lastBrightenedItemID( niluuid );
|
||||||
|
|
||||||
SCH_ITEM* lastItem = nullptr;
|
SCH_ITEM* lastItem = nullptr;
|
||||||
|
|
||||||
|
// nullptr will clear the current focus
|
||||||
|
if( aItem != nullptr && !aItem->IsSCH_ITEM() )
|
||||||
|
return;
|
||||||
|
|
||||||
if( m_symbol )
|
if( m_symbol )
|
||||||
{
|
{
|
||||||
for( SCH_PIN* pin : m_symbol->GetPins() )
|
for( SCH_PIN* pin : m_symbol->GetPins() )
|
||||||
|
@ -372,7 +372,7 @@ public:
|
|||||||
|
|
||||||
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
|
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
|
||||||
|
|
||||||
void FocusOnItem( SCH_ITEM* aItem );
|
void FocusOnItem( EDA_ITEM* aItem ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a symbol from the schematic to edit in place.
|
* Load a symbol from the schematic to edit in place.
|
||||||
|
@ -306,7 +306,7 @@ void SCH_NAVIGATE_TOOL::changeSheet( SCH_SHEET_PATH aPath )
|
|||||||
|
|
||||||
pushToHistory( aPath );
|
pushToHistory( aPath );
|
||||||
|
|
||||||
m_frame->FocusOnItem( nullptr );
|
m_frame->ClearFocus();
|
||||||
m_frame->Schematic().SetCurrentSheet( aPath );
|
m_frame->Schematic().SetCurrentSheet( aPath );
|
||||||
m_frame->DisplayCurrentSheet();
|
m_frame->DisplayCurrentSheet();
|
||||||
}
|
}
|
||||||
|
@ -471,7 +471,7 @@ int SCH_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||||||
m_disambiguateTimer.Stop();
|
m_disambiguateTimer.Stop();
|
||||||
|
|
||||||
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
||||||
schframe->FocusOnItem( nullptr );
|
schframe->ClearFocus();
|
||||||
|
|
||||||
// Collect items at the clicked location (doesn't select them yet)
|
// Collect items at the clicked location (doesn't select them yet)
|
||||||
SCH_COLLECTOR collector;
|
SCH_COLLECTOR collector;
|
||||||
@ -558,7 +558,7 @@ int SCH_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||||||
|
|
||||||
// double click? Display the properties window
|
// double click? Display the properties window
|
||||||
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
||||||
schframe->FocusOnItem( nullptr );
|
schframe->ClearFocus();
|
||||||
|
|
||||||
if( m_selection.Empty() )
|
if( m_selection.Empty() )
|
||||||
SelectPoint( evt->Position() );
|
SelectPoint( evt->Position() );
|
||||||
@ -594,7 +594,7 @@ int SCH_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||||||
// drag with LMB? Select multiple objects (or at least draw a selection box) or
|
// drag with LMB? Select multiple objects (or at least draw a selection box) or
|
||||||
// drag them
|
// drag them
|
||||||
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
||||||
schframe->FocusOnItem( nullptr );
|
schframe->ClearFocus();
|
||||||
|
|
||||||
SCH_COLLECTOR collector;
|
SCH_COLLECTOR collector;
|
||||||
|
|
||||||
@ -940,7 +940,7 @@ int SCH_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||||||
getViewControls()->CaptureCursor( false );
|
getViewControls()->CaptureCursor( false );
|
||||||
|
|
||||||
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
||||||
schframe->FocusOnItem( nullptr );
|
schframe->ClearFocus();
|
||||||
|
|
||||||
if( !GetSelection().Empty() )
|
if( !GetSelection().Empty() )
|
||||||
{
|
{
|
||||||
@ -957,7 +957,7 @@ int SCH_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||||||
else if( evt->Action() == TA_UNDO_REDO_PRE )
|
else if( evt->Action() == TA_UNDO_REDO_PRE )
|
||||||
{
|
{
|
||||||
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
if( SCH_EDIT_FRAME* schframe = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
|
||||||
schframe->FocusOnItem( nullptr );
|
schframe->ClearFocus();
|
||||||
}
|
}
|
||||||
else if( evt->IsMotion() && !m_isSymbolEditor && evt->FirstResponder() == this )
|
else if( evt->IsMotion() && !m_isSymbolEditor && evt->FirstResponder() == this )
|
||||||
{
|
{
|
||||||
|
@ -305,6 +305,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
void FocusOnLocation( const VECTOR2I& aPos );
|
void FocusOnLocation( const VECTOR2I& aPos );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Focus on a particular canvas item.
|
||||||
|
*
|
||||||
|
* @param aItem is the item to focus on. nullptr clears the focus.
|
||||||
|
*/
|
||||||
|
virtual void FocusOnItem( EDA_ITEM* aItem ) {}
|
||||||
|
|
||||||
|
virtual void ClearFocus() { FocusOnItem( nullptr ); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a "basic" menu for a tool, containing only items that apply to all tools
|
* Construct a "basic" menu for a tool, containing only items that apply to all tools
|
||||||
* (e.g. zoom and grid).
|
* (e.g. zoom and grid).
|
||||||
|
@ -216,6 +216,7 @@ public:
|
|||||||
|
|
||||||
EDA_ITEM* GetItem( const KIID& aId ) const override;
|
EDA_ITEM* GetItem( const KIID& aId ) const override;
|
||||||
|
|
||||||
|
void FocusOnItem( EDA_ITEM* aItem ) override;
|
||||||
void FocusOnItem( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer = UNDEFINED_LAYER );
|
void FocusOnItem( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer = UNDEFINED_LAYER );
|
||||||
void FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID aLayer = UNDEFINED_LAYER );
|
void FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID aLayer = UNDEFINED_LAYER );
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
|
|||||||
|
|
||||||
DIALOG_DRC::~DIALOG_DRC()
|
DIALOG_DRC::~DIALOG_DRC()
|
||||||
{
|
{
|
||||||
m_frame->FocusOnItem( nullptr );
|
m_frame->ClearFocus();
|
||||||
|
|
||||||
g_lastDRCBoard = m_currentBoard;
|
g_lastDRCBoard = m_currentBoard;
|
||||||
g_lastDRCRun = m_drcRun;
|
g_lastDRCRun = m_drcRun;
|
||||||
@ -1097,7 +1097,7 @@ void DIALOG_DRC::OnCancelClick( wxCommandEvent& aEvent )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_frame->FocusOnItem( nullptr );
|
m_frame->ClearFocus();
|
||||||
|
|
||||||
SetReturnCode( wxID_CANCEL );
|
SetReturnCode( wxID_CANCEL );
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ DIALOG_FOOTPRINT_CHECKER::DIALOG_FOOTPRINT_CHECKER( FOOTPRINT_EDIT_FRAME* aParen
|
|||||||
|
|
||||||
DIALOG_FOOTPRINT_CHECKER::~DIALOG_FOOTPRINT_CHECKER()
|
DIALOG_FOOTPRINT_CHECKER::~DIALOG_FOOTPRINT_CHECKER()
|
||||||
{
|
{
|
||||||
m_frame->FocusOnItem( nullptr );
|
m_frame->ClearFocus();
|
||||||
|
|
||||||
g_lastFootprint = m_frame->GetBoard()->GetFirstFootprint();
|
g_lastFootprint = m_frame->GetBoard()->GetFirstFootprint();
|
||||||
g_lastChecksRun = m_checksRun;
|
g_lastChecksRun = m_checksRun;
|
||||||
@ -364,7 +364,7 @@ void DIALOG_FOOTPRINT_CHECKER::OnSeverity( wxCommandEvent& aEvent )
|
|||||||
|
|
||||||
void DIALOG_FOOTPRINT_CHECKER::OnCancelClick( wxCommandEvent& aEvent )
|
void DIALOG_FOOTPRINT_CHECKER::OnCancelClick( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
m_frame->FocusOnItem( nullptr );
|
m_frame->ClearFocus();
|
||||||
|
|
||||||
SetReturnCode( wxID_CANCEL );
|
SetReturnCode( wxID_CANCEL );
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ DIALOG_GROUP_PROPERTIES::~DIALOG_GROUP_PROPERTIES()
|
|||||||
if( m_brdEditor->IsBeingDeleted() )
|
if( m_brdEditor->IsBeingDeleted() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_brdEditor->FocusOnItem( nullptr );
|
m_brdEditor->ClearFocus();
|
||||||
m_brdEditor->GetCanvas()->Refresh();
|
m_brdEditor->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ void DIALOG_GROUP_PROPERTIES::OnRemoveMember( wxCommandEvent& event )
|
|||||||
if( selected >= 0 )
|
if( selected >= 0 )
|
||||||
m_membersList->Delete( selected );
|
m_membersList->Delete( selected );
|
||||||
|
|
||||||
m_brdEditor->FocusOnItem( nullptr );
|
m_brdEditor->ClearFocus();
|
||||||
m_brdEditor->GetCanvas()->Refresh();
|
m_brdEditor->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,6 +247,14 @@ EDA_ITEM* PCB_BASE_FRAME::GetItem( const KIID& aId ) const
|
|||||||
return GetBoard()->GetItem( aId );
|
return GetBoard()->GetItem( aId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PCB_BASE_FRAME::FocusOnItem( EDA_ITEM* aItem )
|
||||||
|
{
|
||||||
|
// nullptr will clear the current focus
|
||||||
|
if( aItem != nullptr && !aItem->IsBOARD_ITEM() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
FocusOnItem( static_cast<BOARD_ITEM*>( aItem ), UNDEFINED_LAYER );
|
||||||
|
}
|
||||||
|
|
||||||
void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer )
|
void PCB_BASE_FRAME::FocusOnItem( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer )
|
||||||
{
|
{
|
||||||
|
@ -336,7 +336,7 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_frame->FocusOnItem( nullptr );
|
m_frame->ClearFocus();
|
||||||
selectPoint( evt->Position() );
|
selectPoint( evt->Position() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -377,7 +377,7 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Double click? Display the properties window
|
// Double click? Display the properties window
|
||||||
m_frame->FocusOnItem( nullptr );
|
m_frame->ClearFocus();
|
||||||
|
|
||||||
if( m_selection.Empty() )
|
if( m_selection.Empty() )
|
||||||
selectPoint( evt->Position() );
|
selectPoint( evt->Position() );
|
||||||
@ -429,7 +429,7 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||||||
|
|
||||||
// Drag with LMB? Select multiple objects (or at least draw a selection box)
|
// Drag with LMB? Select multiple objects (or at least draw a selection box)
|
||||||
// or drag them
|
// or drag them
|
||||||
m_frame->FocusOnItem( nullptr );
|
m_frame->ClearFocus();
|
||||||
m_toolMgr->ProcessEvent( EVENTS::InhibitSelectionEditing );
|
m_toolMgr->ProcessEvent( EVENTS::InhibitSelectionEditing );
|
||||||
|
|
||||||
GENERAL_COLLECTORS_GUIDE guide = getCollectorsGuide();
|
GENERAL_COLLECTORS_GUIDE guide = getCollectorsGuide();
|
||||||
@ -539,7 +539,7 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||||||
else if( evt->IsCancel() )
|
else if( evt->IsCancel() )
|
||||||
{
|
{
|
||||||
m_disambiguateTimer.Stop();
|
m_disambiguateTimer.Stop();
|
||||||
m_frame->FocusOnItem( nullptr );
|
m_frame->ClearFocus();
|
||||||
|
|
||||||
if( !GetSelection().Empty() )
|
if( !GetSelection().Empty() )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user