2013-05-28 12:54:59 -04:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2022-10-17 09:19:39 -04:00
|
|
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-05-28 12:54:59 -04: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
|
|
|
|
*/
|
|
|
|
|
2021-06-03 18:03:25 +01:00
|
|
|
#include <board_commit.h>
|
2020-01-12 20:44:19 -05:00
|
|
|
#include <confirm.h>
|
2021-04-04 10:41:48 +01:00
|
|
|
#include <dialog_footprint_properties_fp_editor.h>
|
2020-01-12 20:44:19 -05:00
|
|
|
#include <footprint_edit_frame.h>
|
|
|
|
#include <footprint_tree_pane.h>
|
|
|
|
#include <fp_lib_table.h>
|
|
|
|
#include <functional>
|
2018-08-19 17:53:01 +01:00
|
|
|
#include <kiway_express.h>
|
2022-12-15 00:15:40 +00:00
|
|
|
#include <pcb_group.h>
|
2022-08-20 11:44:40 +01:00
|
|
|
#include <pcb_marker.h>
|
2023-03-30 12:49:23 +01:00
|
|
|
#include <pcb_textbox.h>
|
|
|
|
#include <pcb_shape.h>
|
2022-08-20 11:44:40 +01:00
|
|
|
#include <pad.h>
|
|
|
|
#include <zone.h>
|
2020-01-12 20:44:19 -05:00
|
|
|
#include <settings/color_settings.h>
|
2014-07-09 13:50:27 +02:00
|
|
|
#include <tool/tool_manager.h>
|
2017-02-21 13:42:08 +01:00
|
|
|
#include <tools/pcb_actions.h>
|
2022-08-20 11:01:43 +01:00
|
|
|
#include <tools/footprint_editor_control.h>
|
2020-09-29 23:29:58 -04:00
|
|
|
#include <widgets/appearance_controls.h>
|
2020-01-12 20:44:19 -05:00
|
|
|
#include <widgets/lib_tree.h>
|
2021-07-22 00:14:56 +01:00
|
|
|
#include <pcb_layer_box_selector.h>
|
2021-12-04 23:52:00 +00:00
|
|
|
#include <pcb_dimension.h>
|
2023-09-27 23:15:54 -04:00
|
|
|
#include <project_pcb.h>
|
2021-12-04 23:52:00 +00:00
|
|
|
#include <dialogs/dialog_dimension_properties.h>
|
2012-05-09 19:37:25 +02:00
|
|
|
|
2016-06-29 12:23:11 +02:00
|
|
|
using namespace std::placeholders;
|
2014-07-09 15:10:32 +02:00
|
|
|
|
2011-09-23 09:57:12 -04:00
|
|
|
|
2022-01-10 14:03:30 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::OnLoadFootprintFromBoard( wxCommandEvent& event )
|
2009-05-21 17:42:42 +00:00
|
|
|
{
|
2021-07-19 19:56:05 -04:00
|
|
|
LoadFootprintFromBoard( nullptr );
|
2018-10-15 15:28:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-31 14:08:05 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary( LIB_ID aFPID )
|
2018-10-15 15:28:53 +01:00
|
|
|
{
|
2019-01-18 17:24:40 +01:00
|
|
|
bool is_last_fp_from_brd = IsCurrentFPFromBoard();
|
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT* footprint = LoadFootprint( aFPID );
|
2018-10-15 15:28:53 +01:00
|
|
|
|
2020-11-08 21:29:04 +00:00
|
|
|
if( !footprint )
|
2010-06-14 22:16:47 +02:00
|
|
|
return;
|
|
|
|
|
2018-10-15 15:28:53 +01:00
|
|
|
if( !Clear_Pcb( true ) )
|
|
|
|
return;
|
|
|
|
|
2019-06-13 18:28:55 +01:00
|
|
|
GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
2020-11-10 20:31:52 +00:00
|
|
|
AddFootprintToBoard( footprint );
|
2018-10-15 15:28:53 +01:00
|
|
|
|
2020-11-08 21:29:04 +00:00
|
|
|
footprint->ClearFlags();
|
2019-05-30 17:15:57 -07:00
|
|
|
|
2023-06-06 13:30:03 -04:00
|
|
|
// if either reference or value are missing, reinstall them -
|
2020-11-08 21:29:04 +00:00
|
|
|
// otherwise you cannot see what you are doing on board
|
2023-06-06 13:30:03 -04:00
|
|
|
if( footprint->Reference().GetText().IsEmpty() )
|
|
|
|
footprint->SetReference( wxT( "Ref**" ) );
|
2018-10-15 15:28:53 +01:00
|
|
|
|
2023-06-06 13:30:03 -04:00
|
|
|
if( footprint->Value().GetText().IsEmpty() )
|
|
|
|
footprint->SetValue( wxT( "Val**" ) );
|
2018-10-15 15:28:53 +01:00
|
|
|
|
2022-04-21 09:00:04 +02:00
|
|
|
Zoom_Automatique( false );
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2021-04-08 22:09:06 -04:00
|
|
|
Update3DView( true, true );
|
2018-10-15 15:28:53 +01:00
|
|
|
|
2021-05-28 12:07:04 -07:00
|
|
|
GetScreen()->SetContentModified( false );
|
2018-10-15 15:28:53 +01:00
|
|
|
|
2020-11-10 20:11:53 +00:00
|
|
|
UpdateView();
|
2019-06-13 18:28:55 +01:00
|
|
|
GetCanvas()->Refresh();
|
2018-10-24 21:14:36 +01:00
|
|
|
|
2019-06-04 00:50:44 +01:00
|
|
|
// Update the save items if needed.
|
2019-01-18 17:24:40 +01:00
|
|
|
if( is_last_fp_from_brd )
|
2019-06-04 00:50:44 +01:00
|
|
|
{
|
|
|
|
ReCreateMenuBar();
|
2019-01-18 17:24:40 +01:00
|
|
|
ReCreateHToolbar();
|
2019-06-04 00:50:44 +01:00
|
|
|
}
|
2019-01-18 17:24:40 +01:00
|
|
|
|
2018-10-24 21:14:36 +01:00
|
|
|
m_treePane->GetLibTree()->ExpandLibId( aFPID );
|
2021-10-01 22:45:49 +01:00
|
|
|
|
|
|
|
m_centerItemOnIdle = aFPID;
|
|
|
|
Bind( wxEVT_IDLE, &FOOTPRINT_EDIT_FRAME::centerItemIdleHandler, this );
|
|
|
|
|
2019-11-26 21:38:57 +00:00
|
|
|
m_treePane->GetLibTree()->RefreshLibTree(); // update highlighting
|
2009-05-21 17:42:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-10-01 22:45:49 +01:00
|
|
|
void FOOTPRINT_EDIT_FRAME::centerItemIdleHandler( wxIdleEvent& aEvent )
|
|
|
|
{
|
|
|
|
m_treePane->GetLibTree()->CenterLibId( m_centerItemOnIdle );
|
|
|
|
Unbind( wxEVT_IDLE, &FOOTPRINT_EDIT_FRAME::centerItemIdleHandler, this );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-10 20:11:53 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::SelectLayer( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-11-10 20:11:53 +00:00
|
|
|
SetActiveLayer( ToLAYER_ID( m_selLayerBox->GetLayerSelection() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2020-11-10 20:11:53 +00:00
|
|
|
if( GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL )
|
|
|
|
GetCanvas()->Refresh();
|
|
|
|
}
|
2019-11-03 17:14:21 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2022-01-10 14:03:30 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::OnSaveFootprintToBoard( wxCommandEvent& event )
|
2020-11-10 20:11:53 +00:00
|
|
|
{
|
|
|
|
SaveFootprintToBoard( true );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2011-11-24 11:32:51 -06:00
|
|
|
|
2019-09-04 17:18:42 +01:00
|
|
|
class BASIC_FOOTPRINT_INFO : public FOOTPRINT_INFO
|
|
|
|
{
|
|
|
|
public:
|
2020-11-13 15:15:52 +00:00
|
|
|
BASIC_FOOTPRINT_INFO( FOOTPRINT* aFootprint )
|
2019-09-04 17:18:42 +01:00
|
|
|
{
|
2022-10-17 09:19:39 -04:00
|
|
|
wxASSERT( aFootprint );
|
|
|
|
|
2020-11-13 02:09:34 +00:00
|
|
|
m_nickname = aFootprint->GetFPID().GetLibNickname().wx_str();
|
|
|
|
m_fpname = aFootprint->GetFPID().GetLibItemName().wx_str();
|
|
|
|
m_pad_count = aFootprint->GetPadCount( DO_NOT_INCLUDE_NPTH );
|
|
|
|
m_unique_pad_count = aFootprint->GetUniquePadCount( DO_NOT_INCLUDE_NPTH );
|
|
|
|
m_keywords = aFootprint->GetKeywords();
|
2023-06-19 13:08:18 -04:00
|
|
|
m_doc = aFootprint->GetLibDescription();
|
2019-09-04 17:18:42 +01:00
|
|
|
m_loaded = true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2022-04-21 11:57:15 +01:00
|
|
|
void FOOTPRINT_EDIT_FRAME::UpdateLibraryTree( const wxDataViewItem& aTreeItem,
|
|
|
|
FOOTPRINT* aFootprint )
|
2018-09-13 16:39:14 +01:00
|
|
|
{
|
2022-10-26 14:39:44 -04:00
|
|
|
wxCHECK( aFootprint, /* void */ );
|
|
|
|
|
2020-11-13 02:09:34 +00:00
|
|
|
BASIC_FOOTPRINT_INFO footprintInfo( aFootprint );
|
2019-09-06 15:37:26 +02:00
|
|
|
|
2022-04-21 11:57:15 +01:00
|
|
|
if( aTreeItem.IsOk() ) // Can be not found in tree if the current footprint is imported
|
|
|
|
// from file therefore not yet in tree.
|
2019-09-06 15:37:26 +02:00
|
|
|
{
|
2023-11-17 18:17:50 +00:00
|
|
|
static_cast<LIB_TREE_NODE_ITEM*>( aTreeItem.GetID() )->Update( &footprintInfo );
|
2019-11-26 21:38:57 +00:00
|
|
|
m_treePane->GetLibTree()->RefreshLibTree();
|
2019-09-06 15:37:26 +02:00
|
|
|
}
|
2022-04-21 11:57:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_EDIT_FRAME::editFootprintProperties( FOOTPRINT* aFootprint )
|
|
|
|
{
|
|
|
|
LIB_ID oldFPID = aFootprint->GetFPID();
|
|
|
|
|
|
|
|
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR dialog( this, aFootprint );
|
|
|
|
dialog.ShowModal();
|
2019-09-04 17:18:42 +01:00
|
|
|
|
2022-04-21 11:57:15 +01:00
|
|
|
// Update library tree and title in case of a name change
|
|
|
|
wxDataViewItem treeItem = m_adapter->FindItem( oldFPID );
|
|
|
|
UpdateLibraryTree( treeItem, aFootprint );
|
|
|
|
UpdateTitle();
|
2019-09-04 17:18:42 +01:00
|
|
|
|
|
|
|
UpdateMsgPanel();
|
2018-09-13 16:39:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-29 00:23:58 +01:00
|
|
|
void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
|
2018-01-31 14:54:31 +01:00
|
|
|
{
|
2019-05-28 01:00:33 +01:00
|
|
|
switch( aItem->Type() )
|
2018-01-31 14:54:31 +01:00
|
|
|
{
|
2023-10-23 18:23:24 +01:00
|
|
|
case PCB_REFERENCE_IMAGE_T:
|
|
|
|
ShowReferenceImagePropertiesDialog( aItem );
|
2022-07-07 10:17:21 -04:00
|
|
|
break;
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
case PCB_PAD_T:
|
2020-11-13 15:15:52 +00:00
|
|
|
ShowPadPropertiesDialog( static_cast<PAD*>( aItem ) );
|
2018-01-31 14:54:31 +01:00
|
|
|
break;
|
|
|
|
|
2020-11-13 12:21:02 +00:00
|
|
|
case PCB_FOOTPRINT_T:
|
2020-11-13 15:15:52 +00:00
|
|
|
editFootprintProperties( static_cast<FOOTPRINT*>( aItem ) );
|
2019-06-13 18:28:55 +01:00
|
|
|
GetCanvas()->Refresh();
|
2018-01-31 14:54:31 +01:00
|
|
|
break;
|
|
|
|
|
2023-06-06 11:09:34 -04:00
|
|
|
case PCB_FIELD_T:
|
2023-03-30 12:49:23 +01:00
|
|
|
case PCB_TEXT_T:
|
|
|
|
ShowTextPropertiesDialog( static_cast<PCB_TEXT*>( aItem ) );
|
2019-05-28 01:00:33 +01:00
|
|
|
break;
|
|
|
|
|
2023-03-30 12:49:23 +01:00
|
|
|
case PCB_TEXTBOX_T:
|
|
|
|
ShowTextBoxPropertiesDialog( static_cast<PCB_TEXTBOX*>( aItem ) );
|
2022-01-30 10:52:52 +00:00
|
|
|
break;
|
|
|
|
|
2023-03-30 12:49:23 +01:00
|
|
|
case PCB_SHAPE_T :
|
|
|
|
ShowGraphicItemPropertiesDialog( static_cast<PCB_SHAPE*>( aItem ) );
|
2018-01-31 14:54:31 +01:00
|
|
|
break;
|
|
|
|
|
2023-03-30 12:49:23 +01:00
|
|
|
case PCB_DIM_ALIGNED_T:
|
|
|
|
case PCB_DIM_CENTER_T:
|
|
|
|
case PCB_DIM_RADIAL_T:
|
|
|
|
case PCB_DIM_ORTHOGONAL_T:
|
|
|
|
case PCB_DIM_LEADER_T:
|
2021-12-04 23:52:00 +00:00
|
|
|
{
|
|
|
|
DIALOG_DIMENSION_PROPERTIES dlg( this, static_cast<PCB_DIMENSION_BASE*>( aItem ) );
|
|
|
|
dlg.ShowQuasiModal();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2023-03-30 12:49:23 +01:00
|
|
|
case PCB_ZONE_T:
|
2019-10-26 17:49:29 +02:00
|
|
|
{
|
2020-11-11 23:05:59 +00:00
|
|
|
ZONE* zone = static_cast<ZONE*>( aItem );
|
|
|
|
bool success = false;
|
|
|
|
ZONE_SETTINGS zoneSettings;
|
2020-08-09 12:22:09 +01:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
zoneSettings << *static_cast<ZONE*>( aItem );
|
2020-08-09 12:22:09 +01:00
|
|
|
|
2020-09-21 19:32:07 -04:00
|
|
|
if( zone->GetIsRuleArea() )
|
2019-10-26 17:49:29 +02:00
|
|
|
{
|
2021-02-20 18:22:11 +00:00
|
|
|
success = InvokeRuleAreaEditor( this, &zoneSettings ) == wxID_OK;
|
2020-08-09 12:22:09 +01:00
|
|
|
}
|
|
|
|
else if( zone->IsOnCopperLayer() )
|
|
|
|
{
|
2021-02-20 18:22:11 +00:00
|
|
|
success = InvokeCopperZonesEditor( this, &zoneSettings ) == wxID_OK;
|
2020-08-09 12:22:09 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-02-20 18:22:11 +00:00
|
|
|
success = InvokeNonCopperZonesEditor( this, &zoneSettings ) == wxID_OK;
|
2020-08-09 12:22:09 +01:00
|
|
|
}
|
2019-10-26 17:49:29 +02:00
|
|
|
|
2020-08-09 12:22:09 +01:00
|
|
|
if( success )
|
|
|
|
{
|
|
|
|
BOARD_COMMIT commit( this );
|
|
|
|
commit.Modify( zone );
|
|
|
|
commit.Push( _( "Edit Zone" ) );
|
2020-11-11 23:05:59 +00:00
|
|
|
zoneSettings.ExportSetting( *static_cast<ZONE*>( aItem ) );
|
2019-10-26 17:49:29 +02:00
|
|
|
}
|
2021-07-19 19:56:05 -04:00
|
|
|
|
|
|
|
break;
|
2019-10-26 17:49:29 +02:00
|
|
|
}
|
|
|
|
|
2020-12-01 23:42:53 +00:00
|
|
|
case PCB_GROUP_T:
|
2023-10-18 17:11:21 +01:00
|
|
|
m_toolManager->RunAction( PCB_ACTIONS::groupProperties, static_cast<PCB_GROUP*>( aItem ) );
|
2020-12-01 23:42:53 +00:00
|
|
|
break;
|
|
|
|
|
2022-08-20 11:01:43 +01:00
|
|
|
case PCB_MARKER_T:
|
|
|
|
m_toolManager->GetTool<FOOTPRINT_EDITOR_CONTROL>()->CrossProbe( static_cast<PCB_MARKER*>( aItem ) );
|
|
|
|
break;
|
|
|
|
|
2018-01-31 14:54:31 +01:00
|
|
|
default:
|
2022-02-04 22:44:59 +00:00
|
|
|
wxFAIL_MSG( wxT( "FOOTPRINT_EDIT_FRAME::OnEditItemRequest: unsupported item type " )
|
2020-12-01 23:42:53 +00:00
|
|
|
+ aItem->GetClass() );
|
2019-05-28 01:00:33 +01:00
|
|
|
break;
|
2018-01-31 14:54:31 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-28 01:00:33 +01:00
|
|
|
|
2017-08-04 14:43:02 +02:00
|
|
|
COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor()
|
2013-04-11 20:29:56 +02:00
|
|
|
{
|
2020-05-16 13:15:43 -04:00
|
|
|
return GetColorSettings()->GetColor( LAYER_GRID );
|
2013-04-11 20:29:56 +02:00
|
|
|
}
|
|
|
|
|
2014-07-09 11:22:43 +02:00
|
|
|
|
2017-03-12 23:19:33 -04:00
|
|
|
void FOOTPRINT_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
|
2014-07-09 11:59:23 +02:00
|
|
|
{
|
|
|
|
PCB_BASE_FRAME::SetActiveLayer( aLayer );
|
|
|
|
|
2020-09-29 23:29:58 -04:00
|
|
|
m_appearancePanel->OnLayerChanged();
|
2015-01-07 20:07:15 +01:00
|
|
|
|
2023-06-26 23:16:51 +01:00
|
|
|
m_toolManager->PostAction( PCB_ACTIONS::layerChanged ); // notify other tools
|
2019-08-27 21:27:39 -07:00
|
|
|
GetCanvas()->SetFocus(); // allow capture of hotkeys
|
2019-06-13 18:28:55 +01:00
|
|
|
GetCanvas()->SetHighContrastLayer( aLayer );
|
|
|
|
GetCanvas()->Refresh();
|
2014-07-09 11:59:23 +02:00
|
|
|
}
|
2017-10-19 23:15:48 +02:00
|
|
|
|
2022-08-20 11:44:40 +01:00
|
|
|
|
2017-10-19 23:15:48 +02:00
|
|
|
bool FOOTPRINT_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
|
|
|
{
|
2021-01-31 14:08:05 +00:00
|
|
|
if( !Clear_Pcb( true ) )
|
|
|
|
return false; // this command is aborted
|
2017-10-19 23:15:48 +02:00
|
|
|
|
2019-06-13 18:28:55 +01:00
|
|
|
GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
2020-11-10 20:31:52 +00:00
|
|
|
ImportFootprint( aFileSet[ 0 ] );
|
2017-10-19 23:15:48 +02:00
|
|
|
|
2020-11-08 21:29:04 +00:00
|
|
|
if( GetBoard()->GetFirstFootprint() )
|
|
|
|
GetBoard()->GetFirstFootprint()->ClearFlags();
|
2017-10-19 23:15:48 +02:00
|
|
|
|
2021-05-28 12:07:04 -07:00
|
|
|
GetScreen()->SetContentModified( false );
|
2017-10-19 23:15:48 +02:00
|
|
|
Zoom_Automatique( false );
|
2019-06-13 18:28:55 +01:00
|
|
|
GetCanvas()->Refresh();
|
2017-10-19 23:15:48 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2018-08-19 17:53:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
|
|
|
{
|
|
|
|
const std::string& payload = mail.GetPayload();
|
|
|
|
|
|
|
|
switch( mail.Command() )
|
|
|
|
{
|
|
|
|
case MAIL_FP_EDIT:
|
|
|
|
if( !payload.empty() )
|
|
|
|
{
|
|
|
|
wxFileName fpFileName( payload );
|
2020-12-18 00:25:51 +00:00
|
|
|
wxString libNickname;
|
|
|
|
wxString msg;
|
2018-08-19 17:53:01 +01:00
|
|
|
|
2023-09-27 23:15:54 -04:00
|
|
|
FP_LIB_TABLE* libTable = PROJECT_PCB::PcbFootprintLibs( &Prj() );
|
2018-08-19 17:53:01 +01:00
|
|
|
const LIB_TABLE_ROW* libTableRow = libTable->FindRowByURI( fpFileName.GetPath() );
|
|
|
|
|
|
|
|
if( !libTableRow )
|
|
|
|
{
|
2020-12-18 00:25:51 +00:00
|
|
|
msg.Printf( _( "The current configuration does not include a library named '%s'.\n"
|
|
|
|
"Use Manage Footprint Libraries to edit the configuration." ),
|
2018-08-19 17:53:01 +01:00
|
|
|
fpFileName.GetPath() );
|
2021-07-19 19:56:05 -04:00
|
|
|
DisplayErrorMessage( this, _( "Library not found in footprint library table." ),
|
|
|
|
msg );
|
2018-08-19 17:53:01 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
libNickname = libTableRow->GetNickName();
|
|
|
|
|
|
|
|
if( !libTable->HasLibrary( libNickname, true ) )
|
|
|
|
{
|
2020-12-18 00:25:51 +00:00
|
|
|
msg.Printf( _( "The library '%s' is not enabled in the current configuration.\n"
|
|
|
|
"Use Manage Footprint Libraries to edit the configuration." ),
|
|
|
|
libNickname );
|
2018-08-19 17:53:01 +01:00
|
|
|
DisplayErrorMessage( this, _( "Footprint library not enabled." ), msg );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
LIB_ID fpId( libNickname, fpFileName.GetName() );
|
|
|
|
|
|
|
|
if( m_treePane )
|
|
|
|
{
|
|
|
|
m_treePane->GetLibTree()->SelectLibId( fpId );
|
2023-09-28 18:18:19 +01:00
|
|
|
wxCommandEvent event( EVT_LIBITEM_CHOSEN );
|
2018-08-19 17:53:01 +01:00
|
|
|
wxPostEvent( m_treePane, event );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2023-01-18 16:14:31 -08:00
|
|
|
case MAIL_RELOAD_LIB:
|
|
|
|
SyncLibraryTree( true );
|
|
|
|
RefreshLibraryTree();
|
|
|
|
break;
|
|
|
|
|
2018-08-19 17:53:01 +01:00
|
|
|
default:
|
2022-08-20 11:44:40 +01:00
|
|
|
break;
|
2018-08-19 17:53:01 +01:00
|
|
|
}
|
|
|
|
}
|