2020-09-24 01:05:46 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tools/pcb_actions.h>
|
2020-12-16 13:31:32 +00:00
|
|
|
#include <tools/pcb_selection_tool.h>
|
2020-09-24 01:05:46 +00:00
|
|
|
#include <tools/group_tool.h>
|
2020-12-16 13:31:32 +00:00
|
|
|
#include <tools/pcb_picker_tool.h>
|
2020-09-24 01:05:46 +00:00
|
|
|
#include <status_popup.h>
|
|
|
|
#include <board_commit.h>
|
|
|
|
#include <bitmaps.h>
|
2020-12-28 22:16:21 +00:00
|
|
|
#include <dialogs/dialog_group_properties.h>
|
2021-06-03 17:03:25 +00:00
|
|
|
#include <pcb_group.h>
|
2021-06-03 18:05:43 +00:00
|
|
|
#include <collectors.h>
|
|
|
|
#include <footprint.h>
|
2020-09-24 01:05:46 +00:00
|
|
|
|
2020-10-03 11:16:29 +00:00
|
|
|
class GROUP_CONTEXT_MENU : public ACTION_MENU
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GROUP_CONTEXT_MENU( ) : ACTION_MENU( true )
|
|
|
|
{
|
2021-03-08 02:59:07 +00:00
|
|
|
SetIcon( BITMAPS::group ); // fixme
|
2020-10-03 11:16:29 +00:00
|
|
|
SetTitle( _( "Grouping" ) );
|
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
Add( PCB_ACTIONS::group );
|
|
|
|
Add( PCB_ACTIONS::ungroup );
|
|
|
|
Add( PCB_ACTIONS::removeFromGroup );
|
2020-10-03 11:16:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ACTION_MENU* create() const override
|
|
|
|
{
|
|
|
|
return new GROUP_CONTEXT_MENU();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void update() override
|
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selTool = getToolManager()->GetTool<PCB_SELECTION_TOOL>();
|
2022-07-12 01:03:45 +00:00
|
|
|
BOARD* board = static_cast<BOARD*>( getToolManager()->GetModel() );
|
2020-10-03 11:16:29 +00:00
|
|
|
|
|
|
|
const auto& selection = selTool->GetSelection();
|
|
|
|
|
|
|
|
wxString check = board->GroupsSanityCheck();
|
2022-07-12 01:03:45 +00:00
|
|
|
wxCHECK_RET( check == wxEmptyString, _( "Group is in inconsistent state:" ) + wxS( " " ) + check );
|
2020-10-03 11:16:29 +00:00
|
|
|
|
|
|
|
BOARD::GroupLegalOpsField legalOps = board->GroupLegalOps( selection );
|
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
Enable( PCB_ACTIONS::group.GetUIId(), legalOps.create );
|
|
|
|
Enable( PCB_ACTIONS::ungroup.GetUIId(), legalOps.ungroup );
|
|
|
|
Enable( PCB_ACTIONS::removeFromGroup.GetUIId(), legalOps.removeItems );
|
2020-10-03 11:16:29 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-09-24 01:05:46 +00:00
|
|
|
GROUP_TOOL::GROUP_TOOL() :
|
|
|
|
PCB_TOOL_BASE( "pcbnew.Groups" ),
|
2020-10-03 11:16:29 +00:00
|
|
|
m_frame( nullptr ),
|
2020-09-24 01:05:46 +00:00
|
|
|
m_propertiesDialog( nullptr ),
|
|
|
|
m_selectionTool( nullptr )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GROUP_TOOL::Reset( RESET_REASON aReason )
|
|
|
|
{
|
2020-10-03 11:16:29 +00:00
|
|
|
m_frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
|
|
|
|
2020-09-24 01:05:46 +00:00
|
|
|
if( aReason != RUN )
|
|
|
|
m_commit = std::make_unique<BOARD_COMMIT>( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool GROUP_TOOL::Init()
|
|
|
|
{
|
2020-10-03 11:16:29 +00:00
|
|
|
m_frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
|
|
|
|
2020-09-24 01:05:46 +00:00
|
|
|
// Find the selection tool, so they can cooperate
|
2020-12-16 13:31:32 +00:00
|
|
|
m_selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
2020-09-24 01:05:46 +00:00
|
|
|
|
2020-10-03 11:16:29 +00:00
|
|
|
// Add the group control menus to relevant other tools
|
|
|
|
if( m_selectionTool )
|
|
|
|
{
|
2022-09-03 18:29:02 +00:00
|
|
|
TOOL_MENU& selToolMenu = m_selectionTool->GetToolMenu();
|
2020-10-03 11:16:29 +00:00
|
|
|
|
2022-09-03 18:29:02 +00:00
|
|
|
std::shared_ptr<GROUP_CONTEXT_MENU> groupMenu = std::make_shared<GROUP_CONTEXT_MENU>();
|
|
|
|
groupMenu->SetTool( this );
|
|
|
|
selToolMenu.RegisterSubMenu( groupMenu );
|
2020-10-03 11:16:29 +00:00
|
|
|
|
2022-09-03 18:29:02 +00:00
|
|
|
selToolMenu.GetMenu().AddMenu( groupMenu.get(), SELECTION_CONDITIONS::NotEmpty, 100 );
|
2020-10-03 11:16:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2020-09-24 01:05:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int GROUP_TOOL::GroupProperties( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2020-10-03 11:16:29 +00:00
|
|
|
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
|
|
|
PCB_GROUP* group = aEvent.Parameter<PCB_GROUP*>();
|
2020-09-24 01:05:46 +00:00
|
|
|
|
|
|
|
if( m_propertiesDialog )
|
|
|
|
m_propertiesDialog->Destroy();
|
|
|
|
|
|
|
|
m_propertiesDialog = new DIALOG_GROUP_PROPERTIES( editFrame, group );
|
|
|
|
|
|
|
|
m_propertiesDialog->Show( true );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_PICKER_TOOL* picker = m_toolMgr->GetTool<PCB_PICKER_TOOL>();
|
|
|
|
STATUS_TEXT_POPUP statusPopup( frame() );
|
|
|
|
bool done = false;
|
2020-09-24 01:05:46 +00:00
|
|
|
|
|
|
|
if( m_propertiesDialog )
|
|
|
|
m_propertiesDialog->Show( false );
|
|
|
|
|
|
|
|
Activate();
|
|
|
|
|
|
|
|
statusPopup.SetText( _( "Click on new member..." ) );
|
|
|
|
|
|
|
|
picker->SetClickHandler(
|
2021-09-13 16:18:58 +00:00
|
|
|
[&]( const VECTOR2D& aPoint ) -> bool
|
|
|
|
{
|
2023-06-26 22:16:51 +00:00
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
|
2020-09-24 01:05:46 +00:00
|
|
|
|
2021-09-13 16:18:58 +00:00
|
|
|
const PCB_SELECTION& sel = m_selectionTool->RequestSelection(
|
|
|
|
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector,
|
|
|
|
PCB_SELECTION_TOOL* sTool )
|
|
|
|
{
|
|
|
|
} );
|
2020-09-24 01:05:46 +00:00
|
|
|
|
2021-09-13 16:18:58 +00:00
|
|
|
if( sel.Empty() )
|
|
|
|
return true; // still looking for an item
|
2020-09-24 01:05:46 +00:00
|
|
|
|
2021-09-13 16:18:58 +00:00
|
|
|
statusPopup.Hide();
|
2020-09-24 01:05:46 +00:00
|
|
|
|
2021-09-13 16:18:58 +00:00
|
|
|
if( m_propertiesDialog )
|
|
|
|
{
|
2023-01-05 23:28:31 +00:00
|
|
|
EDA_ITEM* elem = sel.Front();
|
|
|
|
|
|
|
|
if( !m_isFootprintEditor )
|
|
|
|
{
|
|
|
|
while( elem->GetParent() && elem->GetParent()->Type() != PCB_T )
|
|
|
|
elem = elem->GetParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_propertiesDialog->DoAddMember( elem );
|
2021-09-13 16:18:58 +00:00
|
|
|
m_propertiesDialog->Show( true );
|
|
|
|
}
|
2020-09-24 01:05:46 +00:00
|
|
|
|
2021-09-13 16:18:58 +00:00
|
|
|
return false; // got our item; don't need any more
|
|
|
|
} );
|
2020-09-24 01:05:46 +00:00
|
|
|
|
|
|
|
picker->SetMotionHandler(
|
2021-09-13 16:18:58 +00:00
|
|
|
[&] ( const VECTOR2D& aPos )
|
|
|
|
{
|
|
|
|
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
|
|
|
|
} );
|
2020-09-24 01:05:46 +00:00
|
|
|
|
|
|
|
picker->SetCancelHandler(
|
2021-09-13 16:18:58 +00:00
|
|
|
[&]()
|
|
|
|
{
|
|
|
|
if( m_propertiesDialog )
|
|
|
|
m_propertiesDialog->Show( true );
|
2020-09-24 01:05:46 +00:00
|
|
|
|
2021-09-13 16:18:58 +00:00
|
|
|
statusPopup.Hide();
|
|
|
|
} );
|
2020-09-24 01:05:46 +00:00
|
|
|
|
|
|
|
picker->SetFinalizeHandler(
|
2021-09-13 16:18:58 +00:00
|
|
|
[&]( const int& aFinalState )
|
|
|
|
{
|
|
|
|
done = true;
|
|
|
|
} );
|
2020-09-24 01:05:46 +00:00
|
|
|
|
|
|
|
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, -50 ) );
|
|
|
|
statusPopup.Popup();
|
2022-09-04 20:04:17 +00:00
|
|
|
canvas()->SetStatusPopup( statusPopup.GetPanel() );
|
2020-09-24 01:05:46 +00:00
|
|
|
|
2023-06-26 22:16:51 +00:00
|
|
|
m_toolMgr->RunAction( ACTIONS::pickerTool, &aEvent );
|
2020-09-24 01:05:46 +00:00
|
|
|
|
|
|
|
while( !done )
|
2020-10-27 00:32:41 +00:00
|
|
|
{
|
|
|
|
// Pass events unless we receive a null event, then we must shut down
|
|
|
|
if( TOOL_EVENT* evt = Wait() )
|
|
|
|
evt->SetPassEvent();
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
2020-09-24 01:05:46 +00:00
|
|
|
|
2022-09-04 20:04:17 +00:00
|
|
|
canvas()->SetStatusPopup( nullptr );
|
2022-10-06 22:52:59 +00:00
|
|
|
|
2020-09-24 01:05:46 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-10-03 11:16:29 +00:00
|
|
|
int GROUP_TOOL::Group( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2021-02-20 18:09:09 +00:00
|
|
|
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
|
|
|
PCB_SELECTION selection;
|
|
|
|
|
|
|
|
if( m_isFootprintEditor )
|
|
|
|
{
|
|
|
|
selection = selTool->RequestSelection(
|
|
|
|
[]( const VECTOR2I& , GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* )
|
|
|
|
{
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
selection = selTool->RequestSelection(
|
|
|
|
[]( const VECTOR2I& , GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* )
|
|
|
|
{
|
|
|
|
// Iterate from the back so we don't have to worry about removals.
|
|
|
|
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
|
|
|
|
{
|
|
|
|
BOARD_ITEM* item = aCollector[ i ];
|
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
if( item->GetParentFootprint() )
|
2021-02-20 18:09:09 +00:00
|
|
|
aCollector.Remove( item );
|
|
|
|
}
|
|
|
|
} );
|
|
|
|
}
|
2020-10-03 11:16:29 +00:00
|
|
|
|
|
|
|
if( selection.Empty() )
|
2021-02-20 18:09:09 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
BOARD* board = getModel<BOARD>();
|
|
|
|
PCB_GROUP* group = nullptr;
|
2021-09-27 10:28:46 +00:00
|
|
|
bool lockGroup = false;
|
2020-10-03 11:16:29 +00:00
|
|
|
|
2020-11-07 17:50:22 +00:00
|
|
|
if( m_isFootprintEditor )
|
2020-10-03 11:16:29 +00:00
|
|
|
{
|
2023-07-15 16:37:17 +00:00
|
|
|
group = new PCB_GROUP( board->GetFirstFootprint() );
|
|
|
|
board->GetFirstFootprint()->Add( group );
|
2020-10-03 11:16:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
group = new PCB_GROUP( board );
|
|
|
|
board->Add( group );
|
2023-07-15 16:37:17 +00:00
|
|
|
}
|
2020-10-03 11:16:29 +00:00
|
|
|
|
2023-07-15 16:37:17 +00:00
|
|
|
PICKED_ITEMS_LIST undoList;
|
|
|
|
undoList.PushItem( ITEM_PICKER( nullptr, group, UNDO_REDO::NEWITEM ) );
|
2020-10-03 11:16:29 +00:00
|
|
|
|
2023-07-15 16:37:17 +00:00
|
|
|
for( EDA_ITEM* eda_item : selection )
|
|
|
|
{
|
|
|
|
if( BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( eda_item ) )
|
2020-10-03 11:16:29 +00:00
|
|
|
{
|
2021-09-27 10:28:46 +00:00
|
|
|
if( item->IsLocked() )
|
|
|
|
lockGroup = true;
|
|
|
|
|
2023-07-15 16:37:17 +00:00
|
|
|
group->AddItem( item );
|
2021-08-28 09:44:01 +00:00
|
|
|
undoList.PushItem( ITEM_PICKER( nullptr, item, UNDO_REDO::REGROUP ) );
|
2020-10-03 11:16:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-15 16:37:17 +00:00
|
|
|
m_frame->SaveCopyInUndoList( undoList, UNDO_REDO::REGROUP );
|
|
|
|
|
2021-09-27 10:28:46 +00:00
|
|
|
if( lockGroup )
|
|
|
|
group->SetLocked( true );
|
|
|
|
|
2020-10-03 11:16:29 +00:00
|
|
|
selTool->ClearSelection();
|
|
|
|
selTool->select( group );
|
|
|
|
|
|
|
|
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
|
|
|
m_frame->OnModify();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int GROUP_TOOL::Ungroup( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
|
2020-10-03 11:16:29 +00:00
|
|
|
BOARD* board = getModel<BOARD>();
|
|
|
|
std::vector<BOARD_ITEM*> members;
|
|
|
|
|
|
|
|
if( selection.Empty() )
|
2023-06-26 22:16:51 +00:00
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor );
|
2020-10-03 11:16:29 +00:00
|
|
|
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION selCopy = selection;
|
2023-06-26 22:16:51 +00:00
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear );
|
2020-10-03 11:16:29 +00:00
|
|
|
|
|
|
|
for( EDA_ITEM* item : selCopy )
|
|
|
|
{
|
|
|
|
PCB_GROUP* group = dynamic_cast<PCB_GROUP*>( item );
|
|
|
|
|
|
|
|
if( group )
|
|
|
|
{
|
2023-07-15 16:37:17 +00:00
|
|
|
PICKED_ITEMS_LIST undoList;
|
2020-10-03 11:16:29 +00:00
|
|
|
|
2023-07-15 16:37:17 +00:00
|
|
|
for( BOARD_ITEM* member : group->GetItems() )
|
2020-10-03 11:16:29 +00:00
|
|
|
{
|
2023-07-15 16:37:17 +00:00
|
|
|
undoList.PushItem( ITEM_PICKER( nullptr, member, UNDO_REDO::UNGROUP ) );
|
|
|
|
members.push_back( member );
|
|
|
|
}
|
2020-10-03 11:16:29 +00:00
|
|
|
|
2023-07-15 16:37:17 +00:00
|
|
|
group->RemoveAll();
|
2020-10-03 11:16:29 +00:00
|
|
|
|
2023-07-15 16:37:17 +00:00
|
|
|
if( m_isFootprintEditor )
|
|
|
|
board->GetFirstFootprint()->Remove( group );
|
|
|
|
else
|
2020-10-03 11:16:29 +00:00
|
|
|
board->Remove( group );
|
|
|
|
|
2023-07-15 16:37:17 +00:00
|
|
|
undoList.PushItem( ITEM_PICKER( nullptr, group, UNDO_REDO::DELETED ) );
|
|
|
|
m_frame->SaveCopyInUndoList( undoList, UNDO_REDO::UNGROUP );
|
2020-10-03 11:16:29 +00:00
|
|
|
group->SetSelected();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-16 21:28:15 +00:00
|
|
|
EDA_ITEMS mem( members.begin(), members.end() );
|
2023-06-26 22:16:51 +00:00
|
|
|
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, &mem );
|
2020-10-03 11:16:29 +00:00
|
|
|
|
|
|
|
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
|
|
|
m_frame->OnModify();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int GROUP_TOOL::RemoveFromGroup( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
|
|
|
const PCB_SELECTION& selection = selTool->GetSelection();
|
|
|
|
BOARD_COMMIT commit( m_frame );
|
2020-10-03 11:16:29 +00:00
|
|
|
|
|
|
|
if( selection.Empty() )
|
2023-06-26 22:16:51 +00:00
|
|
|
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor );
|
2020-10-03 11:16:29 +00:00
|
|
|
|
|
|
|
std::map<PCB_GROUP*, std::vector<BOARD_ITEM*>> groupMap;
|
|
|
|
|
|
|
|
for( EDA_ITEM* item : selection )
|
|
|
|
{
|
|
|
|
BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
|
|
|
|
PCB_GROUP* group = boardItem->GetParentGroup();
|
|
|
|
|
|
|
|
if( group )
|
|
|
|
groupMap[ group ].push_back( boardItem );
|
|
|
|
}
|
|
|
|
|
|
|
|
for( std::pair<PCB_GROUP*, std::vector<BOARD_ITEM*>> pair : groupMap )
|
|
|
|
{
|
|
|
|
commit.Modify( pair.first );
|
|
|
|
|
|
|
|
for( BOARD_ITEM* item : pair.second )
|
|
|
|
pair.first->RemoveItem( item );
|
|
|
|
}
|
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
commit.Push( wxT( "Remove Group Items" ) );
|
2020-10-03 11:16:29 +00:00
|
|
|
|
|
|
|
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
|
|
|
m_frame->OnModify();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int GROUP_TOOL::EnterGroup( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
PCB_SELECTION_TOOL* selTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
|
|
|
|
const PCB_SELECTION& selection = selTool->GetSelection();
|
2020-10-03 11:16:29 +00:00
|
|
|
|
|
|
|
if( selection.GetSize() == 1 && selection[0]->Type() == PCB_GROUP_T )
|
|
|
|
selTool->EnterGroup();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int GROUP_TOOL::LeaveGroup( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2020-12-16 13:31:32 +00:00
|
|
|
m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->ExitGroup( true /* Select the group */ );
|
2020-10-03 11:16:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-09-24 01:05:46 +00:00
|
|
|
void GROUP_TOOL::setTransitions()
|
|
|
|
{
|
|
|
|
Go( &GROUP_TOOL::GroupProperties, PCB_ACTIONS::groupProperties.MakeEvent() );
|
|
|
|
Go( &GROUP_TOOL::PickNewMember, PCB_ACTIONS::pickNewGroupMember.MakeEvent() );
|
2020-10-03 11:16:29 +00:00
|
|
|
|
2021-02-16 20:45:25 +00:00
|
|
|
Go( &GROUP_TOOL::Group, PCB_ACTIONS::group.MakeEvent() );
|
|
|
|
Go( &GROUP_TOOL::Ungroup, PCB_ACTIONS::ungroup.MakeEvent() );
|
|
|
|
Go( &GROUP_TOOL::RemoveFromGroup, PCB_ACTIONS::removeFromGroup.MakeEvent() );
|
2020-10-03 11:16:29 +00:00
|
|
|
Go( &GROUP_TOOL::EnterGroup, PCB_ACTIONS::groupEnter.MakeEvent() );
|
|
|
|
Go( &GROUP_TOOL::LeaveGroup, PCB_ACTIONS::groupLeave.MakeEvent() );
|
2020-09-24 01:05:46 +00:00
|
|
|
}
|