2014-07-09 13:02:56 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2019-01-21 20:03:36 +00:00
|
|
|
* Copyright (C) 2014-2019 CERN
|
2022-07-22 08:26:49 +00:00
|
|
|
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-07-09 13:02:56 +00:00
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
#include "footprint_editor_control.h"
|
2022-09-01 13:19:11 +00:00
|
|
|
#include <wx/generic/textdlgg.h>
|
|
|
|
#include <string_utils.h>
|
2022-07-22 08:26:49 +00:00
|
|
|
#include <pgm_base.h>
|
2015-05-05 18:39:41 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2020-06-17 12:46:50 +00:00
|
|
|
#include <tools/pcb_actions.h>
|
2019-06-03 20:06:58 +00:00
|
|
|
#include <footprint_edit_frame.h>
|
2014-07-09 13:02:56 +00:00
|
|
|
#include <pcbnew_id.h>
|
2014-07-09 13:02:56 +00:00
|
|
|
#include <confirm.h>
|
2022-12-28 22:03:03 +00:00
|
|
|
#include <widgets/wx_infobar.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <footprint.h>
|
2021-06-06 19:03:10 +00:00
|
|
|
#include <pad.h>
|
2021-06-03 17:03:25 +00:00
|
|
|
#include <pcb_group.h>
|
2021-06-03 18:05:43 +00:00
|
|
|
#include <zone.h>
|
2019-06-06 11:45:28 +00:00
|
|
|
#include <fp_lib_table.h>
|
2020-06-17 12:46:50 +00:00
|
|
|
#include <dialogs/dialog_cleanup_graphics.h>
|
2020-11-21 20:42:27 +00:00
|
|
|
#include <dialogs/dialog_footprint_checker.h>
|
2020-11-10 20:11:53 +00:00
|
|
|
#include <footprint_wizard_frame.h>
|
|
|
|
#include <kiway.h>
|
2021-12-01 14:42:44 +00:00
|
|
|
#include <drc/drc_item.h>
|
2023-09-28 03:15:54 +00:00
|
|
|
#include <project_pcb.h>
|
2020-11-21 20:42:27 +00:00
|
|
|
|
2023-01-18 00:40:14 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2019-06-03 23:50:44 +00:00
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
FOOTPRINT_EDITOR_CONTROL::FOOTPRINT_EDITOR_CONTROL() :
|
2019-06-05 19:15:57 +00:00
|
|
|
PCB_TOOL_BASE( "pcbnew.ModuleEditor" ),
|
2020-11-21 20:42:27 +00:00
|
|
|
m_frame( nullptr ),
|
|
|
|
m_checkerDialog( nullptr )
|
2014-07-09 13:02:56 +00:00
|
|
|
{
|
2015-09-05 19:47:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
FOOTPRINT_EDITOR_CONTROL::~FOOTPRINT_EDITOR_CONTROL()
|
2015-09-05 19:47:35 +00:00
|
|
|
{
|
2014-07-09 13:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
void FOOTPRINT_EDITOR_CONTROL::Reset( RESET_REASON aReason )
|
2014-07-09 13:02:56 +00:00
|
|
|
{
|
2019-06-05 19:15:57 +00:00
|
|
|
m_frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
|
2020-11-21 20:42:27 +00:00
|
|
|
|
|
|
|
if( m_checkerDialog )
|
|
|
|
DestroyCheckerDialog();
|
2019-06-05 19:15:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
bool FOOTPRINT_EDITOR_CONTROL::Init()
|
2019-06-05 19:15:57 +00:00
|
|
|
{
|
|
|
|
// Build a context menu for the footprint tree
|
|
|
|
//
|
|
|
|
CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
|
|
|
|
|
2020-11-08 21:29:04 +00:00
|
|
|
auto libSelectedCondition =
|
|
|
|
[ this ]( const SELECTION& aSel )
|
|
|
|
{
|
|
|
|
LIB_ID sel = m_frame->GetTreeFPID();
|
|
|
|
return !sel.GetLibNickname().empty() && sel.GetLibItemName().empty();
|
|
|
|
};
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2021-02-18 20:37:27 +00:00
|
|
|
// The libInferredCondition allows you to do things like New Symbol and Paste with a
|
|
|
|
// symbol selected (in other words, when we know the library context even if the library
|
|
|
|
// itself isn't selected.
|
|
|
|
auto libInferredCondition =
|
|
|
|
[ this ]( const SELECTION& aSel )
|
|
|
|
{
|
|
|
|
LIB_ID sel = m_frame->GetTreeFPID();
|
|
|
|
return !sel.GetLibNickname().empty();
|
|
|
|
};
|
2020-11-08 21:29:04 +00:00
|
|
|
auto pinnedLibSelectedCondition =
|
|
|
|
[ this ]( const SELECTION& aSel )
|
|
|
|
{
|
|
|
|
LIB_TREE_NODE* current = m_frame->GetCurrentTreeNode();
|
2023-11-08 17:34:14 +00:00
|
|
|
return current && current->m_Type == LIB_TREE_NODE::LIBRARY && current->m_Pinned;
|
2020-11-08 21:29:04 +00:00
|
|
|
};
|
|
|
|
auto unpinnedLibSelectedCondition =
|
|
|
|
[ this ](const SELECTION& aSel )
|
|
|
|
{
|
|
|
|
LIB_TREE_NODE* current = m_frame->GetCurrentTreeNode();
|
2023-11-08 17:34:14 +00:00
|
|
|
return current && current->m_Type == LIB_TREE_NODE::LIBRARY && !current->m_Pinned;
|
2020-11-08 21:29:04 +00:00
|
|
|
};
|
|
|
|
auto fpSelectedCondition =
|
|
|
|
[ this ]( const SELECTION& aSel )
|
|
|
|
{
|
|
|
|
LIB_ID sel = m_frame->GetTreeFPID();
|
|
|
|
return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
|
|
|
|
};
|
2019-06-05 19:15:57 +00:00
|
|
|
|
2023-03-29 16:46:30 +00:00
|
|
|
auto fpExportCondition =
|
|
|
|
[ this ]( const SELECTION& aSel )
|
|
|
|
{
|
|
|
|
FOOTPRINT* fp = m_frame->GetBoard()->GetFirstFootprint();
|
|
|
|
return fp != nullptr;
|
|
|
|
};
|
|
|
|
|
2022-04-21 10:57:15 +00:00
|
|
|
ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
|
|
|
|
ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
|
2020-02-07 17:06:24 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
ctxMenu.AddSeparator();
|
2022-04-21 10:57:15 +00:00
|
|
|
ctxMenu.AddItem( PCB_ACTIONS::newFootprint, libSelectedCondition );
|
|
|
|
ctxMenu.AddItem( PCB_ACTIONS::createFootprint, libSelectedCondition );
|
2019-06-05 19:15:57 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
ctxMenu.AddSeparator();
|
2022-09-01 13:19:11 +00:00
|
|
|
ctxMenu.AddItem( ACTIONS::save, SELECTION_CONDITIONS::ShowAlways );
|
2022-04-24 16:38:34 +00:00
|
|
|
ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition || fpSelectedCondition );
|
2022-04-21 10:57:15 +00:00
|
|
|
ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition || libInferredCondition );
|
2019-06-05 19:15:57 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
ctxMenu.AddSeparator();
|
2022-04-21 10:57:15 +00:00
|
|
|
ctxMenu.AddItem( PCB_ACTIONS::cutFootprint, fpSelectedCondition );
|
|
|
|
ctxMenu.AddItem( PCB_ACTIONS::copyFootprint, fpSelectedCondition );
|
|
|
|
ctxMenu.AddItem( PCB_ACTIONS::pasteFootprint, libInferredCondition );
|
|
|
|
ctxMenu.AddItem( PCB_ACTIONS::duplicateFootprint, fpSelectedCondition );
|
|
|
|
ctxMenu.AddItem( PCB_ACTIONS::renameFootprint, fpSelectedCondition );
|
|
|
|
ctxMenu.AddItem( PCB_ACTIONS::deleteFootprint, fpSelectedCondition );
|
2019-06-05 19:15:57 +00:00
|
|
|
|
2019-06-15 16:40:14 +00:00
|
|
|
ctxMenu.AddSeparator();
|
2022-04-21 10:57:15 +00:00
|
|
|
ctxMenu.AddItem( PCB_ACTIONS::importFootprint, libInferredCondition );
|
2023-03-29 16:46:30 +00:00
|
|
|
ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpExportCondition );
|
2019-07-19 16:15:23 +00:00
|
|
|
|
2021-03-29 11:01:03 +00:00
|
|
|
// If we've got nothing else to show, at least show a hide tree option
|
2022-04-21 10:57:15 +00:00
|
|
|
ctxMenu.AddItem( PCB_ACTIONS::hideFootprintTree, !libInferredCondition );
|
2021-03-29 11:01:03 +00:00
|
|
|
|
2019-06-05 19:15:57 +00:00
|
|
|
return true;
|
2014-07-09 13:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::NewFootprint( const TOOL_EVENT& aEvent )
|
2019-06-04 18:46:52 +00:00
|
|
|
{
|
2020-11-13 15:15:52 +00:00
|
|
|
LIB_ID selected = m_frame->GetTreeFPID();
|
2023-09-06 11:49:14 +00:00
|
|
|
wxString libraryName = selected.GetUniStringLibNickname();
|
|
|
|
FOOTPRINT* newFootprint = m_frame->CreateNewFootprint( wxEmptyString, libraryName, false );
|
2020-11-10 20:11:53 +00:00
|
|
|
|
|
|
|
if( !newFootprint )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if( !m_frame->Clear_Pcb( true ) )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
canvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
2020-11-10 20:31:52 +00:00
|
|
|
m_frame->AddFootprintToBoard( newFootprint );
|
2020-11-10 20:11:53 +00:00
|
|
|
|
2020-11-14 21:21:54 +00:00
|
|
|
// Initialize data relative to nets and netclasses (for a new footprint the defaults are
|
|
|
|
// used). This is mandatory to handle and draw pads.
|
2020-11-10 20:11:53 +00:00
|
|
|
board()->BuildListOfNets();
|
2023-02-19 03:40:07 +00:00
|
|
|
newFootprint->SetPosition( VECTOR2I( 0, 0 ) );
|
2020-11-10 20:11:53 +00:00
|
|
|
newFootprint->ClearFlags();
|
|
|
|
|
|
|
|
m_frame->Zoom_Automatique( false );
|
2021-05-28 19:07:04 +00:00
|
|
|
m_frame->GetScreen()->SetContentModified();
|
2020-11-10 20:11:53 +00:00
|
|
|
|
|
|
|
// If selected from the library tree then go ahead and save it there
|
|
|
|
if( !selected.GetLibNickname().empty() )
|
|
|
|
{
|
|
|
|
LIB_ID fpid = newFootprint->GetFPID();
|
|
|
|
fpid.SetLibNickname( selected.GetLibNickname() );
|
|
|
|
newFootprint->SetFPID( fpid );
|
|
|
|
m_frame->SaveFootprint( newFootprint );
|
|
|
|
m_frame->ClearModify();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_frame->UpdateView();
|
2021-04-09 02:09:06 +00:00
|
|
|
m_frame->Update3DView( true, true );
|
2020-11-10 20:11:53 +00:00
|
|
|
|
|
|
|
m_frame->SyncLibraryTree( false );
|
2019-06-04 18:46:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::CreateFootprint( const TOOL_EVENT& aEvent )
|
2019-06-04 18:46:52 +00:00
|
|
|
{
|
2020-11-10 20:11:53 +00:00
|
|
|
LIB_ID selected = m_frame->GetTreeFPID();
|
|
|
|
|
|
|
|
if( m_frame->IsContentModified() )
|
|
|
|
{
|
|
|
|
if( !HandleUnsavedChanges( m_frame, _( "The current footprint has been modified. "
|
|
|
|
"Save changes?" ),
|
|
|
|
[&]() -> bool
|
|
|
|
{
|
|
|
|
return m_frame->SaveFootprint( footprint() );
|
|
|
|
} ) )
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-08 17:19:24 +00:00
|
|
|
if( KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_FOOTPRINT_WIZARD, true, m_frame ) )
|
2020-11-10 20:11:53 +00:00
|
|
|
{
|
2024-05-08 17:19:24 +00:00
|
|
|
FOOTPRINT_WIZARD_FRAME* wizard = static_cast<FOOTPRINT_WIZARD_FRAME*>( frame );
|
2020-11-10 20:11:53 +00:00
|
|
|
|
2024-05-08 17:19:24 +00:00
|
|
|
if( wizard->ShowModal( nullptr, m_frame ) )
|
2020-11-10 20:11:53 +00:00
|
|
|
{
|
2024-05-08 17:19:24 +00:00
|
|
|
// Creates the new footprint from python script wizard
|
|
|
|
FOOTPRINT* newFootprint = wizard->GetBuiltFootprint();
|
2020-11-10 20:11:53 +00:00
|
|
|
|
2024-05-08 17:19:24 +00:00
|
|
|
if( newFootprint ) // i.e. if create footprint command is OK
|
2020-11-10 20:11:53 +00:00
|
|
|
{
|
2024-05-08 17:19:24 +00:00
|
|
|
m_frame->Clear_Pcb( false );
|
|
|
|
|
|
|
|
canvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
|
|
|
// Add the new object to board
|
|
|
|
m_frame->AddFootprintToBoard( newFootprint );
|
|
|
|
|
|
|
|
// Initialize data relative to nets and netclasses (for a new footprint the
|
|
|
|
// defaults are used). This is mandatory to handle and draw pads.
|
|
|
|
board()->BuildListOfNets();
|
|
|
|
newFootprint->SetPosition( VECTOR2I( 0, 0 ) );
|
|
|
|
newFootprint->ClearFlags();
|
|
|
|
|
|
|
|
m_frame->Zoom_Automatique( false );
|
|
|
|
m_frame->GetScreen()->SetContentModified();
|
|
|
|
m_frame->OnModify();
|
|
|
|
|
|
|
|
// If selected from the library tree then go ahead and save it there
|
|
|
|
if( !selected.GetLibNickname().empty() )
|
|
|
|
{
|
|
|
|
LIB_ID fpid = newFootprint->GetFPID();
|
|
|
|
fpid.SetLibNickname( selected.GetLibNickname() );
|
|
|
|
newFootprint->SetFPID( fpid );
|
|
|
|
m_frame->SaveFootprint( newFootprint );
|
|
|
|
m_frame->ClearModify();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_frame->UpdateView();
|
|
|
|
canvas()->Refresh();
|
|
|
|
m_frame->Update3DView( true, true );
|
|
|
|
|
|
|
|
m_frame->SyncLibraryTree( false );
|
2020-11-10 20:11:53 +00:00
|
|
|
}
|
|
|
|
}
|
2024-05-08 17:19:24 +00:00
|
|
|
|
|
|
|
wizard->Destroy();
|
2020-11-10 20:11:53 +00:00
|
|
|
}
|
|
|
|
|
2019-06-04 18:46:52 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::Save( const TOOL_EVENT& aEvent )
|
2019-06-03 23:50:44 +00:00
|
|
|
{
|
2020-11-10 20:11:53 +00:00
|
|
|
if( !footprint() ) // no loaded footprint
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if( m_frame->GetTargetFPID() == m_frame->GetLoadedFPID() )
|
|
|
|
{
|
|
|
|
if( m_frame->SaveFootprint( footprint() ) )
|
|
|
|
{
|
|
|
|
view()->Update( footprint() );
|
|
|
|
|
|
|
|
canvas()->ForceRefresh();
|
|
|
|
m_frame->ClearModify();
|
2021-02-20 14:36:28 +00:00
|
|
|
m_frame->UpdateTitle();
|
2020-11-10 20:11:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_frame->RefreshLibraryTree();
|
2019-06-03 23:50:44 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::SaveAs( const TOOL_EVENT& aEvent )
|
2019-06-03 23:50:44 +00:00
|
|
|
{
|
2020-11-10 20:11:53 +00:00
|
|
|
if( m_frame->GetTargetFPID().GetLibItemName().empty() )
|
|
|
|
{
|
|
|
|
// Save Library As
|
|
|
|
const wxString& src_libNickname = m_frame->GetTargetFPID().GetLibNickname();
|
2023-09-28 03:15:54 +00:00
|
|
|
wxString src_libFullName = PROJECT_PCB::PcbFootprintLibs( &m_frame->Prj() )->GetFullURI( src_libNickname );
|
2020-11-10 20:11:53 +00:00
|
|
|
|
|
|
|
if( m_frame->SaveLibraryAs( src_libFullName ) )
|
|
|
|
m_frame->SyncLibraryTree( true );
|
|
|
|
}
|
|
|
|
else if( m_frame->GetTargetFPID() == m_frame->GetLoadedFPID() )
|
|
|
|
{
|
2022-04-24 16:38:34 +00:00
|
|
|
// Save Footprint As
|
2020-11-10 20:11:53 +00:00
|
|
|
if( footprint() && m_frame->SaveFootprintAs( footprint() ) )
|
|
|
|
{
|
|
|
|
view()->Update( footprint() );
|
|
|
|
m_frame->ClearModify();
|
|
|
|
|
2021-04-01 10:17:02 +00:00
|
|
|
// Get rid of the save-will-update-board-only (or any other dismissable warning)
|
|
|
|
WX_INFOBAR* infobar = m_frame->GetInfoBar();
|
|
|
|
|
2021-08-19 21:28:54 +00:00
|
|
|
if( infobar->IsShownOnScreen() && infobar->HasCloseButton() )
|
2021-04-01 10:17:02 +00:00
|
|
|
infobar->Dismiss();
|
|
|
|
|
2020-11-10 20:11:53 +00:00
|
|
|
canvas()->ForceRefresh();
|
|
|
|
m_frame->SyncLibraryTree( true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Save Selected Footprint As
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT* footprint = m_frame->LoadFootprint( m_frame->GetTargetFPID() );
|
2020-11-10 20:11:53 +00:00
|
|
|
|
|
|
|
if( footprint && m_frame->SaveFootprintAs( footprint ) )
|
2021-12-10 00:44:48 +00:00
|
|
|
{
|
2020-11-10 20:11:53 +00:00
|
|
|
m_frame->SyncLibraryTree( true );
|
2021-12-10 00:44:48 +00:00
|
|
|
m_frame->FocusOnLibID( footprint->GetFPID() );
|
|
|
|
}
|
2020-11-10 20:11:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_frame->RefreshLibraryTree();
|
2019-06-03 23:50:44 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::Revert( const TOOL_EVENT& aEvent )
|
2019-06-03 20:06:58 +00:00
|
|
|
{
|
|
|
|
getEditFrame<FOOTPRINT_EDIT_FRAME>()->RevertFootprint();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-04-22 15:46:31 +00:00
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::CutCopyFootprint( const TOOL_EVENT& aEvent )
|
2019-06-06 11:45:28 +00:00
|
|
|
{
|
|
|
|
LIB_ID fpID = m_frame->GetTreeFPID();
|
|
|
|
|
|
|
|
if( fpID == m_frame->GetLoadedFPID() )
|
2023-01-18 00:40:14 +00:00
|
|
|
{
|
|
|
|
m_copiedFootprint = std::make_unique<FOOTPRINT>( *m_frame->GetBoard()->GetFirstFootprint() );
|
|
|
|
m_copiedFootprint->SetParent( nullptr );
|
|
|
|
}
|
2019-06-06 11:45:28 +00:00
|
|
|
else
|
2023-01-18 00:40:14 +00:00
|
|
|
{
|
2020-11-08 21:29:04 +00:00
|
|
|
m_copiedFootprint.reset( m_frame->LoadFootprint( fpID ) );
|
2023-01-18 00:40:14 +00:00
|
|
|
}
|
2019-07-19 16:15:23 +00:00
|
|
|
|
2019-06-06 11:45:28 +00:00
|
|
|
if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) )
|
2020-12-04 12:13:11 +00:00
|
|
|
DeleteFootprint( aEvent );
|
2019-06-06 11:45:28 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::PasteFootprint( const TOOL_EVENT& aEvent )
|
2019-06-06 11:45:28 +00:00
|
|
|
{
|
2020-11-08 21:29:04 +00:00
|
|
|
if( m_copiedFootprint && !m_frame->GetTreeFPID().GetLibNickname().empty() )
|
2019-06-06 11:45:28 +00:00
|
|
|
{
|
|
|
|
wxString newLib = m_frame->GetTreeFPID().GetLibNickname();
|
2020-11-08 21:29:04 +00:00
|
|
|
wxString newName = m_copiedFootprint->GetFPID().GetLibItemName();
|
2019-06-06 11:45:28 +00:00
|
|
|
|
2023-09-28 03:15:54 +00:00
|
|
|
while( PROJECT_PCB::PcbFootprintLibs( &m_frame->Prj() )->FootprintExists( newLib, newName ) )
|
2019-06-06 11:45:28 +00:00
|
|
|
newName += _( "_copy" );
|
|
|
|
|
2020-11-08 21:29:04 +00:00
|
|
|
m_copiedFootprint->SetFPID( LIB_ID( newLib, newName ) );
|
|
|
|
m_frame->SaveFootprintInLibrary( m_copiedFootprint.get(), newLib );
|
2019-06-06 11:45:28 +00:00
|
|
|
|
|
|
|
m_frame->SyncLibraryTree( true );
|
2022-07-15 13:12:37 +00:00
|
|
|
m_frame->LoadFootprintFromLibrary( m_copiedFootprint->GetFPID() );
|
2020-11-08 21:29:04 +00:00
|
|
|
m_frame->FocusOnLibID( m_copiedFootprint->GetFPID() );
|
2022-07-15 13:12:37 +00:00
|
|
|
m_frame->RefreshLibraryTree();
|
2019-06-06 11:45:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-04-21 10:57:15 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::DuplicateFootprint( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
LIB_ID fpID = m_frame->GetTreeFPID();
|
|
|
|
FOOTPRINT* footprint;
|
|
|
|
|
|
|
|
if( fpID == m_frame->GetLoadedFPID() )
|
|
|
|
footprint = new FOOTPRINT( *m_frame->GetBoard()->GetFirstFootprint() );
|
|
|
|
else
|
|
|
|
footprint = m_frame->LoadFootprint( m_frame->GetTargetFPID() );
|
|
|
|
|
|
|
|
if( footprint && m_frame->DuplicateFootprint( footprint ) )
|
|
|
|
{
|
|
|
|
m_frame->SyncLibraryTree( true );
|
2022-07-27 17:08:27 +00:00
|
|
|
m_frame->LoadFootprintFromLibrary( footprint->GetFPID() );
|
2022-04-21 10:57:15 +00:00
|
|
|
m_frame->FocusOnLibID( footprint->GetFPID() );
|
|
|
|
m_frame->RefreshLibraryTree();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-06 11:49:14 +00:00
|
|
|
class RENAME_DIALOG : public wxTextEntryDialog
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RENAME_DIALOG( wxWindow* aParent, const wxString& aName,
|
|
|
|
std::function<bool( wxString newName )> aValidator ) :
|
|
|
|
wxTextEntryDialog( aParent, _( "New name:" ), _( "Change Footprint Name" ), aName ),
|
|
|
|
m_validator( std::move( aValidator ) )
|
|
|
|
{ }
|
|
|
|
|
|
|
|
wxString GetFPName()
|
|
|
|
{
|
|
|
|
wxString name = m_textctrl->GetValue();
|
|
|
|
name.Trim( true ).Trim( false );
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool TransferDataFromWindow() override
|
|
|
|
{
|
|
|
|
return m_validator( GetFPName() );
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::function<bool( wxString newName )> m_validator;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2022-04-21 10:57:15 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::RenameFootprint( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
2023-09-28 03:15:54 +00:00
|
|
|
FP_LIB_TABLE* tbl = PROJECT_PCB::PcbFootprintLibs( &m_frame->Prj() );
|
2022-04-21 10:57:15 +00:00
|
|
|
LIB_ID fpID = m_frame->GetTreeFPID();
|
|
|
|
wxString libraryName = fpID.GetLibNickname();
|
|
|
|
wxString oldName = fpID.GetLibItemName();
|
2023-09-06 11:49:14 +00:00
|
|
|
wxString msg;
|
2022-04-21 10:57:15 +00:00
|
|
|
|
2023-09-06 11:49:14 +00:00
|
|
|
RENAME_DIALOG dlg( m_frame, oldName,
|
|
|
|
[&]( wxString newName )
|
|
|
|
{
|
|
|
|
if( newName.IsEmpty() )
|
|
|
|
{
|
|
|
|
wxMessageBox( _( "Footprint must have a name." ) );
|
|
|
|
return false;
|
|
|
|
}
|
2022-04-21 10:57:15 +00:00
|
|
|
|
2023-09-06 11:49:14 +00:00
|
|
|
if( tbl->FootprintExists( libraryName, newName ) )
|
|
|
|
{
|
|
|
|
msg = wxString::Format( _( "Footprint '%s' already exists in library '%s'." ),
|
|
|
|
newName, libraryName );
|
2022-04-21 10:57:15 +00:00
|
|
|
|
2023-09-06 11:49:14 +00:00
|
|
|
KIDIALOG errorDlg( m_frame, msg, _( "Confirmation" ),
|
|
|
|
wxOK | wxCANCEL | wxICON_WARNING );
|
|
|
|
errorDlg.SetOKLabel( _( "Overwrite" ) );
|
2022-04-21 10:57:15 +00:00
|
|
|
|
2023-09-06 11:49:14 +00:00
|
|
|
return errorDlg.ShowModal() == wxID_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() != wxID_OK )
|
|
|
|
return 0; // canceled by user
|
2022-04-21 10:57:15 +00:00
|
|
|
|
2023-09-06 11:49:14 +00:00
|
|
|
wxString newName = dlg.GetFPName();
|
2022-04-21 10:57:15 +00:00
|
|
|
FOOTPRINT* footprint = nullptr;
|
|
|
|
|
|
|
|
if( fpID == m_frame->GetLoadedFPID() )
|
|
|
|
{
|
|
|
|
footprint = m_frame->GetBoard()->GetFirstFootprint();
|
|
|
|
|
|
|
|
if( footprint )
|
|
|
|
{
|
|
|
|
footprint->SetFPID( LIB_ID( libraryName, newName ) );
|
|
|
|
|
|
|
|
if( footprint->GetValue() == oldName )
|
|
|
|
footprint->SetValue( newName );
|
|
|
|
|
|
|
|
m_frame->OnModify();
|
|
|
|
m_frame->UpdateView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
footprint = m_frame->LoadFootprint( fpID );
|
|
|
|
|
2022-06-11 21:28:42 +00:00
|
|
|
if( footprint )
|
2022-04-21 10:57:15 +00:00
|
|
|
{
|
2022-06-11 21:28:42 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
footprint->SetFPID( LIB_ID( libraryName, newName ) );
|
2022-04-21 10:57:15 +00:00
|
|
|
|
2022-06-11 21:28:42 +00:00
|
|
|
if( footprint->GetValue() == oldName )
|
|
|
|
footprint->SetValue( newName );
|
2022-04-21 10:57:15 +00:00
|
|
|
|
2022-06-11 21:28:42 +00:00
|
|
|
m_frame->SaveFootprintInLibrary( footprint, libraryName );
|
2022-04-21 10:57:15 +00:00
|
|
|
|
2023-09-28 03:15:54 +00:00
|
|
|
PROJECT_PCB::PcbFootprintLibs( &m_frame->Prj() )->FootprintDelete( libraryName, oldName );
|
2022-06-11 21:28:42 +00:00
|
|
|
}
|
|
|
|
catch( const IO_ERROR& ioe )
|
|
|
|
{
|
|
|
|
DisplayError( m_frame, ioe.What() );
|
|
|
|
}
|
|
|
|
catch( ... )
|
|
|
|
{
|
|
|
|
// Best efforts...
|
|
|
|
}
|
2022-04-21 10:57:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wxDataViewItem treeItem = m_frame->GetLibTreeAdapter()->FindItem( fpID );
|
|
|
|
m_frame->UpdateLibraryTree( treeItem, footprint );
|
|
|
|
m_frame->FocusOnLibID( LIB_ID( libraryName, newName ) );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::DeleteFootprint( const TOOL_EVENT& aEvent )
|
2019-06-03 23:50:44 +00:00
|
|
|
{
|
|
|
|
FOOTPRINT_EDIT_FRAME* frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
|
|
|
|
|
2020-11-10 20:31:52 +00:00
|
|
|
if( frame->DeleteFootprintFromLibrary( frame->GetTargetFPID(), true ) )
|
2019-06-03 23:50:44 +00:00
|
|
|
{
|
|
|
|
if( frame->GetTargetFPID() == frame->GetLoadedFPID() )
|
|
|
|
frame->Clear_Pcb( false );
|
|
|
|
|
|
|
|
frame->SyncLibraryTree( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::ImportFootprint( const TOOL_EVENT& aEvent )
|
2019-06-06 11:45:28 +00:00
|
|
|
{
|
2021-01-31 14:08:05 +00:00
|
|
|
bool is_last_fp_from_brd = m_frame->IsCurrentFPFromBoard();
|
|
|
|
|
2019-06-06 11:45:28 +00:00
|
|
|
if( !m_frame->Clear_Pcb( true ) )
|
|
|
|
return -1; // this command is aborted
|
|
|
|
|
2019-06-13 13:34:38 +00:00
|
|
|
getViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
2020-11-10 20:31:52 +00:00
|
|
|
m_frame->ImportFootprint();
|
2019-06-06 11:45:28 +00:00
|
|
|
|
2020-11-08 21:29:04 +00:00
|
|
|
if( m_frame->GetBoard()->GetFirstFootprint() )
|
|
|
|
m_frame->GetBoard()->GetFirstFootprint()->ClearFlags();
|
2019-06-06 11:45:28 +00:00
|
|
|
|
2020-07-13 11:21:40 +00:00
|
|
|
frame()->ClearUndoRedoList();
|
2019-06-06 11:45:28 +00:00
|
|
|
|
2021-01-31 14:08:05 +00:00
|
|
|
// Update the save items if needed.
|
|
|
|
if( is_last_fp_from_brd )
|
|
|
|
{
|
|
|
|
m_frame->ReCreateMenuBar();
|
|
|
|
m_frame->ReCreateHToolbar();
|
|
|
|
}
|
|
|
|
|
2023-06-26 22:16:51 +00:00
|
|
|
m_toolMgr->RunAction( ACTIONS::zoomFitScreen );
|
2019-06-06 11:45:28 +00:00
|
|
|
m_frame->OnModify();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::ExportFootprint( const TOOL_EVENT& aEvent )
|
2019-06-06 11:45:28 +00:00
|
|
|
{
|
2023-07-15 16:37:17 +00:00
|
|
|
if( FOOTPRINT* fp = m_frame->GetBoard()->GetFirstFootprint() )
|
2023-03-29 16:46:30 +00:00
|
|
|
m_frame->ExportFootprint( fp );
|
2019-07-19 16:15:23 +00:00
|
|
|
|
2019-06-06 11:45:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::EditFootprint( const TOOL_EVENT& aEvent )
|
2019-06-06 11:45:28 +00:00
|
|
|
{
|
2020-11-24 22:16:41 +00:00
|
|
|
m_frame->LoadFootprintFromLibrary( m_frame->GetTreeFPID() );
|
2019-06-06 11:45:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::PinLibrary( const TOOL_EVENT& aEvent )
|
2020-02-07 17:06:24 +00:00
|
|
|
{
|
|
|
|
LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
|
|
|
|
|
|
|
|
if( currentNode && !currentNode->m_Pinned )
|
|
|
|
{
|
2022-09-21 13:44:13 +00:00
|
|
|
m_frame->Prj().PinLibrary( currentNode->m_LibId.GetLibNickname(), false );
|
2022-07-22 08:26:49 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
currentNode->m_Pinned = true;
|
|
|
|
m_frame->RegenerateLibraryTree();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::UnpinLibrary( const TOOL_EVENT& aEvent )
|
2020-02-07 17:06:24 +00:00
|
|
|
{
|
|
|
|
LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
|
|
|
|
|
|
|
|
if( currentNode && currentNode->m_Pinned )
|
|
|
|
{
|
2022-09-21 13:44:13 +00:00
|
|
|
m_frame->Prj().UnpinLibrary( currentNode->m_LibId.GetLibNickname(), false );
|
2022-07-22 08:26:49 +00:00
|
|
|
|
2020-02-07 17:06:24 +00:00
|
|
|
currentNode->m_Pinned = false;
|
|
|
|
m_frame->RegenerateLibraryTree();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::ToggleFootprintTree( const TOOL_EVENT& aEvent )
|
2019-06-06 11:45:28 +00:00
|
|
|
{
|
|
|
|
m_frame->ToggleSearchTree();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-10-30 22:21:15 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::ToggleLayersManager( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
m_frame->ToggleLayersManager();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-02-16 03:16:49 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::ToggleProperties( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
m_frame->ToggleProperties();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::Properties( const TOOL_EVENT& aEvent )
|
2019-06-03 23:50:44 +00:00
|
|
|
{
|
2023-07-15 16:37:17 +00:00
|
|
|
if( FOOTPRINT* footprint = m_frame->GetBoard()->GetFirstFootprint() )
|
2019-06-03 23:50:44 +00:00
|
|
|
{
|
|
|
|
getEditFrame<FOOTPRINT_EDIT_FRAME>()->OnEditItemRequest( footprint );
|
2019-06-13 17:28:55 +00:00
|
|
|
m_frame->GetCanvas()->Refresh();
|
2019-06-03 23:50:44 +00:00
|
|
|
}
|
2023-07-15 16:37:17 +00:00
|
|
|
|
2019-06-03 23:50:44 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::DefaultPadProperties( const TOOL_EVENT& aEvent )
|
2019-06-03 23:50:44 +00:00
|
|
|
{
|
2020-10-14 23:37:26 +00:00
|
|
|
getEditFrame<FOOTPRINT_EDIT_FRAME>()->ShowPadPropertiesDialog( nullptr );
|
2019-06-03 23:50:44 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::CleanupGraphics( const TOOL_EVENT& aEvent )
|
2020-06-17 12:46:50 +00:00
|
|
|
{
|
|
|
|
FOOTPRINT_EDIT_FRAME* editFrame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
|
|
|
|
DIALOG_CLEANUP_GRAPHICS dlg( editFrame, true );
|
|
|
|
|
|
|
|
dlg.ShowModal();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::CheckFootprint( const TOOL_EVENT& aEvent )
|
2020-11-21 20:42:27 +00:00
|
|
|
{
|
|
|
|
if( !m_checkerDialog )
|
|
|
|
{
|
|
|
|
m_checkerDialog = new DIALOG_FOOTPRINT_CHECKER( m_frame );
|
|
|
|
m_checkerDialog->Show( true );
|
|
|
|
}
|
|
|
|
else // The dialog is just not visible (because the user has double clicked on an error item)
|
|
|
|
{
|
|
|
|
m_checkerDialog->Show( true );
|
|
|
|
}
|
2022-08-20 10:01:43 +00:00
|
|
|
|
2020-11-21 20:42:27 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-08-20 10:01:43 +00:00
|
|
|
void FOOTPRINT_EDITOR_CONTROL::CrossProbe( const PCB_MARKER* aMarker )
|
|
|
|
{
|
|
|
|
if( !m_checkerDialog )
|
|
|
|
m_checkerDialog = new DIALOG_FOOTPRINT_CHECKER( m_frame );
|
|
|
|
|
2021-08-19 21:28:54 +00:00
|
|
|
if( !m_checkerDialog->IsShownOnScreen() )
|
2022-08-20 10:01:43 +00:00
|
|
|
m_checkerDialog->Show( true );
|
|
|
|
|
|
|
|
m_checkerDialog->SelectMarker( aMarker );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
void FOOTPRINT_EDITOR_CONTROL::DestroyCheckerDialog()
|
2020-11-21 20:42:27 +00:00
|
|
|
{
|
|
|
|
if( m_checkerDialog )
|
|
|
|
{
|
|
|
|
m_checkerDialog->Destroy();
|
|
|
|
m_checkerDialog = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-05-21 16:52:11 +00:00
|
|
|
int FOOTPRINT_EDITOR_CONTROL::RepairFootprint( const TOOL_EVENT& aEvent )
|
|
|
|
{
|
|
|
|
FOOTPRINT* footprint = board()->Footprints().front();
|
|
|
|
int errors = 0;
|
|
|
|
wxString details;
|
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
// Repair duplicate IDs and missing nets.
|
2021-05-21 16:52:11 +00:00
|
|
|
std::set<KIID> ids;
|
|
|
|
int duplicates = 0;
|
|
|
|
|
|
|
|
auto processItem =
|
|
|
|
[&]( EDA_ITEM* aItem )
|
|
|
|
{
|
|
|
|
if( ids.count( aItem->m_Uuid ) )
|
|
|
|
{
|
|
|
|
duplicates++;
|
|
|
|
const_cast<KIID&>( aItem->m_Uuid ) = KIID();
|
|
|
|
}
|
|
|
|
|
|
|
|
ids.insert( aItem->m_Uuid );
|
|
|
|
};
|
|
|
|
|
|
|
|
// Footprint IDs are the most important, so give them the first crack at "claiming" a
|
|
|
|
// particular KIID.
|
|
|
|
|
|
|
|
processItem( footprint );
|
|
|
|
|
|
|
|
// After that the principal use is for DRC marker pointers, which are most likely to pads.
|
|
|
|
|
|
|
|
for( PAD* pad : footprint->Pads() )
|
|
|
|
processItem( pad );
|
|
|
|
|
|
|
|
// From here out I don't think order matters much.
|
|
|
|
|
|
|
|
processItem( &footprint->Reference() );
|
|
|
|
processItem( &footprint->Value() );
|
|
|
|
|
|
|
|
for( BOARD_ITEM* item : footprint->GraphicalItems() )
|
|
|
|
processItem( item );
|
|
|
|
|
|
|
|
for( ZONE* zone : footprint->Zones() )
|
|
|
|
processItem( zone );
|
|
|
|
|
|
|
|
for( PCB_GROUP* group : footprint->Groups() )
|
|
|
|
processItem( group );
|
|
|
|
|
|
|
|
if( duplicates )
|
|
|
|
{
|
|
|
|
errors += duplicates;
|
|
|
|
details += wxString::Format( _( "%d duplicate IDs replaced.\n" ), duplicates );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************
|
|
|
|
* Your test here
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*******************************
|
|
|
|
* Inform the user
|
|
|
|
*/
|
|
|
|
|
|
|
|
if( errors )
|
|
|
|
{
|
|
|
|
m_frame->OnModify();
|
|
|
|
|
|
|
|
wxString msg = wxString::Format( _( "%d potential problems repaired." ), errors );
|
|
|
|
DisplayInfoMessage( m_frame, msg, details );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DisplayInfoMessage( m_frame, _( "No footprint problems found." ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-12-25 16:26:32 +00:00
|
|
|
void FOOTPRINT_EDITOR_CONTROL::setTransitions()
|
2014-07-09 13:02:56 +00:00
|
|
|
{
|
2020-12-25 16:26:32 +00:00
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::NewFootprint, PCB_ACTIONS::newFootprint.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::CreateFootprint, PCB_ACTIONS::createFootprint.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::Revert, ACTIONS::revert.MakeEvent() );
|
2022-04-21 10:57:15 +00:00
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::DuplicateFootprint, PCB_ACTIONS::duplicateFootprint.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::RenameFootprint, PCB_ACTIONS::renameFootprint.MakeEvent() );
|
2020-12-25 16:26:32 +00:00
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::DeleteFootprint, PCB_ACTIONS::deleteFootprint.MakeEvent() );
|
|
|
|
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::EditFootprint, PCB_ACTIONS::editFootprint.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::CutCopyFootprint, PCB_ACTIONS::cutFootprint.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::CutCopyFootprint, PCB_ACTIONS::copyFootprint.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::PasteFootprint, PCB_ACTIONS::pasteFootprint.MakeEvent() );
|
|
|
|
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::ImportFootprint, PCB_ACTIONS::importFootprint.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::ExportFootprint, PCB_ACTIONS::exportFootprint.MakeEvent() );
|
|
|
|
|
2021-11-20 22:05:57 +00:00
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::EditTextAndGraphics, PCB_ACTIONS::editTextAndGraphics.MakeEvent() );
|
2020-12-25 16:26:32 +00:00
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::CleanupGraphics, PCB_ACTIONS::cleanupGraphics.MakeEvent() );
|
|
|
|
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::CheckFootprint, PCB_ACTIONS::checkFootprint.MakeEvent() );
|
2021-05-21 16:52:11 +00:00
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::RepairFootprint, PCB_ACTIONS::repairFootprint.MakeEvent() );
|
2020-12-25 16:26:32 +00:00
|
|
|
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::PinLibrary, ACTIONS::pinLibrary.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::UnpinLibrary, ACTIONS::unpinLibrary.MakeEvent() );
|
2021-10-30 22:21:15 +00:00
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::ToggleFootprintTree, PCB_ACTIONS::showFootprintTree.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::ToggleFootprintTree, PCB_ACTIONS::hideFootprintTree.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::Properties, PCB_ACTIONS::footprintProperties.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::DefaultPadProperties, PCB_ACTIONS::defaultPadProperties.MakeEvent() );
|
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::ToggleLayersManager, PCB_ACTIONS::showLayersManager.MakeEvent() );
|
2023-02-16 03:16:49 +00:00
|
|
|
Go( &FOOTPRINT_EDITOR_CONTROL::ToggleProperties, PCB_ACTIONS::showProperties.MakeEvent() );
|
2014-07-09 13:02:56 +00:00
|
|
|
}
|